ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 46929] New: Javac and Override annotation
Date Fri, 27 Mar 2009 17:44:17 GMT

           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

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: ${}</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
     [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] ...\ 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.

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:
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message