mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-22456 followup
This commit is contained in:
@@ -19,7 +19,6 @@ import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInsight.intention.AddAnnotationPsiFix;
|
||||
import com.intellij.openapi.command.undo.UndoUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
@@ -37,7 +36,6 @@ import java.util.List;
|
||||
* @author cdr
|
||||
*/
|
||||
public class AnnotateMethodFix implements LocalQuickFix {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.AnnotateMethodFix");
|
||||
protected final String myAnnotation;
|
||||
private final String[] myAnnotationsToRemove;
|
||||
|
||||
@@ -68,7 +66,7 @@ public class AnnotateMethodFix implements LocalQuickFix {
|
||||
List<MethodSignatureBackedByPsiMethod> superMethodSignatures = method.findSuperMethodSignaturesIncludingStatic(true);
|
||||
for (MethodSignatureBackedByPsiMethod superMethodSignature : superMethodSignatures) {
|
||||
PsiMethod superMethod = superMethodSignature.getMethod();
|
||||
if (!AnnotationUtil.isAnnotated(superMethod, myAnnotation, false, false, true, null) &&
|
||||
if (!AnnotationUtil.isAnnotated(superMethod, myAnnotation, false, false, true) &&
|
||||
superMethod.getManager().isInProject(superMethod)) {
|
||||
int ret = shouldAnnotateBaseMethod(method, superMethod, project);
|
||||
if (ret != 0 && ret != 1) return;
|
||||
@@ -81,7 +79,7 @@ public class AnnotateMethodFix implements LocalQuickFix {
|
||||
PsiMethod[] methods = OverridingMethodsSearch.search(method).toArray(PsiMethod.EMPTY_ARRAY);
|
||||
for (PsiMethod psiMethod : methods) {
|
||||
if (AnnotationUtil.isAnnotatingApplicable(psiMethod, myAnnotation) &&
|
||||
!AnnotationUtil.isAnnotated(psiMethod, myAnnotation, false, false, true, null) &&
|
||||
!AnnotationUtil.isAnnotated(psiMethod, myAnnotation, false, false, true) &&
|
||||
psiMethod.getManager().isInProject(psiMethod)) {
|
||||
toAnnotate.add(psiMethod);
|
||||
}
|
||||
|
||||
@@ -257,25 +257,25 @@ public class AnnotationUtil {
|
||||
}
|
||||
|
||||
public static boolean isAnnotated(@NotNull PsiModifierListOwner listOwner, @NotNull String annotationFQN, boolean checkHierarchy) {
|
||||
return isAnnotated(listOwner, annotationFQN, checkHierarchy, true, null);
|
||||
return isAnnotated(listOwner, annotationFQN, checkHierarchy, true, true, null);
|
||||
}
|
||||
|
||||
public static boolean isAnnotated(@NotNull PsiModifierListOwner listOwner,
|
||||
@NotNull String annotationFQN,
|
||||
boolean checkHierarchy,
|
||||
boolean skipExternal) {
|
||||
return isAnnotated(listOwner, annotationFQN, checkHierarchy, skipExternal, null);
|
||||
}
|
||||
|
||||
private static boolean isAnnotated(@NotNull PsiModifierListOwner listOwner,
|
||||
@NotNull String annotationFQN,
|
||||
boolean checkHierarchy,
|
||||
boolean skipExternal,
|
||||
@Nullable Set<PsiMember> processed) {
|
||||
return isAnnotated(listOwner, annotationFQN, checkHierarchy, skipExternal, skipExternal, processed);
|
||||
return isAnnotated(listOwner, annotationFQN, checkHierarchy, skipExternal, skipExternal);
|
||||
}
|
||||
|
||||
public static boolean isAnnotated(@NotNull PsiModifierListOwner listOwner,
|
||||
@NotNull String annotationFQN,
|
||||
boolean checkHierarchy,
|
||||
boolean skipExternal,
|
||||
boolean skipInferred) {
|
||||
return isAnnotated(listOwner, annotationFQN, checkHierarchy, skipExternal, skipInferred, null);
|
||||
}
|
||||
|
||||
private static boolean isAnnotated(@NotNull PsiModifierListOwner listOwner,
|
||||
@NotNull String annotationFQN,
|
||||
boolean checkHierarchy,
|
||||
boolean skipExternal,
|
||||
@@ -318,7 +318,7 @@ public class AnnotationUtil {
|
||||
if (!processed.add(method)) return false;
|
||||
final PsiMethod[] superMethods = method.findSuperMethods();
|
||||
for (PsiMethod superMethod : superMethods) {
|
||||
if (isAnnotated(superMethod, annotationFQN, true, skipExternal, processed)) return true;
|
||||
if (isAnnotated(superMethod, annotationFQN, true, skipExternal, skipInferred, processed)) return true;
|
||||
}
|
||||
}
|
||||
else if (listOwner instanceof PsiClass) {
|
||||
@@ -327,7 +327,7 @@ public class AnnotationUtil {
|
||||
if (!processed.add(clazz)) return false;
|
||||
final PsiClass[] superClasses = clazz.getSupers();
|
||||
for (PsiClass superClass : superClasses) {
|
||||
if (isAnnotated(superClass, annotationFQN, true, skipExternal, processed)) return true;
|
||||
if (isAnnotated(superClass, annotationFQN, true, skipExternal, skipInferred, processed)) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user