Eclipse The hierarchy of the type ... is inconsistent with @Configurable annotation
Asked Answered
K

14

36

I am developing a Spring/Vaadin/Hibernate application.

Everything works but I still have the following error markers in 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?

Koenig answered 9/3, 2012 at 11:14 Comment(3)
That error message is generally because of a bad classpath. Try rebuilding the whole project, that usually gives a more useful error,Dermott
First, thanks for the answer ;) I've already tried to build it, nothing has changed. I tried Project > Clean... it didn't work. In my classpath, I tried to change the order of libraries, nothing changed :/Koenig
possible duplicate of Eclipse compilation error: The hierarchy of the type 'Class name' is inconsistentSupplementary
K
1

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.

Thanks everyone for the help. If someone has the same error they will find a solution in the different answers.

Koenig answered 9/11, 2013 at 0:11 Comment(1)
Did you keep the @Configurable on the AbstractListView class ?Mcdaniel
S
50

In my case, I found the The hierarchy of the type ... is inconsistent error 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.

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.jar is in the project's classpath, but other.dep.jar isn't, Eclipse will show the The hierarchy of the type ... is inconsistent error.

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.

Sodom answered 20/8, 2012 at 17:39 Comment(2)
I was getting "The hierarchy of the type GreetTheWorldFixture is inconsistent" while tryint the fitnesse tutorial, turns out I was missing the fitnesse.jar in my projects classpath, thanks for the answer!Dialect
@GáborLipták link removed, IIRC it stated same cause for the problemSodom
L
1

Reconfigure Build Path to solve the problem.

Lozengy answered 14/8, 2013 at 13:6 Comment(0)
B
1

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.

Bolte answered 8/11, 2013 at 17:36 Comment(0)
K
1

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.

Thanks everyone for the help. If someone has the same error they will find a solution in the different answers.

Koenig answered 9/11, 2013 at 0:11 Comment(1)
Did you keep the @Configurable on the AbstractListView class ?Mcdaniel
A
1

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.

Abampere answered 24/1, 2014 at 19:39 Comment(0)
H
1

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.

Han answered 13/8, 2015 at 14:35 Comment(0)
O
0

Their is a possibility your maven dependencys are not recognized. See if you have Maven enabled for this particular project. In Eclipse Maven can be actived by right clicking on the project and chosing Maven -> Enable Maven dependencys.

Otter answered 10/7, 2013 at 12:51 Comment(0)
K
0

In my case I was using the wrong JRE version.

Kirk answered 22/10, 2013 at 18:50 Comment(0)
U
0

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.

Urita answered 15/11, 2013 at 17:6 Comment(0)
M
0

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

Mcmillan answered 14/1, 2015 at 16:43 Comment(0)
C
0

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)

Complicacy answered 27/4, 2015 at 6:11 Comment(0)
H
0

I solved this error The hierarchy of the type ServiceController is inconsistent problem by removing all Referenced Libraries of jars in Build Path and re add all jars in eclipse IDE.

Habakkuk answered 16/3, 2016 at 10:54 Comment(0)
C
0

I solved this problem by add javax.servlet-api-3.0.1.jar. my development tool is Eclipse ,but my project was developed under the myeclipse ,then when i import the project into eclipse ,it throws "the hierarchy of the type SysUserFilter is inconsistent",so i think myeclipse automatically provides javax.servlet-api-3.0.1.jar,but eclipse not.so it need to manually import .

Compliant answered 18/5, 2016 at 2:42 Comment(0)
E
0

Go and actually check your build path (Project properties => Java Build Path => Libraries) and the dialog might show you that something is missing. This was my problem, where the project was working but then after a month or two it stopped working because my JRE setup changed.

Eel answered 11/9, 2017 at 16:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.