PsiAnnotation (@NotNull PsiModifierListOwner listOwner, @NotNull String annotationFQN) { if (!JB_INFERRED_ANNOTATIONS.contains(annotationFQN) && !isDefaultNullabilityAnnotation(annotationFQN)) { return null; } listOwner = PsiUtil.preferCompiledElement(listOwner); if (ORG_JETBRAINS_ANNOTATIONS_CONTRACT.equals(annotationFQN) && listOwner instanceof PsiMethod) { PsiAnnotation anno = getHardcodedContractAnnotation((PsiMethod)listOwner); if (anno != null) { return anno; } } if (ignoreInference(listOwner, annotationFQN)) { return null; } if (canInferFromByteCode(listOwner)) { PsiAnnotation fromBytecode = ProjectBytecodeAnalysis.getInstance(myProject).findInferredAnnotation(listOwner, annotationFQN); if (fromBytecode != null) { return fromBytecode; } } if (isDefaultNullabilityAnnotation(annotationFQN)) { PsiAnnotation anno = null; if (listOwner instanceof PsiMethodImpl) { anno = getInferredNullabilityAnnotation((PsiMethodImpl)listOwner); } if (listOwner instanceof PsiParameter) { anno = getInferredNullabilityAnnotation((PsiParameter)listOwner); } return anno == null ? null : anno.hasQualifiedName(annotationFQN) ? anno : null; } if (Mutability.UNMODIFIABLE_ANNOTATION.equals(annotationFQN) || Mutability.UNMODIFIABLE_VIEW_ANNOTATION.equals(annotationFQN)) { return getInferredMutabilityAnnotation(listOwner); } if (listOwner instanceof PsiMethodImpl && ORG_JETBRAINS_ANNOTATIONS_CONTRACT.equals(annotationFQN)) { return getInferredContractAnnotation((PsiMethodImpl)listOwner); } return null; }