Search in sources :

Example 1 with SimpleTypeVisitor8

use of javax.lang.model.util.SimpleTypeVisitor8 in project revapi by revapi.

the class Util method fillAllSuperInterfaces.

public static void fillAllSuperInterfaces(@Nonnull Types types, @Nonnull TypeMirror type, @Nonnull List<TypeMirror> result) {
    try {
        List<? extends TypeMirror> superTypes = types.directSupertypes(type);
        SimpleTypeVisitor8<Boolean, Void> checker = new SimpleTypeVisitor8<Boolean, Void>(false) {

            @Override
            public Boolean visitDeclared(DeclaredType t, Void aVoid) {
                return t.asElement().getKind() == ElementKind.INTERFACE;
            }
        };
        for (TypeMirror t : superTypes) {
            if (t.accept(checker, null)) {
                result.add(t);
            }
            fillAllSuperInterfaces(types, t, result);
        }
    } catch (RuntimeException e) {
        LOG.debug("Failed to find all super interfaces of type '" + toHumanReadableString(type) + ". Possibly " + "missing classes?", e);
    }
}
Also used : SimpleTypeVisitor8(javax.lang.model.util.SimpleTypeVisitor8) TypeMirror(javax.lang.model.type.TypeMirror) DeclaredType(javax.lang.model.type.DeclaredType)

Aggregations

DeclaredType (javax.lang.model.type.DeclaredType)1 TypeMirror (javax.lang.model.type.TypeMirror)1 SimpleTypeVisitor8 (javax.lang.model.util.SimpleTypeVisitor8)1