private ITypeHierarchy getSupertypes(final IType type) throws JavaModelException { ITypeHierarchy hierarchy = cache.get(type); if (hierarchy == null || !hierarchy.exists()) { hierarchy = type.newSupertypeHierarchy(new NullProgressMonitor()); hierarchy.addTypeHierarchyChangedListener(new ITypeHierarchyChangedListener() { @Override public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) { cache.remove(type); } }); cache.put(type, hierarchy); } return hierarchy; }