private static boolean checkRawAcceptable( PsiLambdaExpression expression, PsiType functionalInterfaceType) { PsiElement parent = expression.getParent(); while (parent instanceof PsiParenthesizedExpression) { parent = parent.getParent(); } if (parent instanceof PsiExpressionList) { final PsiElement gParent = parent.getParent(); if (gParent instanceof PsiMethodCallExpression) { final PsiExpression qualifierExpression = ((PsiMethodCallExpression) gParent).getMethodExpression().getQualifierExpression(); final PsiType type = qualifierExpression != null ? qualifierExpression.getType() : null; if (type instanceof PsiClassType && ((PsiClassType) type).isRaw()) { return true; } final PsiMethod method = ((PsiMethodCallExpression) gParent).resolveMethod(); if (method != null) { int lambdaIdx = getLambdaIdx((PsiExpressionList) parent, expression); final PsiParameter[] parameters = method.getParameterList().getParameters(); final PsiType normalizedType = getNormalizedType(parameters[adjustLambdaIdx(lambdaIdx, method, parameters)]); if (normalizedType instanceof PsiClassType && ((PsiClassType) normalizedType).isRaw()) return true; } } if (functionalInterfaceType instanceof PsiClassType && ((PsiClassType) functionalInterfaceType).isRaw()) { return false; } } return true; }