File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -571,9 +571,19 @@ codet initialize_nondet_string_struct(
571
571
572
572
// `obj` is `*expr`
573
573
const struct_typet &struct_type = to_struct_type (ns.follow (obj.type ()));
574
- const irep_idt &class_id = " java::" + id2string (struct_type.get_tag ());
575
-
576
- // @clsid = String and @lock = false:
574
+ // @clsid = java::java.lang.String or similar.
575
+ // We allow type StringBuffer and StringBuilder to be initialized
576
+ // in the same way has String, because they have the same structure and
577
+ // are treated in the same way by CBMC.
578
+ // Note that CharSequence cannot be used as classid because it's abstract,
579
+ // so it is replaced by String.
580
+ // \todo allow StringBuffer and StringBuilder as classid for Charsequence
581
+ const irep_idt &class_id =
582
+ struct_type.get_tag () == " java.lang.CharSequence"
583
+ ? " java::java.lang.String"
584
+ : " java::" + id2string (struct_type.get_tag ());
585
+
586
+ // @lock = false:
577
587
const symbol_typet jlo_symbol (" java::java.lang.Object" );
578
588
const struct_typet &jlo_type = to_struct_type (ns.follow (jlo_symbol));
579
589
struct_exprt jlo_init (jlo_symbol);
You can’t perform that action at this time.
0 commit comments