-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
6
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_10-ea"
Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b10)
Java HotSpot(TM) Client VM (build 11.0-b09, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The introduction of a type parameter to a superclass can cause a compile-time error if that type parameter is not yet used. The compiler's complaint is about a seemingly unrelated over-ridden method.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See code below.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compilable code.
ACTUAL -
Compile-time error.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Setter.java:10: name clash: setStuff(java.util.List<java.lang.String>) in SpecialSetter and setStuff(java.util.List<java.lang.String>) in Setter have the same erasure, yet neither overrides the other
class SpecialSetter extends Setter {
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
// Does not compile (that's the point)
import java.util.List;
public class Setter<T> {
public void setStuff(List<String> strings) {
}
}
class SpecialSetter extends Setter {
public void setStuff(List<String> strings) {
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Force all subclasses to provide a value for the superclass's type parameter.
java version "1.6.0_10-ea"
Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b10)
Java HotSpot(TM) Client VM (build 11.0-b09, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The introduction of a type parameter to a superclass can cause a compile-time error if that type parameter is not yet used. The compiler's complaint is about a seemingly unrelated over-ridden method.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See code below.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compilable code.
ACTUAL -
Compile-time error.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Setter.java:10: name clash: setStuff(java.util.List<java.lang.String>) in SpecialSetter and setStuff(java.util.List<java.lang.String>) in Setter have the same erasure, yet neither overrides the other
class SpecialSetter extends Setter {
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
// Does not compile (that's the point)
import java.util.List;
public class Setter<T> {
public void setStuff(List<String> strings) {
}
}
class SpecialSetter extends Setter {
public void setStuff(List<String> strings) {
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Force all subclasses to provide a value for the superclass's type parameter.
- duplicates
-
JDK-7170058 Confusing error message from javac when overriding a method from a raw supertype
-
- Resolved
-