Bug 80544 - [1.5][annot]error on @Override of abstract methods
Summary: [1.5][annot]error on @Override of abstract methods
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 blocker (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-08 18:49 EST by Jens Elkner CLA
Modified: 2004-12-15 20:50 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Elkner CLA 2004-12-08 18:49:25 EST
If a class overides an abstract method from a super and this method
is annotated with an @Override tag, the jdt does not recognize the
method as an override and flags an error. E.g.:

public abstract class Foo {
	abstract protected boolean accept(Object o);
}

public class Bar extends Foo {
	@Override 
	protected boolean accept(Object o) { return false; }
}

Since accpet(...) in Foo as well as in Bar have the same signature (see
http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#38649)
accept in Foo does really override accpet in Bar (see
http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#227927).

So the given example is correct and should compile without errors (as with Sun's
javac). 

I marked it as blocker, since due to this bug jdt cannot be used in our
projects, anymore :(
Comment 1 Jens Elkner CLA 2004-12-08 18:52:44 EST
Ooops - forgot to mention the version:

Version: 3.1.0 Build id: 200412081200

Bug was probably introduced after 3.1.0M3
Comment 2 Philipe Mulet CLA 2004-12-09 04:42:29 EST
As a workaround, you may comment out the @Override annotation for now.
Problem comes from the fact we consider it to implement and not override, which
for the semantics of @Override should not be distinguished. Note that we can
distinguish in between interface/abstract method implementations and superclass
method override.
Comment 3 Philipe Mulet CLA 2004-12-15 08:17:22 EST
Problem comes from the fact we are considering method as implementing abstract
method and not overriding it (as for interface methods).
Comment 4 Philipe Mulet CLA 2004-12-15 09:19:17 EST
Added: AnnotationTest#test100.
Fixed
Comment 5 Philipe Mulet CLA 2004-12-15 10:32:29 EST
fixed
Comment 6 Olivier Thomann CLA 2004-12-15 20:50:18 EST
Verified in 200412160010