NullabilityAnnotationInfo (@NotNull PsiAnnotation anno, @NotNull PsiElement context, PsiAnnotation.TargetType @NotNull [] types, boolean superPackage) { if (context instanceof PsiTypeParameter) { // DefaultQualifier is not applicable to type parameter declarations return null; } if (anno.hasQualifiedName(DEFAULT_QUALIFIER)) { PsiAnnotationMemberValue value = anno.findAttributeValue(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME); if (value instanceof PsiClassObjectAccessExpression && hasAppropriateTarget(types, anno.findAttributeValue("locations"))) { PsiType type = PsiUtil.getTypeByPsiElement(context); if (type instanceof PsiClassType && ((PsiClassType)type).resolve() instanceof PsiTypeParameter) { // DefaultQualifier is not applicable to type parameter uses return null; } PsiClass valueClass = PsiUtil.resolveClassInClassTypeOnly(((PsiClassObjectAccessExpression)value).getOperand().getType()); if (valueClass != null) { NullableNotNullManager instance = NullableNotNullManager.getInstance(value.getProject()); if (instance.getNullables().contains(valueClass.getQualifiedName())) { return new NullabilityAnnotationInfo(anno, Nullability.NULLABLE, true); } if (instance.getNotNulls().contains(valueClass.getQualifiedName())) { return new NullabilityAnnotationInfo(anno, Nullability.NOT_NULL, true); } } } return null; } if (anno.hasQualifiedName(DEFAULT_QUALIFIERS)) { PsiAnnotationMemberValue value = anno.findAttributeValue(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME); for (PsiAnnotationMemberValue initializer : AnnotationUtil.arrayAttributeValues(value)) { if (initializer instanceof PsiAnnotation) { NullabilityAnnotationInfo result = getNullabilityByContainerAnnotation((PsiAnnotation)initializer, context, types, superPackage); if (result != null) { return result; } } } } return null; }