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

97,745

Solution 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.

Solution 2

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.

Solution 3

Reconfigure Build Path to solve the problem.

Solution 4

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.

Solution 5

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.

Share:
97,745
c4k
Author by

c4k

Lead Developer at @holbertonschool, formerly @Veepee_Fr, @car360inc + 🏃🏽‍♂️ + 🚴🏼‍♂️

Updated on September 12, 2020

Comments

  • c4k
    c4k over 3 years

    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?

  • Sinisha Mihajlovski
    Sinisha Mihajlovski over 11 years
    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!
  • Alex
    Alex over 10 years
    @GáborLipták link removed, IIRC it stated same cause for the problem
  • VinyJones
    VinyJones over 5 years
    Did you keep the @Configurable on the AbstractListView class ?