JUtils { public static boolean isRawType(Type type) { if (type.isUnknown()) { return false; } JType t = (JType) type; return t.typeBinding.isRawType(); } private  JUtils(); static boolean isPrimitiveWrapper(Type type); @Nullable static Type primitiveWrapperType(Type type); @Nullable static Type primitiveType(Type type); static boolean isNullType(Type type); static boolean isIntersectionType(Type type); static boolean isTypeVar(Type type); static boolean isAnnotation(Symbol.TypeSymbol typeSymbol); static boolean isEffectivelyFinal(Symbol.VariableSymbol variableSymbol); static boolean isParameter(Symbol symbol); static Optional<Object> constantValue(Symbol.VariableSymbol symbol); static Set<Type> superTypes(Symbol.TypeSymbol typeSymbol); static Symbol.TypeSymbol outermostClass(Symbol.TypeSymbol typeSymbol); static Symbol getPackage(Symbol symbol); static boolean isVarArgsMethod(Symbol.MethodSymbol method); static boolean isSynchronizedMethod(Symbol.MethodSymbol method); static boolean isNativeMethod(Symbol.MethodSymbol method); static boolean isDefaultMethod(Symbol.MethodSymbol method); @Nullable static Object defaultValue(Symbol.MethodSymbol method); static boolean isOverridable(Symbol.MethodSymbol method); static boolean isParametrizedMethod(Symbol.MethodSymbol method); static boolean isRawType(Type type); static Type declaringType(Type type); static Set<Type> directSuperTypes(Type type); @Nullable static Symbol enclosingClass(Tree t); @Nullable static Symbol importTreeSymbol(ImportTree tree); static Symbol typeParameterTreeSymbol(TypeParameterTree tree); static SymbolMetadata parameterAnnotations(Symbol.MethodSymbol method, int param);  }
@Test void isRawType() { JavaTree.CompilationUnitTreeImpl cu = test("class C {} class D<T> { void foo(D d, Unknown u) {} }"); ClassTreeImpl c = (ClassTreeImpl) cu.types().get(0); ClassTreeImpl dGeneric = (ClassTreeImpl) cu.types().get(1); MethodTreeImpl m = (MethodTreeImpl) dGeneric.members().get(0); VariableTreeImpl dRaw = (VariableTreeImpl) m.parameters().get(0); VariableTreeImpl unknown = (VariableTreeImpl) m.parameters().get(1); assertThat(JUtils.isRawType(c.symbol().type())) .isSameAs(JUtils.isRawType(dGeneric.symbol().type())) .isSameAs(JUtils.isRawType(unknown.symbol().type())) .isFalse(); assertThat(JUtils.isRawType(dRaw.type() .symbolType())) .isTrue(); }