FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
Specification: If a method is annotated with @Override but does not _override_ a _superclass_ method, compilers are required to generate an error message (see http://java.sun.com/javase/6/docs/api/java/lang/Override.html).
Implementation: _Implementing_ an _interface_ method using @Override will compile fine and NOT generate an error message.
Note: The specification was consistent to the implementation in JDK 1.5 but the implementation was changed in JDK 1.6 without changing the specification.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Use the @override annotation when implementing an interface methode. This will NOT generate an error message when compiling with JDK 1.6.
2. Now look in the JDK Specification (see http://java.sun.com/javase/6/docs/api/java/lang/Override.html). It says there should have been a compiler error (as was the case in JDK 1.5), because you did not _overwrite_ a _superclass_ method, you just _implemented_ an _interface_ method.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
There a two ways to fix the bug:
1. Fix the specification of the @Override annotation in JDK 1.6.
or
2. Fix the implementation of the @Override annotation in JDK 1.6 and consider a new @Implement adding an http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399361
REPRODUCIBILITY :
This bug can be reproduced always.
A DESCRIPTION OF THE PROBLEM :
Specification: If a method is annotated with @Override but does not _override_ a _superclass_ method, compilers are required to generate an error message (see http://java.sun.com/javase/6/docs/api/java/lang/Override.html).
Implementation: _Implementing_ an _interface_ method using @Override will compile fine and NOT generate an error message.
Note: The specification was consistent to the implementation in JDK 1.5 but the implementation was changed in JDK 1.6 without changing the specification.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Use the @override annotation when implementing an interface methode. This will NOT generate an error message when compiling with JDK 1.6.
2. Now look in the JDK Specification (see http://java.sun.com/javase/6/docs/api/java/lang/Override.html). It says there should have been a compiler error (as was the case in JDK 1.5), because you did not _overwrite_ a _superclass_ method, you just _implemented_ an _interface_ method.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
There a two ways to fix the bug:
1. Fix the specification of the @Override annotation in JDK 1.6.
or
2. Fix the implementation of the @Override annotation in JDK 1.6 and consider a new @Implement adding an http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399361
REPRODUCIBILITY :
This bug can be reproduced always.
- relates to
-
JDK-6501053 Specification of java.lang.Override was not updated when integrating 6399361
- Closed
-
JDK-6399361 CONFORMANCE: @Override specification and compiler inconsistent
- Closed
-
JDK-6709448 CONFORMANCE:@Override specification and compiler inconsistent 2
- Closed