When I use @Override the implementation of a method from the parent interface, I get a compiler error when calling the "javac" ant task. Eclipse is using the same compiler and does not throw an error. While the Java 6 documentation is vague on this scenario, from what I understand you can use the @Override annotation for overriding and implementing abstract methods. <echo>JAVA_HOME: ${java.home}</echo> <echo>ANT_HOME: ${ant.home}</echo> <echo>Ant Java Version: ${ant.java.version}</echo> <echo>Ant Version: ${ant.version}</echo> <echo>Java Version: ${java.version}</echo> Results in: [echo] JAVA_HOME: C:\Program Files\Java\jre1.6.0_05 [echo] ANT_HOME: C:\Program Files\Apache Software Foundation\apache-ant-1.7.1 [echo] Ant Java Version: 1.6 [echo] Ant Version: Apache Ant version 1.7.1 compiled on June 27 2008 [echo] Java Version: 1.6.0_05 Output (removed some directory information for privacy): [javac] Compiling 1 source file to ...\build\classes [javac] ...\XmlParserErrorResults.java:64: method does not override a method from its superclass [javac] @Override [javac] ^ [javac] 1 error Work around: Simply remove the "@Override" annotation and the problem is resolved. However, this seems like a pretty poor work around. Testing: As expected, if I legitimately break the code, by deleting the abstract method from my interface, I get the same error from "javac," but now I get it from Eclipse as well.
I don't think eclipse is using the same compiler as Ant, don't they have an incremental compiler in JDT? Anyway, the error message isn't Ant's but the compiler's error message and I don't see how/if Ant could/should change anything about it. If this is a bug, it is not Ant's.