mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-205482 "Use removal by object" fix may change semantics for List<Integer>
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
// "Use removal by object" "true"
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
void test(List<Integer> list, int key) {
|
||||
list.remove((Integer) key);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Use removal by object" "true"
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
void test(List<Integer> list, int key) {
|
||||
int idx = list.indexOf(key);
|
||||
list.r<caret>emove(idx);
|
||||
}
|
||||
}
|
||||
+3
@@ -131,6 +131,9 @@ public class RedundantCollectionOperationInspection extends AbstractBaseJavaLoca
|
||||
if (indexOfArg == null) return;
|
||||
CommentTracker ct = new CommentTracker();
|
||||
String text = ct.text(indexOfArg);
|
||||
if (PsiType.INT.equals(indexOfArg.getType())) {
|
||||
text = "(" + CommonClassNames.JAVA_LANG_INTEGER + ")" + text;
|
||||
}
|
||||
if (!PsiTreeUtil.isAncestor(call, removeArg, false)) {
|
||||
PsiDeclarationStatement declaration = PsiTreeUtil.getParentOfType(removeArg, PsiDeclarationStatement.class);
|
||||
if (declaration == null) return;
|
||||
|
||||
Reference in New Issue
Block a user