Skip to content

Commit 1da5be1

Browse files
committed
Add tests for inherited static fields
These cover various permutations of static fields defined on parents, on interfaces, and those parents and/or interfaces being opaque (stubs). They check both that jbmc doesn't outright crash, and in some cases that jbmc correctly determines that two static fields must be the same one, and therefore cannot differ.
1 parent f15c312 commit 1da5be1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+787
-0
lines changed
Binary file not shown.
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public class Test extends Parent {
2+
3+
public static void main(int nondet) {
4+
5+
x = nondet;
6+
assert x == Parent.x;
7+
8+
}
9+
10+
}
11+
12+
class Parent {
13+
14+
public static int x;
15+
16+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Test.class
3+
4+
^VERIFICATION SUCCESSFUL$
5+
--
6+
--
7+
This checks that jbmc knows that test.x and parent.x refer to the same field.
8+
Both test and parent are concrete (available) classes.
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
public class Parent {
3+
4+
// This is the version of Parent we will run jbmc against, which has
5+
// a static field 'x', but that field is private and cannot correspond
6+
// to the reference 'Test.x'.
7+
private static int x;
8+
9+
}
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class Test extends Parent {
2+
3+
public static void main(int nondet) {
4+
5+
x = nondet;
6+
assert x == Parent.x;
7+
8+
}
9+
10+
}
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
public class Parent {
3+
4+
// This is the version of Parent we compile Test.java against, which does
5+
// have a static field 'x'.
6+
public static int x;
7+
8+
}

0 commit comments

Comments
 (0)