JUtils { public static boolean isParametrizedMethod(Symbol.MethodSymbol method) { if (method.isUnknown()) { return false; } return ((JMethodSymbol) method).methodBinding().isParameterizedMethod() || ((JMethodSymbol) method).methodBinding().isGenericMethod(); } 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 isParametrizedMethod() { JavaTree.CompilationUnitTreeImpl cu = test("class C { <T> void m(T p) { m(42); } }"); ClassTreeImpl c = (ClassTreeImpl) cu.types().get(0); MethodTreeImpl method = (MethodTreeImpl) c.members().get(0); ExpressionStatementTreeImpl s = (ExpressionStatementTreeImpl) Objects.requireNonNull(method.block()).body().get(0); MethodInvocationTreeImpl methodInvocation = (MethodInvocationTreeImpl) s.expression(); assertThat(JUtils.isParametrizedMethod(cu.sema.methodSymbol(method.methodBinding))) .isEqualTo(JUtils.isParametrizedMethod(method.symbol())) .isEqualTo(method.methodBinding.isGenericMethod()) .isTrue(); assertThat(JUtils.isParametrizedMethod(cu.sema.methodSymbol(methodInvocation.methodBinding))) .isEqualTo(JUtils.isParametrizedMethod((Symbol.MethodSymbol) methodInvocation.symbol())) .isEqualTo(methodInvocation.methodBinding.isParameterizedMethod()) .isTrue(); }