ProblemDescriptor[] (@NotNull PsiElement place, @NotNull final InspectionManager inspectionManager, boolean isOnTheFly) { final List<ProblemDescriptor> problems = new ArrayList<>(); place.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); final PsiType[] typeArguments = expression.getTypeArguments(); if (typeArguments.length > 0) { checkCallExpression(expression.getMethodExpression(), typeArguments, expression, inspectionManager, problems, isOnTheFly); } } @Override public void visitNewExpression(@NotNull PsiNewExpression expression) { super.visitNewExpression(expression); final PsiType[] typeArguments = expression.getTypeArguments(); if (typeArguments.length > 0) { final PsiJavaCodeReferenceElement classReference = expression.getClassReference(); if (classReference != null) { checkCallExpression(classReference, typeArguments, expression, inspectionManager, problems, isOnTheFly); } } } @Override public void visitMethodReferenceExpression(@NotNull PsiMethodReferenceExpression expression) { super.visitMethodReferenceExpression(expression); checkMethodReference(expression, inspectionManager, problems, isOnTheFly); } }); if (problems.isEmpty()) return null; return problems.toArray(ProblemDescriptor.EMPTY_ARRAY); }