void (@NotNull PsiMethodCallExpression invokeCall, @Nullable ReflectiveType requiredType, boolean isExact, @NotNull ProblemsHolder holder) { if (requiredType == null) return; final PsiElement invokeParent = invokeCall.getParent(); PsiType actualType = null; PsiElement problemElement = null; if (invokeParent instanceof PsiTypeCastExpression) { final PsiTypeElement castTypeElement = ((PsiTypeCastExpression)invokeParent).getCastType(); if (castTypeElement != null) { actualType = castTypeElement.getType(); problemElement = castTypeElement; } } else if (invokeParent instanceof PsiAssignmentExpression) { actualType = ((PsiAssignmentExpression)invokeParent).getLExpression().getType(); } else if (invokeParent instanceof PsiVariable) { actualType = ((PsiVariable)invokeParent).getType(); } if (actualType != null && !isCompatible(requiredType, actualType, isExact)) { if (problemElement == null) { problemElement = invokeCall.getMethodExpression(); } holder.registerProblem(problemElement, JavaBundle.message(isExact || requiredType.isPrimitive() ? "inspection.reflect.handle.invocation.result.not.exact" : "inspection.reflect.handle.invocation.result.not.assignable", requiredType.getQualifiedName())); } }