Eclipse类型的层次结构...与@Configurable注释不一致

c4k*_*c4k 35 eclipse spring hierarchy configurable vaadin

我正在开发一个Spring/Vaadin/Hibernate应用程序.

一切正常但我仍然在Eclipse STS 2.8.1中有以下错误标记:

The hierarchy of the type BankView is inconsistent
The hierarchy of the type AbstractEntityView is inconsistent
Run Code Online (Sandbox Code Playgroud)

我的观点有以下结构:

public class BankView extends AbstractEntityView {  
    @Resource private BankService bankService;

    public void buildLayout() {
        super.buildLayout();

        // Use of the service here
    }
}

public abstract class AbstractEntityView extends AbstractView {  
    public void buildLayout() {
         verticalLayout = new VerticalLayout();
         verticalLayout.setSpacing(true);
         verticalLayout.setSizeFull();
         setContent(verticalLayout);
         super.buildLayout();
    }
}

@Configurable(preConstruction = true)
public abstract class AbstractView extends com.vaadin.ui.VerticalLayout {  
    public AbstractView() {
        super();
        try {
                buildLayout();
        }
        catch (AccessDeniedException e) { // Spring Security
                System.out.println("GTFO !");
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

是什么导致这些错误标记?

Ale*_*lex 50

在我的例子中,我发现The hierarchy of the type ... is inconsistentEclipse中的错误是由一个jar文件类引起的,我正在扩展我的类,引用一个不在构建路径中的类.

所以如果你有:

// in other.dep.jar
class FromOtherDepJar {}

// in dep.jar
class FromDepJar extends FromOtherDepJar {}

// in the current project
class ProblematicClass extends FromDepJar {}
Run Code Online (Sandbox Code Playgroud)

如果dep.jar在项目的类路径中,但other.dep.jar不是,Eclipse将显示The hierarchy of the type ... is inconsistent错误.

看看Eclipse中的Problems View,Description列比实际问题更详细,而不是悬停.


c4k*_*c4k 1

事实上,问题是因为我将 AbstractListView 设置为 @Configurable。当我将此注释放在最终类(例如 BankView)上时,所有错误都消失了。

感谢大家的帮助。如果有人有同样的错误,他们会在不同的答案中找到解决方案。