> Your experience is the reverse of mine. In maven, no javac complaints.
> In eclipse, plenty-o-complaints.

Ooops, had the wrong class as the test. Correct, just tried to compile this:

public class OverrideIsHell
{
    public interface A
    {
        public void a();
    }

    public class B implements A
    {
        @Override
        public void a()
        {
        }
    }
}

with ANT:


<project name="test" default="dist">
        <!--
        <property name="build.compiler"
value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
        -->

        <target name="dist">
                <delete dir="tmp/classes" />
                <mkdir dir="tmp/classes" />
                <javac destdir="tmp/classes" source="1.5" target="1.5">
                        <src location="src2" />
                </javac>
        </target>
</project>

With javac, this compiles cleanly (1.6). With ecj:

dist:
    [javac] Compiling 1 source file to /home/dweiss/...test/tmp/classes
    [javac] ----------
    [javac] 1. ERROR in /home/dweiss/...test/src2/OverrideIsHell.java
(at line 11)
    [javac]     public void a()
    [javac]                 ^^^
    [javac] The method a() of type OverrideIsHell.B must override a
superclass method
    [javac] ----------
    [javac] 1 problem (1 error)

BUILD FAILED
build.xml:8: Compile failed; see the compiler error output for details.

If you go with javac again, but from the 1.5 JDK:

    [javac] Compiling 1 source file to /home/dweiss/... test/tmp/classes
    [javac] ...test/src2/OverrideIsHell.java:10: method does not
override a method from its superclass
    [javac]         @Override
    [javac]          ^
    [javac] 1 error

BUILD FAILED

D.

Reply via email to