File tree Expand file tree Collapse file tree 11 files changed +119
-0
lines changed
jbmc/regression/jbmc/assume-inputs-non-null Expand file tree Collapse file tree 11 files changed +119
-0
lines changed Original file line number Diff line number Diff line change
1
+ class My {
2
+
3
+ String field ;
4
+
5
+ public static void stringArrayArg (String [] arg ) {
6
+ if (arg == null ) {
7
+ assert false ;
8
+ } else {
9
+ assert false ;
10
+ }
11
+ }
12
+
13
+ public static void stringArg (String arg ) {
14
+ if (arg == null ) {
15
+ assert false ;
16
+ } else {
17
+ assert false ;
18
+ }
19
+ }
20
+
21
+ public static void classArg (Other arg ) {
22
+ if (arg == null ) {
23
+ assert false ;
24
+ } else if (arg .stringField != null ) {
25
+ assert false ;
26
+ } else if (arg .otherField != null ) {
27
+ assert false ;
28
+ } else if (arg .other2Field != null ) {
29
+ assert false ;
30
+ }
31
+ }
32
+
33
+ public void field () {
34
+ if (field == null ) {
35
+ assert false ;
36
+ } else {
37
+ assert false ;
38
+ }
39
+ }
40
+
41
+ }
Original file line number Diff line number Diff line change
1
+ class Other {
2
+
3
+ String stringField ;
4
+ Other otherField ;
5
+ Other2 other2Field ;
6
+
7
+ }
Original file line number Diff line number Diff line change
1
+ class Other2 {
2
+
3
+ String string2Field ;
4
+
5
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ My.class
3
+ --function My.classArg --java-assume-inputs-non-null
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ \[java::My.classArg:\(LOther;\)V.assertion.1\].*SUCCESS
8
+ \[java::My.classArg:\(LOther;\)V.assertion.2\].*FAILURE
9
+ \[java::My.classArg:\(LOther;\)V.assertion.3\].*FAILURE
10
+ \[java::My.classArg:\(LOther;\)V.assertion.4\].*FAILURE
11
+ --
12
+ ^warning: ignoring
13
+ --
14
+ Check that --java-assume-inputs-non-null restricts inputs to non-null user-
15
+ defined objects.
16
+ Also verify that fields of input object are NOT constrained to be non-null.
Original file line number Diff line number Diff line change
1
+ CORE
2
+ My.class
3
+ --function My.field --java-assume-inputs-non-null
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ \[java::My.field:\(\)V.assertion.1\].*FAILURE
8
+ \[java::My.field:\(\)V.assertion.2\].*FAILURE
9
+ --
10
+ ^warning: ignoring
11
+ --
12
+ Check that --java-assume-inputs-non-null does NOT constrain the fields of the
13
+ containing object to be non-null.
Original file line number Diff line number Diff line change
1
+ CORE
2
+ My.class
3
+ --function My.stringArrayArg --java-assume-inputs-non-null
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ \[java::My.stringArrayArg:\(\[Ljava/lang/String;\)V.assertion.1\].*SUCCESS
8
+ \[java::My.stringArrayArg:\(\[Ljava/lang/String;\)V.assertion.2\].*FAILURE
9
+ --
10
+ ^warning: ignoring
11
+ --
12
+ Check that --java-assume-inputs-non-null restricts inputs to non-null arrays
Original file line number Diff line number Diff line change
1
+ CORE
2
+ My.class
3
+ --function My.stringArrayArg
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ \[java::My.stringArrayArg:\(\[Ljava/lang/String;\)V.assertion.1\].*FAILURE
8
+ \[java::My.stringArrayArg:\(\[Ljava/lang/String;\)V.assertion.2\].*FAILURE
9
+ --
10
+ ^warning: ignoring
11
+ --
12
+ Sanity check: null inputs are allowed when not using
13
+ --java-assume-inputs-non-null.
Original file line number Diff line number Diff line change
1
+ CORE
2
+ My.class
3
+ --function My.stringArg --java-assume-inputs-non-null
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ \[java::My.stringArg:\(Ljava/lang/String;\)V.assertion.1\].*SUCCESS
8
+ \[java::My.stringArg:\(Ljava/lang/String;\)V.assertion.2\].*FAILURE
9
+ --
10
+ ^warning: ignoring
11
+ --
12
+ Check that --java-assume-inputs-non-null restricts inputs to non-null strings
You can’t perform that action at this time.
0 commit comments