Bug 307957

Summary: Failure to resolve overriding method to the referenced interface when used with Ant
Product: [Eclipse Project] JDT Reporter: Mike <michael>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, jarthana, Olivier_Thomann, remy.suen
Version: 3.6Keywords: needinfo
Target Milestone: 3.6 M7   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Mike CLA 2010-04-02 02:18:25 EDT
Build Identifier: 20100218-1602

I am currently using the JDT compiler with Ant.  Inside Eclipse I get no errors.  However, once I run the ant build I get errors that methods with the @Override annotation do not override a method in the interface.  If I switch to the native compiler it works fine.  If I remove the @Override annotation it works fine.

Reproducible: Always

Steps to Reproduce:
Whenever I use ant with JDT as my compiler and I have an implementation or subclass in which I use the @Override annotation.
Comment 1 Remy Suen CLA 2010-04-02 07:24:40 EDT
@Override for interface methods is a Java 6 thing. You need to ensure you have the correct settings in your Eclipse project and your Ant file (they should match, naturally).
Comment 2 Walter Harley CLA 2010-04-02 12:17:14 EDT
In particular: where the javac compiler always assumes it is targeted at its "own" version of java (that is, javac 1.6 targets Java 1.6 behavior by default), you have to explicitly target the Eclipse command-line compiler.  I think the options are -target and -compliance, but I might be misremembering.
Comment 3 Mike CLA 2010-04-02 15:38:27 EDT
I will give that a try.  I believe the ant property is javac.target=1.6
Comment 4 Olivier Thomann CLA 2010-04-04 12:16:03 EDT
I would need an ant script that reproduces the problem.
Comment 5 Mike CLA 2010-04-06 01:23:46 EDT
I modified the original build file to specify a javac target as 1.6 and it works.  Thanks for your help.
Comment 6 Mike CLA 2010-04-06 01:26:06 EDT
Closing, not a bug.
Comment 7 Jay Arthanareeswaran CLA 2010-04-27 08:00:24 EDT
Verified for 3.6M7.