-
Enhancement
-
Resolution: Fixed
-
P4
-
7
-
b11
-
x86
-
linux
When a class extends a raw superclass, and overrides a method from it, the compiler issues a confusing error message. Example:
class A<T> {
void foo(Clazz<?> clazz) { ... }
}
class B extends A /* raw A here */ {
@Override
void foo(Clazz<?> clazz) { ... }
}
The error message is:
error: name clash: run(Class<?>) in A and run(Class<?>) in B have the same erasure, yet neither overrides the other
What is happening is that when you extend a raw type, the method descriptors are erased; at least the message should say run(Class<?>) and run(Class) to make it clear that erasure is the problem.
class A<T> {
void foo(Clazz<?> clazz) { ... }
}
class B extends A /* raw A here */ {
@Override
void foo(Clazz<?> clazz) { ... }
}
The error message is:
error: name clash: run(Class<?>) in A and run(Class<?>) in B have the same erasure, yet neither overrides the other
What is happening is that when you extend a raw type, the method descriptors are erased; at least the message should say run(Class<?>) and run(Class) to make it clear that erasure is the problem.
- duplicates
-
JDK-6760983 Unused type parameter triggering error in unrelated method
-
- Closed
-
-
JDK-6322564 Please improve error message regarding members of raw supertypes
-
- Closed
-