Nullability (@NotNull PsiParameter parameter) { PsiElement parent = parameter.getParent(); if (parent instanceof PsiParameterList) { PsiElement gParent = parent.getParent(); if (gParent instanceof PsiLambdaExpression) { return getFunctionalParameterNullability((PsiLambdaExpression)gParent, ((PsiParameterList)parent).getParameterIndex(parameter)); } else if (gParent instanceof PsiMethod && OptionalUtil.OPTIONAL_OF_NULLABLE.methodMatches((PsiMethod)gParent)) { return Nullability.NULLABLE; } } if (parent instanceof PsiForeachStatement) { return getTypeNullability(inferLoopParameterTypeWithNullability((PsiForeachStatement)parent)); } return Nullability.UNKNOWN; }