-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
6
$ cat -n Subst.java
1 class A<T> {
2 class B {
3 T returnT() { return null; }
4 Object returnU() { return null; }
5 }
6 }
$ cat -n Subst2.java
1 class A<T> {
2 class B<U> {
3 T returnT() { return null; }
4 U returnU() { return null; }
5 }
6 }
$ cat -n X.java
1 class X {
2 A<String>.B y;
3 }
$ cat -n Y.java
1 class Y {
2 X x;
3 void foo() {
4 String s = x.y.returnU();
5 }
6 public static void main(String... args) {
7 }
8 }
Now compile like this:
$ rm *.class
$ javac -sourcepath /xyyz Subst.java X.java Y.java
Y.java:4: incompatible types
found : java.lang.Object
required: java.lang.String
String s = x.y.returnU();
^
1 error
$ javac -sourcepath /xyyz Subst2.java Y.java
The last command succeeds indicating that the type variable U got the type String.
###@###.### 2004-11-18 05:34:50 GMT
1 class A<T> {
2 class B {
3 T returnT() { return null; }
4 Object returnU() { return null; }
5 }
6 }
$ cat -n Subst2.java
1 class A<T> {
2 class B<U> {
3 T returnT() { return null; }
4 U returnU() { return null; }
5 }
6 }
$ cat -n X.java
1 class X {
2 A<String>.B y;
3 }
$ cat -n Y.java
1 class Y {
2 X x;
3 void foo() {
4 String s = x.y.returnU();
5 }
6 public static void main(String... args) {
7 }
8 }
Now compile like this:
$ rm *.class
$ javac -sourcepath /xyyz Subst.java X.java Y.java
Y.java:4: incompatible types
found : java.lang.Object
required: java.lang.String
String s = x.y.returnU();
^
1 error
$ javac -sourcepath /xyyz Subst2.java Y.java
The last command succeeds indicating that the type variable U got the type String.
###@###.### 2004-11-18 05:34:50 GMT
- relates to
-
JDK-6356636 Compiler fails to read signatures of inner classes with non-generic outer instance leading to crash
-
- Closed
-