diff --git a/regression/cbmc-java/annotations2/FieldAnnotation.class b/regression/cbmc-java/annotations2/FieldAnnotation.class new file mode 100644 index 00000000000..7be3db544bd Binary files /dev/null and b/regression/cbmc-java/annotations2/FieldAnnotation.class differ diff --git a/regression/cbmc-java/annotations2/Test.class b/regression/cbmc-java/annotations2/Test.class new file mode 100644 index 00000000000..c0260839fe3 Binary files /dev/null and b/regression/cbmc-java/annotations2/Test.class differ diff --git a/regression/cbmc-java/annotations2/Test.java b/regression/cbmc-java/annotations2/Test.java new file mode 100644 index 00000000000..95a1c98c958 --- /dev/null +++ b/regression/cbmc-java/annotations2/Test.java @@ -0,0 +1,13 @@ +@interface FieldAnnotation { +} + +public class Test { + @FieldAnnotation + public static double d; + + public void check() { + double f = d; + assert(f == d); + assert(f != d); + } +} diff --git a/regression/cbmc-java/annotations2/test.desc b/regression/cbmc-java/annotations2/test.desc new file mode 100644 index 00000000000..0e33ad17c4b --- /dev/null +++ b/regression/cbmc-java/annotations2/test.desc @@ -0,0 +1,9 @@ +CORE +Test.class +--function Test.check +^EXIT=10$ +^SIGNAL=0$ +assertion at file Test.java line 10 .* SUCCESS +assertion at file Test.java line 11 .* FAILURE +-- +-- diff --git a/src/java_bytecode/java_types.h b/src/java_bytecode/java_types.h index 8aa2dc114da..2e2fc53bfa6 100644 --- a/src/java_bytecode/java_types.h +++ b/src/java_bytecode/java_types.h @@ -71,14 +71,14 @@ class annotated_typet : public typet { // This cast should be safe as java_annotationt doesn't add data to irept return reinterpret_cast &>( - find(ID_annotations).get_sub()); + find(ID_C_annotations).get_sub()); } std::vector &get_annotations() { // This cast should be safe as java_annotationt doesn't add data to irept return reinterpret_cast &>( - add(ID_annotations).get_sub()); + add(ID_C_annotations).get_sub()); } }; diff --git a/src/util/irep_ids.def b/src/util/irep_ids.def index 78ff9b00e16..342c586b772 100644 --- a/src/util/irep_ids.def +++ b/src/util/irep_ids.def @@ -664,7 +664,7 @@ IREP_ID_TWO(overflow_shl, overflow-shl) IREP_ID_TWO(C_no_initialization_required, #no_initialization_required) IREP_ID_TWO(overlay_class, java::com.diffblue.OverlayClassImplementation) IREP_ID_TWO(overlay_method, java::com.diffblue.OverlayMethodImplementation) -IREP_ID_ONE(annotations) +IREP_ID_TWO(C_annotations, #annotations) // Projects depending on this code base that wish to extend the list of // available ids should provide a file local_irep_ids.h in their source tree and