void (PsiJavaCodeReferenceElement reference) { PsiElement element = reference.resolve(); if (element instanceof PsiClass) { PsiTypeParameter[] typeParameters = ((PsiClass)element).getTypeParameters(); PsiTypeElement[] typeArguments = getReferenceTypeArguments(reference); if (typeParameters.length > 0 && typeParameters.length == typeArguments.length && !(typeArguments[0].getType() instanceof PsiDiamondType)) { for (int i = 0; i < typeParameters.length; i++) { PsiTypeElement typeArgument = typeArguments[i]; Project project = element.getProject(); PsiType type = typeArgument.getType(); if (DfaPsiUtil.getTypeNullability(JavaPsiFacade.getElementFactory(project).createType(typeParameters[i])) == Nullability.NOT_NULL) { Nullability typeNullability = DfaPsiUtil.getTypeNullability(type); if (typeNullability != Nullability.NOT_NULL && !(typeNullability == Nullability.UNKNOWN && type instanceof PsiWildcardType && !((PsiWildcardType)type).isExtends())) { String annotationToAdd = manager.getDefaultNotNull(); PsiClass annotationClass = JavaPsiFacade.getInstance(project).findClass(annotationToAdd, element.getResolveScope()); AddTypeAnnotationFix fix = null; if (annotationClass != null && AnnotationTargetUtil.findAnnotationTarget(annotationClass, PsiAnnotation.TargetType.TYPE_USE) != null) { fix = new AddTypeAnnotationFix(annotationToAdd, manager.getNullables()); } reportProblem(holder, typeArgument, fix, "non.null.type.argument.is.expected"); } } } } } }