-
Bug
-
Resolution: Cannot Reproduce
-
P5
-
None
-
6
-
x86
-
solaris_10
FULL PRODUCT VERSION :
jdk-6-rc-bin-b90-solaris-i586-30_jun_2006
alderney:gmw$/export/i86pc/jdk1.6.0b90/bin/javac -version
javac 1.6.0-rc
ADDITIONAL OS VERSION INFORMATION :
SunOS alderney 5.10 Generic i86pc i386 i86pc
A DESCRIPTION OF THE PROBLEM :
javac disallows obj1 == obj2 in line 8 of the program because of 'incomparable types'.
This only occurs in this code when the type parameter in line 1 is recursive, i.e.
public class Gentest<T extends Gentest<T>> { ... -- failure
WIth a simple type parameter the program compiles and executes correctly.
public class Gentest<T> { ... -- compiles OK
This behaviour is also seen in jdk1.6.0beta2, but jdk1.6.0beta1 compiles correctly.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Gentest.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
alderney:gmw$/export/i86pc/jdk1.6.0beta1/bin/javac Gentest.java
alderney:gmw$/export/i86pc/jdk1.6.0beta1/bin/java Gentest
true
ACTUAL -
alderney:gmw$/export/i86pc/jdk1.6.0b90/bin/javac Gentest.java
Gentest.java:8: incomparable types: Gentest<capture#145 of ?> and Gentest.Concrete
return obj1 == obj2;
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Gentest<T extends Gentest<T>> {
public static void main(String args[]) {
Concrete obj = new Concrete();
System.out.println("" + isTheSame(obj, obj));
}
public static boolean isTheSame(Gentest<?> obj1, Concrete obj2) {
return obj1 == obj2;
}
public static class Concrete extends Gentest<Concrete> {
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Cast one side of the == operator to (Object).
jdk-6-rc-bin-b90-solaris-i586-30_jun_2006
alderney:gmw$/export/i86pc/jdk1.6.0b90/bin/javac -version
javac 1.6.0-rc
ADDITIONAL OS VERSION INFORMATION :
SunOS alderney 5.10 Generic i86pc i386 i86pc
A DESCRIPTION OF THE PROBLEM :
javac disallows obj1 == obj2 in line 8 of the program because of 'incomparable types'.
This only occurs in this code when the type parameter in line 1 is recursive, i.e.
public class Gentest<T extends Gentest<T>> { ... -- failure
WIth a simple type parameter the program compiles and executes correctly.
public class Gentest<T> { ... -- compiles OK
This behaviour is also seen in jdk1.6.0beta2, but jdk1.6.0beta1 compiles correctly.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Gentest.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
alderney:gmw$/export/i86pc/jdk1.6.0beta1/bin/javac Gentest.java
alderney:gmw$/export/i86pc/jdk1.6.0beta1/bin/java Gentest
true
ACTUAL -
alderney:gmw$/export/i86pc/jdk1.6.0b90/bin/javac Gentest.java
Gentest.java:8: incomparable types: Gentest<capture#145 of ?> and Gentest.Concrete
return obj1 == obj2;
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Gentest<T extends Gentest<T>> {
public static void main(String args[]) {
Concrete obj = new Concrete();
System.out.println("" + isTheSame(obj, obj));
}
public static boolean isTheSame(Gentest<?> obj1, Concrete obj2) {
return obj1 == obj2;
}
public static class Concrete extends Gentest<Concrete> {
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Cast one side of the == operator to (Object).