mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-89838 (Configure inspection "'size() == 0' replaceable with 'isEmpty()'" to not flag inside custom implementations of Collection.)
This commit is contained in:
+4
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.OrderedSet;
|
||||
import com.intellij.util.ui.CheckBox;
|
||||
@@ -209,6 +210,9 @@ public class SizeReplaceableByIsEmptyInspection extends BaseInspection {
|
||||
if (aClass == null) {
|
||||
return null;
|
||||
}
|
||||
if (PsiTreeUtil.isAncestor(aClass, callExpression, true)) {
|
||||
return null;
|
||||
}
|
||||
for (String ignoredType : ignoredTypes) {
|
||||
if (InheritanceUtil.isInheritor(aClass, ignoredType)) {
|
||||
return null;
|
||||
|
||||
+8
@@ -25,4 +25,12 @@ public class SizeReplaceableByIsEmpty {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MyList<T> implements java.util.List<T>
|
||||
{
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return this.size() == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user