-
Bug
-
Resolution: Duplicate
-
P5
-
None
-
5.0
FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
Consider:
public interface Name<T extends Name> extends Comparable<T> {
@Override String toString();
@Override int compareTo(T o2);
}
Compiling produces the following result:
>javac Name.java
Name.java:3: method does not override a method from its superclass
@Override int compareTo(T o2);
^
1 error
javac correctly reports the annotation on compareTo(.) as an error. However, it passes the annotation on toString(). This contradicts JLS 3, section 9.6.1.4, which states that interface methods may never use @Override (See http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6.1.4.).
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
Consider:
public interface Name<T extends Name> extends Comparable<T> {
@Override String toString();
@Override int compareTo(T o2);
}
Compiling produces the following result:
>javac Name.java
Name.java:3: method does not override a method from its superclass
@Override int compareTo(T o2);
^
1 error
javac correctly reports the annotation on compareTo(.) as an error. However, it passes the annotation on toString(). This contradicts JLS 3, section 9.6.1.4, which states that interface methods may never use @Override (See http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6.1.4.).
REPRODUCIBILITY :
This bug can be reproduced always.
- duplicates
-
JDK-6399361 CONFORMANCE: @Override specification and compiler inconsistent
-
- Closed
-
- relates to
-
JDK-5008260 @Override should be generalized from 'superclass' to 'supertype'
-
- Closed
-