Eclipse compilation error: The hierarchy of the type 'Class name' is inconsistent

后端 未结 23 2510
遥遥无期
遥遥无期 2020-12-04 15:53

I have downloaded some open source software written in Java and tried to compile it using Eclipse. I got the error: \"The hierarchy of the type \'Class name\' is inc

相关标签:
23条回答
  • 2020-12-04 16:48

    Error : the hierarchy of the type "class name" is inconsistent error.

    solution : class OtherDepJar {} --> is inside "other.dep.jar" .

    class DepJar extends OtherDepJar {} --> is inside "dep.jar".

    class ProblematicClass extends DepJar {} --> is inside current project .

    If dep.jar is in the project's classpath, but other.dep.jar isn't in the project's classpath, Eclipse will show the" The hierarchy of the type ... is inconsistent error"

    0 讨论(0)
  • 2020-12-04 16:51

    I was having this problem too... I found out that the hierarchy of the class that was throwing this exception, cannot be traced all way back to its root class by eclipse... I Explain:

    In my case, I have 3 java project: A, B and C... where A and B are maven projects and C a regular java eclipse project...

    In the project A, i have the interface "interfaceA" ... In the project B, i have the interface "interfaceB" that extends "interfaceA" In the project C, i have the concrete class "classC" that implements "interfaceB"

    The "project C" was including the "project B" in its build path but not "project A" (so that was the cause of the error).... After including "project A" inside the build path of "C", everything went back to normal...

    0 讨论(0)
  • 2020-12-04 16:53

    You will see this error in case a some class in your library file you have in classpath has reference to non-existing classe(s) which could be in another jar file. Here, I received this error when I did not add org.springframework.beans-3.1.2.RELEASE.jar and had extended a class from org.springframework.jdbc.core.support.JdbcDaoSupport, which was in org.springframework.jdbc-3.1.2.RELEASE.jar of my classpath.

    0 讨论(0)
  • 2020-12-04 16:53

    I had the same exact problem marker and solved it by removing the @Override annotation from a method that was in fact the first implementation (the "super" one being an abstract method) and not an override.

    0 讨论(0)
  • 2020-12-04 16:54

    The problem may be that you have included incorrect jars. I had the same problem and the reason was that I had included incorrect default JRE library in the build path of the project. I had installed Java with another version and was including JRE files of Java with a different version. (I had installed JRE 1.6 in my system and was having JRE library 1.7 included in the build path due to previously installed Java) May be you can check if the JRE library that you have included in the build path is of correct version ie. of Java version that you have installed in your system.

    0 讨论(0)
提交回复
热议问题