@ -13,7 +13,8 @@ type t =
| NullConst of Location . t (* * A null literal in the source *)
| NullConst of Location . t (* * A null literal in the source *)
| NonnullConst of Location . t (* * A constant ( not equal to null ) in the source. *)
| NonnullConst of Location . t (* * A constant ( not equal to null ) in the source. *)
| Field of field_origin (* * A field access ( result of expression `some_object.some_field` ) *)
| Field of field_origin (* * A field access ( result of expression `some_object.some_field` ) *)
| Formal of Mangled . t (* * A formal parameter *)
| MethodParameter of AnnotatedSignature . param_signature (* * A method's parameter *)
| This (* `this` object. Can not be null, according to Java rules. *)
| MethodCall of method_call_origin (* * A result of a method call *)
| MethodCall of method_call_origin (* * A result of a method call *)
| New (* * A new object creation *)
| New (* * A new object creation *)
| ArrayLengthResult (* * integer value - result of accessing array.length *)
| ArrayLengthResult (* * integer value - result of accessing array.length *)
@ -43,8 +44,11 @@ let rec to_string = function
" Field "
" Field "
^ Typ . Fieldname . to_simplified_string field_name
^ Typ . Fieldname . to_simplified_string field_name
^ " (object: " ^ to_string object_origin ^ " ) "
^ " (object: " ^ to_string object_origin ^ " ) "
| Formal s ->
| MethodParameter { mangled ; param_annotated_type = { nullability } } ->
" Formal " ^ Mangled . to_string s
Format . asprintf " Param %s <%a> " ( Mangled . to_string mangled ) AnnotatedNullability . pp
nullability
| This ->
" this "
| MethodCall { pname } ->
| MethodCall { pname } ->
Printf . sprintf " Fun %s " ( Typ . Procname . to_simplified_string pname )
Printf . sprintf " Fun %s " ( Typ . Procname . to_simplified_string pname )
| New ->
| New ->
@ -67,8 +71,8 @@ let get_description origin =
( " field " ^ Typ . Fieldname . to_simplified_string field_name ^ atline access_loc
( " field " ^ Typ . Fieldname . to_simplified_string field_name ^ atline access_loc
, Some access_loc
, Some access_loc
, None )
, None )
| Formal s ->
| MethodParameter { mangled } ->
Some ( " method parameter " ^ Mangled . to_string s , None , None )
Some ( " method parameter " ^ Mangled . to_string mangled , None , None )
| MethodCall { pname ; call_loc ; annotated_signature } ->
| MethodCall { pname ; call_loc ; annotated_signature } ->
let modelled_in =
let modelled_in =
(* TODO ( T54088319 ) don't calculate this info and propagate it from AnnotatedNullability instead *)
(* TODO ( T54088319 ) don't calculate this info and propagate it from AnnotatedNullability instead *)
@ -88,7 +92,7 @@ let get_description origin =
But for these issues we currently don't print origins in the error string .
But for these issues we currently don't print origins in the error string .
It is a good idea to change this and start printing origins for these origins as well .
It is a good idea to change this and start printing origins for these origins as well .
* )
* )
| New | NonnullConst _ | ArrayLengthResult ->
| This | New | NonnullConst _ | ArrayLengthResult ->
None
None
(* Two special cases - should not really occur in normal code *)
(* Two special cases - should not really occur in normal code *)
| ONone | Undef ->
| ONone | Undef ->
@ -100,7 +104,7 @@ let join o1 o2 =
(* left priority *)
(* left priority *)
| Undef , _ | _ , Undef ->
| Undef , _ | _ , Undef ->
Undef
Undef
| Field _ , ( NullConst _ | NonnullConst _ | Formal _ | MethodCall _ | New ) ->
| Field _ , ( NullConst _ | NonnullConst _ | MethodParameter _ | This | MethodCall _ | New ) ->
(* low priority to Field, to support field initialization patterns *)
(* low priority to Field, to support field initialization patterns *)
o2
o2
| _ ->
| _ ->