Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 417
c4k Avatar asked Mar 09 '12 11:03

c4k


4 Answers

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.

like image 186
Alex Avatar answered Nov 18 '22 22:11

Alex


Reconfigure Build Path to solve the problem.

like image 26
Kanwaljit Singh Avatar answered Nov 19 '22 00:11

Kanwaljit Singh


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.

like image 1
rotterick Avatar answered Nov 18 '22 23:11

rotterick


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.

like image 1
Andy Thomas Avatar answered Nov 18 '22 22:11

Andy Thomas