mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-120290 Deprecated methods in import popup.
This commit is contained in:
+15
-1
@@ -200,7 +200,7 @@ public class StaticImportMethodFix implements IntentionAction {
|
||||
//do not show methods from default package
|
||||
&& !((PsiJavaFile)file).getPackageName().isEmpty()
|
||||
&& PsiUtil.isAccessible(file.getProject(), method, element, containingClass)) {
|
||||
if (method.isDeprecated()) {
|
||||
if (isEffectivelyDeprecated(method)) {
|
||||
deprecated.put(containingClass, method);
|
||||
return processCondition();
|
||||
}
|
||||
@@ -209,6 +209,20 @@ public class StaticImportMethodFix implements IntentionAction {
|
||||
return processCondition();
|
||||
}
|
||||
|
||||
private boolean isEffectivelyDeprecated(PsiMethod method) {
|
||||
if (method.isDeprecated()) {
|
||||
return true;
|
||||
}
|
||||
PsiClass aClass = method.getContainingClass();
|
||||
while (aClass != null) {
|
||||
if (aClass.isDeprecated()) {
|
||||
return true;
|
||||
}
|
||||
aClass = aClass.getContainingClass();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean processCondition() {
|
||||
return (applicableList.isEmpty() ? list : applicableList).size() + deprecated.size() < 50;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user