Name: rmT116609 Date: 07/31/2003
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
FULL OS VERSION :
Windows XP
EXTRA RELEVANT SYSTEM CONFIGURATION :
generics prototype compiler 2.2-ea
A DESCRIPTION OF THE PROBLEM :
The prototype compiler rejects mutually recursive type variable bounds although the specification allows them.
package generics;
public class TypeVariablesInBounds {
public static <T extends S & Comparable<S>, S extends T>
T max(T arg1, S arg2) {
return (arg1.compareTo(arg2)>0)?arg1:arg2;
}
}
error message:
TypeVariablesInBounds.java:5: illegal forward reference
public static <T extends S & Comparable<S>, S extends T>
^
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile source
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
error-free compilation
ACTUAL -
compile-time error messages
ERROR MESSAGES/STACK TRACES THAT OCCUR :
TypeVariablesInBounds.java:5: illegal forward reference
public static <T extends S & Comparable<S>, S extends T>
^
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package generics;
public class TypeVariablesInBounds {
public static <T extends S & Comparable<S>, S extends T>
T max(T arg1, S arg2) {
return (arg1.compareTo(arg2)>0)?arg1:arg2;
}
}
---------- END SOURCE ----------
(Incident Review ID: 193242)
======================================================================