StreamApiMigrationInspection: skip parentheses in loop bound

This commit is contained in:
Tagir Valeev
2018-07-09 12:31:45 +07:00
parent 3f3f06b4da
commit 9ba38bc486
2 changed files with 2 additions and 2 deletions
@@ -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;
@@ -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));