public static boolean isType(TypeMirror type) {
        return type.accept(new SimpleTypeVisitor6<Boolean, Void>() {
            @Override
            protected Boolean defaultAction(TypeMirror type, Void ignored) {
                return false;
            }

            @Override
            public Boolean visitNoType(NoType noType, Void p) {
                return noType.getKind().equals(TypeKind.VOID);
            }

            @Override
            public Boolean visitPrimitive(PrimitiveType type, Void p) {
                return true;
            }

            @Override
            public Boolean visitArray(ArrayType array, Void p) {
                return true;
            }

            @Override
            public Boolean visitDeclared(DeclaredType type, Void ignored) {
                return MoreElements.isType(type.asElement());
            }
        }, null);
    }
Utilities related to {@link TypeMirror} instances.

@author Gregory Kick
@since 2.0
android/annotation_processors/permission-requester-compiler/src/main/java/github/tornaco/permission/compiler/common/MoreTypes.java