void (@NotNull PsiParameter parameter) { super.visitParameter(parameter); if (parameter.getType() instanceof PsiPrimitiveType || hasNullability(parameter)) { return; } final PsiElement grandParent = parameter.getDeclarationScope(); if (grandParent instanceof PsiMethod method) { if (method.getBody() != null) { if (JavaSourceInference.inferNullability(parameter) == Nullability.NOT_NULL) { registerNotNullAnnotation(parameter); return; } for (PsiReferenceExpression expr : VariableAccessUtils.getVariableReferences(parameter, method)) { final PsiElement parent = PsiTreeUtil.skipParentsOfType(expr, PsiParenthesizedExpression.class, PsiTypeCastExpression.class); if (processParameter(parameter, expr, parent)) return; if (isNotNull(method)) { PsiElement toReturn = parent; if (parent instanceof PsiConditionalExpression && ((PsiConditionalExpression)parent).getCondition() != expr) { //todo check conditional operations toReturn = parent.getParent(); } if (toReturn instanceof PsiReturnStatement) { registerNotNullAnnotation(parameter); return; } } } } } else if (grandParent instanceof PsiForeachStatement) { for (PsiReference reference : ReferencesSearch.search(parameter, new LocalSearchScope(grandParent))) { final PsiElement place = reference.getElement(); if (place instanceof PsiReferenceExpression expr) { final PsiElement parent = PsiTreeUtil.skipParentsOfType(expr, PsiParenthesizedExpression.class, PsiTypeCastExpression.class); if (processParameter(parameter, expr, parent)) return; } } } else { if (variableNeverAssignedNull(parameter)) { registerNotNullAnnotation(parameter); } if (variableSometimesAssignedNull(parameter)) { registerNullableAnnotation(parameter); } } }