spring Eclipse 类型的层次结构...与@Configurable注解不一致
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9633118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse The hierarchy of the type ... is inconsistent with @Configurable annotation
提问by c4k
I am developing a Spring/Vaadin/Hibernate application.
我正在开发一个 Spring/Vaadin/Hibernate 应用程序。
Everything works but I still have the following error markers in Eclipse STS 2.8.1:
一切正常,但我在 Eclipse STS 2.8.1 中仍然有以下错误标记:
The hierarchy of the type BankView is inconsistent
The hierarchy of the type AbstractEntityView is inconsistent
I have the following structure for my views:
我的观点有以下结构:
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 !");
}
}
}
What is causing these error markers?
是什么导致了这些错误标记?
采纳答案by c4k
In fact the problem was because I made AbstractListView @Configurable. When I put this annotation on the final class (for example BankView), all the errors disappeared.
事实上,问题是因为我做了 AbstractListView @Configurable。当我将此注释放在最后一个类(例如 BankView)上时,所有错误都消失了。
Thanks everyone for the help. If someone has the same error they will find a solution in the different answers.
感谢大家的帮助。如果有人有相同的错误,他们会在不同的答案中找到解决方案。
回答by Alex
In my case, I found the The hierarchy of the type ... is inconsistenterror in Eclipse being caused by a jar file class from which I was extending my class referencing a class that was not in the build path.
就我而言,我发现The hierarchy of the type ... is inconsistentEclipse 中的错误是由一个 jar 文件类引起的,我从中扩展了我的类,引用了一个不在构建路径中的类。
So if you have:
所以如果你有:
// in other.dep.jar
class FromOtherDepJar {}
// in dep.jar
class FromDepJar extends FromOtherDepJar {}
// in the current project
class ProblematicClass extends FromDepJar {}
If dep.jaris in the project's classpath, but other.dep.jarisn't, Eclipse will show the The hierarchy of the type ... is inconsistenterror.
如果dep.jar在项目的类路径中,但other.dep.jar不在,Eclipse 将显示The hierarchy of the type ... is inconsistent错误。
Take a look at the Problems View in Eclipse, the Description column is more verbose about what the actual problem is than the hover-over.
看一看 Eclipse 中的问题视图,描述列比悬停鼠标更详细地说明了实际问题是什么。
回答by jp093121
My problem was that classes/jars were recompiled manually outside of Eclipse using ant and gradle tasks. Refreshing all projects and rebuilding in eclipse made the errors disappear.
我的问题是在 Eclipse 之外使用 ant 和 gradle 任务手动重新编译了类/jar。刷新所有项目并在 eclipse 中重建使错误消失。
回答by Kanwaljit Singh
Reconfigure Build Path to solve the problem.
重新配置构建路径以解决问题。
回答by rotterick
Did you tried to close and open eclipse? Sometimes it helps. My eclipse (probably because I am in a Windows platform) often shows errors like that, the only solution is to exit eclipse and reopen later.
您是否尝试关闭和打开日食?有时它有帮助。我的eclipse(可能是因为我在windows平台上)经常会出现这样的错误,唯一的解决办法就是退出eclipse然后再重新打开。
回答by Andy Thomas
Another cause is a reference to a superclass or superinterface that exists, but is in a different package, and is neither imported nor fully qualified.
另一个原因是对存在的超类或超接口的引用,但位于不同的包中,既不是导入的也不是完全限定的。
This occurred to me after using Eclipse refactoring to move abstract classes that inherited from a nested interface. After the move, all the subclasses had the "hierarchy of the type X is inconsistent" message. The problem was solved by importing by hand in the abstract classes that had been moved.
在使用 Eclipse 重构移动从嵌套接口继承的抽象类后,我想到了这一点。移动后,所有子类都有“X 类型的层次结构不一致”消息。通过在已移动的抽象类中手动导入解决了该问题。
回答by stikku
I know this probably is not the case here, but just for the additional information this error may be caused when using a hierarchy of interfaces and there is some error (such as wrong generics) somewhere higher in your hierarchy
我知道这可能不是这里的情况,但仅就附加信息而言,此错误可能是在使用接口层次结构时引起的,并且在层次结构中的某个位置存在一些错误(例如错误的泛型)
回答by George Thomas
This error also shows up when android-support library mismatch occurs i.e when two external libraries that you use have two versions of support library this error shows, (what i did was i made them both same versions by deleting one and copying the support from other third party library to this one)
当发生 android-support 库不匹配时也会出现此错误,即当您使用的两个外部库有两个版本的支持库时,此错误显示,(我所做的是通过删除一个并从另一个复制支持来使它们成为相同的版本第三方库到这个)
回答by vanomart
I had this problem when I added actionbarsherlock to my android project and forgot to remove support-library from my original project. Solution is to remove android-support-v4.jar from your project and clean the project.. it should load the library from actionbarsherlock folder.
当我将 actionbarsherlock 添加到我的 android 项目并且忘记从我的原始项目中删除 support-library 时,我遇到了这个问题。解决方案是从您的项目中删除 android-support-v4.jar 并清理项目..它应该从 actionbarsherlock 文件夹加载库。
回答by Sridhar Sarnobat
In my case I was using the wrong JRE version.
就我而言,我使用了错误的 JRE 版本。

