JTypeSymbol extends JSymbol implements Symbol.TypeSymbol { @CheckForNull @Override public Type superClass() { if (superclass == Symbols.unknownType) { superclass = convertSuperClass(); } return superclass; } JTypeSymbol(JSema sema, ITypeBinding typeBinding); @CheckForNull @Override Type superClass(); @Override List<Type> interfaces(); @Override Collection<Symbol> memberSymbols(); @Override Collection<Symbol> lookupSymbols(String name); @Nullable @Override ClassTree declaration();  }
@Test void superClass() { JavaTree.CompilationUnitTreeImpl cu = test("interface I { } class C implements I { } class C2 extends C { }"); ITypeBinding javaLangObject = Objects.requireNonNull(cu.sema.resolveType("java.lang.Object")); ITypeBinding i = Objects.requireNonNull(((ClassTreeImpl) cu.types().get(0)).typeBinding); ITypeBinding c = Objects.requireNonNull(((ClassTreeImpl) cu.types().get(1)).typeBinding); ITypeBinding c2 = Objects.requireNonNull(((ClassTreeImpl) cu.types().get(2)).typeBinding); assertAll( () -> assertThat(cu.sema.typeSymbol(javaLangObject).superClass()) .isNull(), () -> assertThat(cu.sema.typeSymbol(i).superClass()) .isSameAs(cu.sema.type(javaLangObject)), () -> assertThat(cu.sema.typeSymbol(c).superClass()) .isSameAs(cu.sema.type(javaLangObject)), () -> assertThat(cu.sema.typeSymbol(c2).superClass()) .isSameAs(cu.sema.type(c)), () -> assertThat(cu.sema.typeSymbol(javaLangObject.createArrayType(1)).superClass()) .isSameAs(cu.sema.type(javaLangObject)) ); }