diff --git a/infer/src/checkers/annotations.ml b/infer/src/checkers/annotations.ml index a66718773..c0460758a 100644 --- a/infer/src/checkers/annotations.ml +++ b/infer/src/checkers/annotations.ml @@ -95,6 +95,8 @@ let suppress_lint = "SuppressLint" let suppress_view_nullability = "SuppressViewNullability" +let recently_nullable = "RecentlyNullable" + let thread_confined = "ThreadConfined" let thread_safe = "ThreadSafe" @@ -174,7 +176,17 @@ let ia_is_not_thread_safe ia = ia_ends_with ia not_thread_safe let ia_is_propagates_nullable ia = ia_ends_with ia propagates_nullable -let ia_is_nullable ia = ia_ends_with ia nullable || ia_is_propagates_nullable ia +let ia_is_nullable ia = + ia_ends_with ia nullable + (* @RecentlyNullable is a special annotation that was added to solve backward compatibility issues + for Android SDK migration. + See https://android-developers.googleblog.com/2018/08/android-pie-sdk-is-now-more-kotlin.html for details. + From nullsafe point of view, such annotations should be treated exactly as normal @Nullable annotation is treated. + (Actually, IDEs might even show it as @Nullable) + *) + || ia_ends_with ia recently_nullable + || ia_is_propagates_nullable ia + let ia_is_nonnull ia = List.exists ~f:(ia_ends_with ia) [nonnull; notnull; camel_nonnull]