Bug 216570 - [1.5][compiler] @Override wrongly rejected when method implements rather than overrides
Summary: [1.5][compiler] @Override wrongly rejected when method implements rather than...
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M5   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-25 07:05 EST by Olivier Lefevre CLA
Modified: 2008-02-05 02:34 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Lefevre CLA 2008-01-25 07:05:34 EST
Compiling Bug2 yields: "The method eval(String) of type Bug2.Foo must 
override a superclass method", which is the same error as in javac5 but
has been obsolete for a while now: javac6 accepts it. Strictly speaking 
this is probably a duplicate of Bug 167262 but IMO that bug does not 
strike the correct note of urgency: we get hard errors, no warnings, 
and must make lots of changes when porting from javac, only to have to 
undo them again when ecj is fixed.
---------------------------------------------------------------------------
public class Bug2 {

    static interface IFoo {
        
        public boolean eval(String s);
    }

    static class Foo implements IFoo {

        @Override
        public boolean eval(String s) {
            return true;
        }
    }
}
Comment 1 Philipe Mulet CLA 2008-01-25 07:32:45 EST
Eclipse behaves as you expect if you set your project to use Java 1.6 compliance.
See preferences under: Java Compiler > Compiler compliance level > 1.6

btw - pls remember to specify the Eclipse build you are using
Comment 2 Olivier Lefevre CLA 2008-01-25 07:45:56 EST
True. I must have gotten confused between the target, compliance and source
flags.
Comment 3 Maxime Daniel CLA 2008-02-05 02:34:45 EST
Verified for 34M5 using I20080204-0010 build.