https://issues.apache.org/bugzilla/show_bug.cgi?id=46929
Summary: Javac and Override annotation
Product: Ant
Version: 1.7.1
Platform: PC
OS/Version: Windows XP
Status: NEW
Keywords: ErrorMessage
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: [email protected]
ReportedBy: [email protected]
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.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.