@@ -167,7 +167,7 @@ from `java.lang.String`, e.g.
167
167
2|
168
168
3| public class ExampleModels {
169
169
4|
170
- 5| public static void stringOp( ) {
170
+ 5| public static void main(String[] args ) {
171
171
6| StringBuilder sb = new StringBuilder("abcd");
172
172
7| StringBuilder sb2 = sb.insert(2, "$");
173
173
8| assert sb2.toString().startsWith("abc");
@@ -178,13 +178,17 @@ from `java.lang.String`, e.g.
178
178
The following command line (note that the current directory is also added to
179
179
the classpath):
180
180
181
- $ jbmc ExampleModels.class --function tutorial.ExampleModels.stringOp -- cp <path_to_cbmc>/jbmc/src/java_bytecode/library/core-models.jar:.
181
+ $ jbmc ExampleModels.class --cp <path_to_cbmc>/jbmc/src/java_bytecode/library/core-models.jar:.
182
182
183
183
will flag this violation (truncated):
184
184
``` c
185
185
[java::tutorial.ExampleModels.stringOp:()V.assertion.1 ] line 8 assertion: FAILURE
186
186
```
187
- Again, the trace shows the string violating the condition in the assertion:
187
+ Also note that when we want the main function of the class to be the entry
188
+ point of the analysis, we can remove the ` --function ` option.
189
+
190
+ Again, the trace (when re-running with ` --trace ` ) shows the string violating
191
+ the condition in the assertion:
188
192
``` c
189
193
dynamic_object2={ 'a', 'b', '$', 'c', 'd' }
190
194
```
0 commit comments