JDK-6409362 : A non-abstract method does not override an abstract one
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.lang.model
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-04-05
  • Updated: 2010-04-02
  • Resolved: 2006-05-10
Related Reports
Relates :  
Relates :  
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
The desciption is not correct. A non-abstract method does not override an abstract one. The former implements the latter.
-----
When a non-abstract method overrides an abstract one, the former is also said to implement the latter.
-----
http://java.sun.com/javase/6/docs/api/javax/lang/model/util/Elements.html#overrides(javax.lang.model.element.ExecutableElement,%20javax.lang.model.element.ExecutableElement,%20javax.lang.model.element.TypeElement)
http://java.sun.com/javase/6/docs/guide/apt/mirror/com/sun/mirror/util/Declarations.html#overrides(com.sun.mirror.declaration.MethodDeclaration,%20com.sun.mirror.declaration.MethodDeclaration)

-----
If the method not inherited is abstract, then the new declaration is said to implement it; if the method not inherited is not abstract, then the new declaration is said to override it.
-----
http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.4.3

  See also http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399361


URL OF FAULTY DOCUMENTATION :
http://java.sun.com/javase/6/docs/api/javax/lang/model/util/Elements.html#overrides(javax.lang.model.element.ExecutableElement,%20javax.lang.model.element.ExecutableElement,%20javax.lang.model.element.TypeElement)

Comments
EVALUATION The formal definition of "override" in JLS3 8.4.8 is as intended. The informal description in 6.4.3 should be corrected. A separate CR will be submitted to address that issue. This CR will be closed.
10-05-2006

EVALUATION The quoted section of the JLS does appear to contradict the specs of the overrides methods as indicated. It also implies that an abstract method can implement but cannot override an abstract method. That's surprising. Section 8.4.8 of JLS 3 provides the definition of "overrides" more formally, and it appears to agree with the specs of the overrides methods: An instance method m1 declared in a class C overrides another instance method, m2, declared in class A iff all of the following are true: 1. C is a subclass of A. 2. The signature of m1 is a subsignature (��8.4.2) of the signature of m2. 3. Either * m2 is public, protected or declared with default access in the same package as C, or * m1 overrides a method m3, m3 distinct from m1, m3 distinct from m2, such that m3 overrides m2. Moreover, if m1 is not abstract, then m1 is said to implement any and all declarations of abstract methods that it overrides. Will seek spec clarification.
05-04-2006