mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
RedundantCollectionOperationInspection: fix redundant asList type
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// "Unwrap" "true"
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
class Foo {
|
||||
interface Parent1 {}
|
||||
interface Parent2 {}
|
||||
interface Child1 extends Parent1, Parent2 {}
|
||||
interface Child2 extends Parent1, Parent2 {}
|
||||
|
||||
void bar(boolean flag, Child1[] arr1, Child2[] arr2) {
|
||||
Parent2[] list = flag ? arr1 : arr2;
|
||||
for (Parent2 parent2 : list) {
|
||||
System.out.println(parent2);
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Unwrap" "true"
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
class Foo {
|
||||
interface Parent1 {}
|
||||
interface Parent2 {}
|
||||
interface Child1 extends Parent1, Parent2 {}
|
||||
interface Child2 extends Parent1, Parent2 {}
|
||||
|
||||
void bar(boolean flag, Child1[] arr1, Child2[] arr2) {
|
||||
List<? extends Parent2> list = Arrays.a<caret>sList(flag ? arr1 : arr2);
|
||||
for (Parent2 parent2 : list) {
|
||||
System.out.println(parent2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user