From 9a062192f8c40f2a141e05d6673e1d05d5b9688e Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Thu, 13 Aug 2015 15:03:11 -0600 Subject: [PATCH] [Infer][nullables] Turning nullable field warnings back on --- infer/src/backend/rearrange.ml | 5 ++--- .../tests/endtoend/java/infer/NullPointerExceptionTest.java | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/infer/src/backend/rearrange.ml b/infer/src/backend/rearrange.ml index fa1a14f13..a57e56bf9 100644 --- a/infer/src/backend/rearrange.ml +++ b/infer/src/backend/rearrange.ml @@ -943,8 +943,7 @@ let check_dereference_error pdesc (prop : Prop.normal Prop.t) lexp loc = when Sil.exp_equal exp deref_exp && Annotations.param_is_nullable pvar ann_sig -> nullable_obj_str := Sil.pvar_to_string pvar; true - (* TODO: (t7970552) re-enable checks on @Nullable fields *) - (*| Sil.Hpointsto (_, Sil.Estruct (flds, inst), Sil.Sizeof (typ, _)) -> + | Sil.Hpointsto (_, Sil.Estruct (flds, inst), Sil.Sizeof (typ, _)) -> let is_nullable fld = match Annotations.get_field_type_and_annotation fld typ with | Some (_, annot) -> Annotations.ia_is_nullable annot @@ -955,7 +954,7 @@ let check_dereference_error pdesc (prop : Prop.normal Prop.t) lexp loc = nullable_obj_str := Ident.fieldname_to_simplified_string fld; true | _ -> false in - list_exists is_strexp_pt_by_nullable_fld flds*) + list_exists is_strexp_pt_by_nullable_fld flds | _ -> false) (Prop.get_sigma prop) in let root = Sil.root_of_lexp lexp in diff --git a/infer/tests/endtoend/java/infer/NullPointerExceptionTest.java b/infer/tests/endtoend/java/infer/NullPointerExceptionTest.java index 920fd4270..0bc0e8ba7 100644 --- a/infer/tests/endtoend/java/infer/NullPointerExceptionTest.java +++ b/infer/tests/endtoend/java/infer/NullPointerExceptionTest.java @@ -55,8 +55,7 @@ public class NullPointerExceptionTest { "cursorFromContentResolverNPE", "nullPointerExceptionInArrayLengthLoop", "nullPointerExceptionCallArrayReadMethod", - // TODO (t7970552): re-enable this test - //"nullableFieldNPE", + "nullableFieldNPE", "nullableParamNPE", "badCheckShouldCauseNPE", "nullPointerExceptionArrayLength",