From 08e7a11edf0bfdd350d8d3c959c30acb42f3a365 Mon Sep 17 00:00:00 2001 From: Mitya Lyubarskiy Date: Tue, 31 Mar 2020 07:11:23 -0700 Subject: [PATCH] [nullsafe] Respect NullableDecl annotation Summary: This declaration is heavily used in Guava library. Quick inspection shows that majority of methods are annotated correctly. This will hide previosly hidden unsoundness issues in the codebase. Reviewed By: artempyanykh Differential Revision: D20737104 fbshipit-source-id: aa048bfc1 --- infer/src/checkers/annotations.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/infer/src/checkers/annotations.ml b/infer/src/checkers/annotations.ml index cfbd415b9..4dbdf7623 100644 --- a/infer/src/checkers/annotations.ml +++ b/infer/src/checkers/annotations.ml @@ -61,6 +61,8 @@ let no_allocation = "NoAllocation" let nullable = "Nullable" +let nullable_decl = "NullableDecl" + let nullsafe_strict = "NullsafeStrict" let nullsafe = "Nullsafe" @@ -183,6 +185,9 @@ let ia_is_propagates_nullable ia = ia_ends_with ia propagates_nullable let ia_is_nullable ia = List.exists ~f:(ia_ends_with ia) [ nullable + ; nullable_decl + (* From org.checkerframework.checker.nullness.compatqual package. Extensively used in Guava library. + Identical to {@code @Nullable}, but can only be written at declaration locations. *) ; propagates_nullable (* @PropagatesNullable is implicitly nullable *) ; recently_nullable (* @RecentlyNullable is a special annotation that was added to solve backward compatibility issues