mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
replace with foreach: disable for arrays of collection type (IDEA-160323)
This commit is contained in:
+1
-1
@@ -99,7 +99,7 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
final PsiStatement body = statement.getBody();
|
||||
if (iteratedValue != null && body != null) {
|
||||
final PsiType iteratedValueType = iteratedValue.getType();
|
||||
final PsiClass iteratorClass = PsiUtil.resolveClassInType(iteratedValueType);
|
||||
final PsiClass iteratorClass = PsiUtil.resolveClassInClassTypeOnly(iteratedValueType);
|
||||
final PsiClass collectionClass = JavaPsiFacade.getInstance(body.getProject()).findClass(CommonClassNames.JAVA_UTIL_COLLECTION, statement.getResolveScope());
|
||||
if (collectionClass != null && InheritanceUtil.isInheritorOrSelf(iteratorClass, collectionClass, true)) {
|
||||
try {
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with forEach" "false"
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
void fun(List<String>... lists) {
|
||||
for (List<String> list : li<caret>sts) {
|
||||
System.out.println(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user