Skip to content

Commit 91e652e

Browse files
committed
Add test for static field of type Integer[]
This test falls into the same category as the tests from the previous commit (static field with reference to primitive wrapper(s)) but is closer to the example that was initially found for the bug (TG-8623).
1 parent 9938405 commit 91e652e

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed
Binary file not shown.

jbmc/regression/jbmc/deterministic_assignments_json/StaticValues.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@ public static void testShortWrapperContainerFail() {
333333
assert shortWrapperContainer.shortField != (short)200;
334334
}
335335

336+
public static Integer[] integerWrapperArray = {1111};
337+
public static void testIntegerWrapperArrayPass() {
338+
assert integerWrapperArray.length == 1 && integerWrapperArray[0] == 1111;
339+
}
340+
public static void testIntegerWrapperArrayFail() {
341+
assert integerWrapperArray.length != 1 || integerWrapperArray[0] != 1111;
342+
}
343+
336344
// Strings
337345
public static String stringField = Util.repeat("hello! ", 6);
338346
public static void testStringPass() {

jbmc/regression/jbmc/deterministic_assignments_json/clinit-state.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,12 @@
476476
"shortWrapperContainer":{
477477
"@type":"ContainerForShort",
478478
"shortField":200
479+
},
480+
"integerWrapperArray":{
481+
"@type":"[Ljava.lang.Integer;",
482+
"@items":[
483+
1111
484+
]
479485
}
480486
},
481487
"OtherClass":{
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testIntegerWrapperArrayFail
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
StaticValues.class
3+
--unwind 1 --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --static-values clinit-state.json --function StaticValues.testIntegerWrapperArrayPass
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
--

0 commit comments

Comments
 (0)