-
Bug
-
Resolution: Unresolved
-
P4
-
7u85, 8, 9
A and B are symmetric: A's nested class extends B, B's nested class extends A. Depending on the order of compilation a bridge method is generated in A$Nested or B$Nested, but not both.
$ cat I.java
interface I<T> {
void f(T t);
}
$ cat A.java
class A implements I<Number> {
public void f(Number x) {}
static class Nested extends B {
}
}
$ cat B.java
class B implements I<Number> {
public void f(Number x) {}
static class Nested extends A {
}
}
# pass A.java to javac first, A$Nested has a bridge method
$ rm -f *.class
$ javac I.java A.java B.java
$ javap -private 'A$Nested'
Compiled from "A.java"
class A$Nested extends B {
A$Nested();
public void f(java.lang.Object);
}
$ javap -private 'B$Nested'
Compiled from "B.java"
class B$Nested extends A {
B$Nested();
}
# pass B.java to javac first, B$Nested has a bridge method
$ rm -f *.class
$ javac I.java B.java A.java
$ javap -private 'A$Nested'
Compiled from "A.java"
class A$Nested extends B {
A$Nested();
}
$ javap -private 'B$Nested'
Compiled from "B.java"
class B$Nested extends A {
B$Nested();
public void f(java.lang.Object);
}
$ cat I.java
interface I<T> {
void f(T t);
}
$ cat A.java
class A implements I<Number> {
public void f(Number x) {}
static class Nested extends B {
}
}
$ cat B.java
class B implements I<Number> {
public void f(Number x) {}
static class Nested extends A {
}
}
# pass A.java to javac first, A$Nested has a bridge method
$ rm -f *.class
$ javac I.java A.java B.java
$ javap -private 'A$Nested'
Compiled from "A.java"
class A$Nested extends B {
A$Nested();
public void f(java.lang.Object);
}
$ javap -private 'B$Nested'
Compiled from "B.java"
class B$Nested extends A {
B$Nested();
}
# pass B.java to javac first, B$Nested has a bridge method
$ rm -f *.class
$ javac I.java B.java A.java
$ javap -private 'A$Nested'
Compiled from "A.java"
class A$Nested extends B {
A$Nested();
}
$ javap -private 'B$Nested'
Compiled from "B.java"
class B$Nested extends A {
B$Nested();
public void f(java.lang.Object);
}
- relates to
-
JDK-8133247 Use of HYPOTHETICAL flag in bridge generation logic leads to missing bridges in some cases
- Closed