File tree 7 files changed +31
-10
lines changed
regression/jbmc/class-fields
7 files changed +31
-10
lines changed Original file line number Diff line number Diff line change
1
+ public class Test {
2
+
3
+ public static void main () {
4
+
5
+ java .lang .Class c = Test .class ;
6
+ assert false ;
7
+
8
+ }
9
+
10
+ }
Original file line number Diff line number Diff line change
1
+ package java .lang ;
2
+
3
+ public class Class {
4
+
5
+ public Integer field ;
6
+
7
+ protected void cproverNondetInitialize () {
8
+ org .cprover .CProver .assume (field == null );
9
+ }
10
+
11
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ assertion at file Test\.java line 6.*: FAILURE$
8
+ --
9
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -94,11 +94,6 @@ static void java_static_lifetime_init(
94
94
if (allow_null)
95
95
{
96
96
irep_idt nameid=sym.symbol_expr ().get_identifier ();
97
- std::string namestr=id2string (nameid);
98
- const std::string suffix=" @class_model" ;
99
- // Static '.class' fields are always non-null.
100
- if (has_suffix (namestr, suffix))
101
- allow_null=false ;
102
97
if (allow_null && is_java_string_literal_id (nameid))
103
98
allow_null=false ;
104
99
if (allow_null && is_non_null_library_global (nameid))
Original file line number Diff line number Diff line change @@ -874,10 +874,6 @@ void java_object_factoryt::gen_nondet_pointer_init(
874
874
875
875
auto set_null_inst=get_null_assignment (expr, pointer_type);
876
876
877
- // Determine whether the pointer can be null. In particular the pointers
878
- // inside the java.lang.Class class shall not be null
879
- const bool not_null = !allow_null || class_identifier == " java.lang.Class" ;
880
-
881
877
// Alternatively, if this is a void* we *must* initialise with null:
882
878
// (This can currently happen for some cases of #exception_value)
883
879
bool must_be_null=
@@ -889,7 +885,7 @@ void java_object_factoryt::gen_nondet_pointer_init(
889
885
// <expr> = nullptr;
890
886
new_object_assignments.add (set_null_inst);
891
887
}
892
- else if (not_null )
888
+ else if (!allow_null )
893
889
{
894
890
// Add the following code to assignments:
895
891
// <expr> = <aoe>;
You can’t perform that action at this time.
0 commit comments