Community
Participate
Working Groups
20030115 The type hierarchy offers the method getFlags(IType) where it can be tested if a type is an interface or class. (Flags.isInterface). This API was added to allow us to get information about the type without creating an element info. While debugging I saw that the implementation code in TypeHierarchy uses type.isInterface (throwing a JavaModelException): public IType getSuperclass(IType type) { try { if (type.isInterface()) { return null; } return (IType) this.classToSuperclass.get(type); } catch (JavaModelException npe) { return null; } } Is this intended? Wouldn't it be possible to use the cached information to avoid the creation of the type info?
Indeed. Good find.
Changed all references in TypeHiearchy to use getCacheFlags(...) (when a type is cached) instead of isInterface()/isClass().
Verified.