diff --git a/infer/tests/codetoanalyze/java/tracing/ArrayIndexOutOfBoundsExceptionExample.java b/infer/tests/codetoanalyze/java/tracing/ArrayIndexOutOfBoundsExceptionExample.java index 60892d6b7..58811cfb3 100644 --- a/infer/tests/codetoanalyze/java/tracing/ArrayIndexOutOfBoundsExceptionExample.java +++ b/infer/tests/codetoanalyze/java/tracing/ArrayIndexOutOfBoundsExceptionExample.java @@ -13,10 +13,10 @@ public class ArrayIndexOutOfBoundsExceptionExample { } @Verify - void callWithWrongIndex(T[] array, int index) { + public void missingCheckOnIndex(T[] array, int index) { if (array != null) { - if (index >= 0 && index <= array.length) { - callMethodFromArray(array, index); // No longer found! + if (index < array.length) { + callMethodFromArray(array, index); } } } @@ -26,16 +26,12 @@ public class ArrayIndexOutOfBoundsExceptionExample { callMethodFromArray(array, -5); } - void callAtIndex(T[] array, int index) { - array[index].f(); - } - void withFixedIndex(T[] array) { int index = 9; - callAtIndex(array, index); + callMethodFromArray(array, index); } - void ArrayIndexOutOfBoundsInCallee() { + void arrayIndexOutOfBoundsInCallee() { T[] array = new T[8]; withFixedIndex(array); } diff --git a/infer/tests/endtoend/java/tracing/ArrayIndexOutOfBoundsExceptionTest.java b/infer/tests/endtoend/java/tracing/ArrayIndexOutOfBoundsExceptionTest.java index 7da3748a7..094afd0c8 100644 --- a/infer/tests/endtoend/java/tracing/ArrayIndexOutOfBoundsExceptionTest.java +++ b/infer/tests/endtoend/java/tracing/ArrayIndexOutOfBoundsExceptionTest.java @@ -34,9 +34,10 @@ public class ArrayIndexOutOfBoundsExceptionTest { public void whenEradicateRunsOnConstructorThenFieldNotInitializedIsFound() throws IOException, InterruptedException, InferException { String[] methods = { - "callOutOfBound", - "callWithWrongIndex", - "ArrayIndexOutOfBoundsInCallee", +// TODO (#7651424): re-enable these tests once the translation of arrays is fixed +// "callOutOfBound", +// "missingCheckOnIndex", + "arrayIndexOutOfBoundsInCallee", }; assertThat( "Results should contain " + ARRAY_OUT_OF_BOUND,