Question

Eclipse (Eclipse 3.8.1 from STS 3.1) finds false error for @Override

public class Class1 implements Comparable<Class1> {
...
@Override
public int compareTo(Class1 o) {

copmareTo() has markers:

Multiple markers at this line
    - The method compareTo(Class1 ) of type Class1 must override a superclass method
    - implements java.lang.Comparable<com.funshion.base.mc.entity.McImp>.compareTo

The first message is wrong.

.project content

<projectDescription>
    <name>ProjectName</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.wst.common.project.facet.core.builder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.springframework.ide.eclipse.core.springbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.springframework.ide.eclipse.core.springnature</nature>
        <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
        <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
    </natures>
</projectDescription>
Was it helpful?

Solution

Project Java version must be 1.6, as @Override annotation arrived with Java 6.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top