PsiAnnotation (PsiParameter parameter) { if (hasExplicitNullability(parameter)) { return null; } PsiElement parent = parameter.getParent(); if (!(parent instanceof PsiParameterList)) return null; PsiElement scope = parent.getParent(); if (scope instanceof PsiMethod method && method.getName().equals("of")) { PsiClass containingClass = method.getContainingClass(); if (containingClass != null) { String className = containingClass.getQualifiedName(); if (CommonClassNames.JAVA_UTIL_LIST.equals(className) || CommonClassNames.JAVA_UTIL_SET.equals(className) || CommonClassNames.JAVA_UTIL_MAP.equals(className) || "java.util.EnumSet".equals(className)) { return ProjectBytecodeAnalysis.getInstance(myProject).getNotNullAnnotation(); } } } Nullability nullability = JavaSourceInference.inferNullability(parameter); return nullability == Nullability.NOT_NULL ? ProjectBytecodeAnalysis.getInstance(myProject).getNotNullAnnotation() : null; }