From 5408be4a3ab961958b3fdc9768813a0b576a5f39 Mon Sep 17 00:00:00 2001 From: Artem Pianykh Date: Wed, 31 Mar 2021 08:07:47 -0700 Subject: [PATCH] [nullsafe] Deprecate @NullsafeStrict and @Nullsafe modes except LOCAL(trustAll) Reviewed By: mityal Differential Revision: D27394112 fbshipit-source-id: e48de5e46 --- .../facebook/infer/annotation/Nullsafe.java | 19 +++++++++++++++++-- .../infer/annotation/NullsafeStrict.java | 3 +++ .../infer/annotation/ThreadConfined.java | 6 +++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/infer/annotations/src/main/java/com/facebook/infer/annotation/Nullsafe.java b/infer/annotations/src/main/java/com/facebook/infer/annotation/Nullsafe.java index dce0dacc1..8872ec4ee 100644 --- a/infer/annotations/src/main/java/com/facebook/infer/annotation/Nullsafe.java +++ b/infer/annotations/src/main/java/com/facebook/infer/annotation/Nullsafe.java @@ -44,8 +44,8 @@ import kotlin.annotations.jvm.UnderMigration; * An internal class is checked if it's annotated as @Nullsafe or @NullsafeStrict. * *
    - * An external method is checked when it has nullability signature defined in third-party - * signatures repo. + * An external method is checked when it's annotated or has nullability signature + * defined in third-party signatures repo. *
*
    * The code that has built-in models in nullsafe is considered checked (both internal and @@ -107,10 +107,22 @@ import kotlin.annotations.jvm.UnderMigration; public @interface Nullsafe { enum Mode { LOCAL, + /** + * @deprecated STRICT mode is deprecated and soon will have no effect on the + * behaviour of NullsafeX. + */ + @Deprecated STRICT } + /** + * @deprecated Explicit TrustList is deprecated and soon will have no effect on the + * behaviour of Nullsafe. The code will be checked as if the mode is {@code + * trustAll = true}. + */ + @Deprecated @interface TrustList { + Class[] value(); /** @@ -130,7 +142,10 @@ public @interface Nullsafe { /** * Provides fine-grained control over which unchecked internal classes to trust. Only affects * LOCAL null-checking mode, as strict requires all dependencies to be STRICT themselves. + * + * @deprecated See {@link TrustList}. */ + @Deprecated TrustList trustOnly() default @TrustList( value = {}, diff --git a/infer/annotations/src/main/java/com/facebook/infer/annotation/NullsafeStrict.java b/infer/annotations/src/main/java/com/facebook/infer/annotation/NullsafeStrict.java index 5452153b9..4cd13a17f 100644 --- a/infer/annotations/src/main/java/com/facebook/infer/annotation/NullsafeStrict.java +++ b/infer/annotations/src/main/java/com/facebook/infer/annotation/NullsafeStrict.java @@ -18,7 +18,10 @@ import java.lang.annotation.Target; * return value is NOT annotated as @Nullable, then the function does not indeed return nulls, * subject to unsoundness issues (which should either be fixed, or should rarely happen in * practice). + * + * @deprecated Use {@link com.facebook.infer.annotation.Nullsafe} instead. */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.TYPE}) +@Deprecated public @interface NullsafeStrict {} diff --git a/infer/annotations/src/main/java/com/facebook/infer/annotation/ThreadConfined.java b/infer/annotations/src/main/java/com/facebook/infer/annotation/ThreadConfined.java index 27841bb41..0c4131dbf 100644 --- a/infer/annotations/src/main/java/com/facebook/infer/annotation/ThreadConfined.java +++ b/infer/annotations/src/main/java/com/facebook/infer/annotation/ThreadConfined.java @@ -20,10 +20,10 @@ import java.lang.annotation.Target; @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.CLASS) public @interface ThreadConfined { - String value(); /** the thread that the mutations should be confined to */ - public static String UI = "UI"; + String value(); /** confined to the UI thread */ - public static String ANY = "ANY"; + public static String UI = "UI"; /** confined to any thread (but only that thread!) */ + public static String ANY = "ANY"; }