mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
StreamApiMigrationInspection: skip parentheses in loop bound
This commit is contained in:
+1
-1
@@ -637,7 +637,7 @@ public class StreamApiMigrationInspection extends AbstractBaseJavaLocalInspectio
|
||||
if (arrayType == null || !StreamApiUtil.isSupportedStreamElement(arrayType.getComponentType())) return null;
|
||||
PsiExpression dimension = ArrayUtil.getFirstElement(initializer.getArrayDimensions());
|
||||
if (dimension == null) return null;
|
||||
PsiExpression bound = loop.myBound;
|
||||
PsiExpression bound = PsiUtil.skipParenthesizedExprDown(loop.myBound);
|
||||
if (!isArrayLength(arrayVariable, dimension, bound)) return null;
|
||||
if (VariableAccessUtils.variableIsUsed(arrayVariable, assignment.getRExpression())) return null;
|
||||
return arrayVariable;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import java.util.Arrays;
|
||||
public class Test {
|
||||
public void test(int bound) {
|
||||
Integer[][] arr = new Integer[bound][];
|
||||
for(int <caret>i = 0; i < arr.length; i++) {
|
||||
for(int <caret>i = 0; i < (arr.length); i++) {
|
||||
arr[i] = new Integer[] {i};
|
||||
}
|
||||
System.out.println(Arrays.toString(arr));
|
||||
|
||||
Reference in New Issue
Block a user