JDK-6501053 : Specification of java.lang.Override was not updated when integrating 6399361
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-12-05
  • Updated: 2017-05-16
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7 b06Fixed OpenJDK6Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
These changes to java.lang.Override were not integrated:

@@ -9,16 +9,30 @@
 
 import java.lang.annotation.*;
 
 /**
  * Indicates that a method declaration is intended to override a
- * method declaration in a superclass.  If a method is annotated with
- * this annotation type but does not override a superclass method,
- * compilers are required to generate an error message.
+ * method declaration in a supertype.  If a method is annotated with
+ * this annotation type compilers are required to generate an error
+ * message unless either of the following conditions hold:
+ *
+ * <ul>
+ * <li>
+ *     The method does override or implement a method declared in a
+ *     supertype.
+ * </li>
+ * <li>
+ *     The method has a signature that is override-equivalent to that
+ *     of any public or protected method declared in {@linkplain
+ *     Object}.
+ * </li>
+ * </ul>
  *
  * @author  Joshua Bloch
+ * @author  Peter von der Ah&eacute;
  * @since 1.5
+ * @jls3 9.6.1.4 Override
  */
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.SOURCE)
 public @interface Override {
 }

Comments
EVALUATION Actually, the above specification is not correct because protected members from Object are not members of interfaces. This matters to Object.clone and this should not compile (and doesn't): interface I { @Override Object clone(); } It should be: Indicates that a method declaration is intended to override a method declaration in a supertype. If a method is annotated with this annotation type compilers are required to generate an error message unless at least one of the following conditions hold: * The method does override or implement a method declared in a supertype. * The method has a signature that is override-equivalent to that of any public method declared in Object.
06-12-2006

SUGGESTED FIX Index: src/share/classes/java/lang/Override.java --- /tmp/geta9023 2006-12-14 18:18:46.000000000 -0800 +++ /tmp/getb9023 2006-12-14 18:18:46.000000000 -0800 @@ -11,11 +11,21 @@ /** * Indicates that a method declaration is intended to override a - * method declaration in a superclass. If a method is annotated with - * this annotation type but does not override a superclass method, - * compilers are required to generate an error message. + * method declaration in a supertype. If a method is annotated with + * this annotation type compilers are required to generate an error + * message unless at least one of the following conditions hold: * + * <ul><li> + * The method does override or implement a method declared in a + * supertype. + * </li><li> + * The method has a signature that is override-equivalent to that of + * any public method declared in {@linkplain Object}. + * </li></ul> + * + * @author Peter von der Ah&eacute; * @author Joshua Bloch + * @jls3 9.6.1.4 Override * @since 1.5 */ @Target(ElementType.METHOD)
05-12-2006

EVALUATION Unfortunate mistake. Should be fixed ASAP. It is unclear what we can do for JDK 6.
05-12-2006