private void collectUnresolvedInterface(TypeMirror typeMirror, TypevarContext context) { if (typeMirror.getKind() == TypeKind.ERROR) { DeclaredType declaredType = toDeclaredType(typeMirror); String stringified = stringify(declaredType, context); implementedInterfaceNames.add(stringified); } }
private void collectInterfacesMirrors(TypeMirror typeMirror, TypevarContext context) { if (typeMirror.getKind() != TypeKind.DECLARED) { return; } DeclaredType declaredType = toDeclaredType(typeMirror); TypeElement e = toTypeElement(declaredType); if (e.getKind().isInterface()) { implementedInterfaces.add(e); String stringified = stringify(declaredType, context); TypevarContext nestedContext = new TypevarContext(e, stringified); implementedInterfaceNames.add(stringified); for (TypeMirror m : e.getInterfaces()) { collectInterfacesMirrors(m, nestedContext); } } }
private void collectHierarchyMirrors(TypeMirror typeMirror, String stringRepresentation) { if (typeMirror.getKind() != TypeKind.DECLARED || typeMirror.toString().equals(Object.class.getName())) { return; } DeclaredType declaredType = toDeclaredType(typeMirror); TypeElement e = toTypeElement(declaredType); TypevarContext context = new TypevarContext(e, stringRepresentation); collectInterfacesMirrors(declaredType, context); TypeMirror superclassMirror = e.getSuperclass(); if (superclassMirror.getKind() != TypeKind.NONE) { DeclaredType superclass = toDeclaredType(superclassMirror); String stringified = stringify(superclass, context); if (!stringified.equals(Object.class.getName())) { extendedClasses.add(toTypeElement(superclass)); extendedClassNames.add(stringified); collectHierarchyMirrors(superclass, stringified); } } for (TypeMirror m : e.getInterfaces()) { collectUnresolvedInterface(m, context); collectInterfacesMirrors(m, context); } }