1

Just got interesting issue with compiling class file with @Override annotation on method which implements interface method.

I tried to set up moquette project in eclipse and got compile error

Description Resource    Path    Location    Type
The method decodable(IoSession, IoBuffer) of type PubAckDecoder must override a superclass method   PubAckDecoder.java  /moquette-parser/src/main/java/org/dna/mqtt/moquette/proto  line 22 Java Problem

That seems correct as java 1.5 compliance level is used. However this project is successfully built with maven! That is strange for me.

There is following argument file which is used for javac compiler:

"-d"
"E:/workspaces/mqtt/moquette-mqtt/parser/target/classes"
"-classpath"
"E:/workspaces/mqtt/moquette-mqtt/parser/target/classes;e:/_mavenRepository/org/apache/mina/mina-core/2.0.4/mina-core-2.0.4.jar;e:/_mavenRepository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar;e:/_mavenRepository/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar;e:/_mavenRepository/log4j/log4j/1.2.16/log4j-1.2.16.jar;"
"E:/workspaces/mqtt/moquette-mqtt/parser/src/main/java/org/dna/mqtt/moquette/proto/PubAckDecoder.java"
"-g"
"-nowarn"
"-target"
"1.5"
"-source"
"1.5"
"-encoding"
"UTF-8"

I removed all other source files and left just PubAckDecoder which contains the error.

What am I missing? Why it is built with maven when it should not?

UPD

Maven configuration for compiler plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <fork>true</fork>
            <source>1.5</source>
            <target>1.5</target>
     </configuration>
</plugin>
michael nesterenko
  • 14,222
  • 25
  • 114
  • 182

2 Answers2

0

Can you describe more what you meant by "argument file which is used for javac compiler" ?

Have you configured maven-compiler-plugin like this on pom.xml?

<plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
gerrytan
  • 40,313
  • 9
  • 84
  • 99
  • I set `fork` to true, so maven uses `javac` to compile classes. For this it generates argument file which contains all argument passed to `javac`. – michael nesterenko Apr 11 '13 at 22:45
0

Found this post: http://kohsuke.org/2012/01/27/override-and-interface/. It explains why eclipse has errors and maven builds it successfully.

michael nesterenko
  • 14,222
  • 25
  • 114
  • 182