1

Eclipse(来自STS 3.1的Eclipse 3.8.1)发现 @Override 的错误错误

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

copmareTo() 有标记:

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

第一条消息是错误的。

.项目内容

<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>
4

1 回答 1

1

项目 Java 版本必须是 1.6,因为 @Override 注释随 Java 6 一起提供。

于 2013-01-15T07:26:42.123 回答