ReflectiveType (@Nullable PsiExpression expression) { expression = PsiUtil.skipParenthesizedExprDown(expression); if (expression == null) { return null; } if (expression instanceof PsiMethodCallExpression methodCall) { final String methodReferenceName = methodCall.getMethodExpression().getReferenceName(); if (NEW_INSTANCE.equals(methodReferenceName)) { final PsiMethod method = methodCall.resolveMethod(); if (method != null) { final PsiExpression[] arguments = methodCall.getArgumentList().getExpressions(); if (arguments.length == 0 && isClassWithName(method.getContainingClass(), CommonClassNames.JAVA_LANG_CLASS)) { final PsiExpression qualifier = methodCall.getMethodExpression().getQualifierExpression(); if (qualifier != null) { return ourGuard.doPreventingRecursion(qualifier, false, () -> getReflectiveType(qualifier)); } } else if (arguments.length > 1 && isClassWithName(method.getContainingClass(), CommonClassNames.JAVA_LANG_REFLECT_ARRAY)) { final PsiExpression typeExpression = arguments[0]; if (typeExpression != null) { final ReflectiveType itemType = ourGuard.doPreventingRecursion(typeExpression, false, () -> getReflectiveType(typeExpression)); return ReflectiveType.arrayOf(itemType); } } } } } return ReflectiveType.create(expression.getType(), false); }