From 7ac943f7e1e9872c92ff41f18c5a967371d8c731 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Tue, 12 Dec 2023 23:13:57 +0000 Subject: [PATCH] Use --revert-annotation instead of --hide-annotation Use of `--hide-annotation android.annotation.FlaggedApi` was always an intermediate solution until the required semantics for `@FlaggedApi` was determined. The `--revert-annotation` option provides those semantics. When the `@FlaggedApi` is applied to an existing API, e.g. because it has moved from system to public, or because it has changed in some way, e.g. modifiers, then the correct semantics for when that API is not required is not to hide the API but to revert it to what it was before the change necessitating the `@FlaggedApi` annotation was made. Use --revert-annotation instead of --hide-annotation Use of `--hide-annotation android.annotation.FlaggedApi` was always an intermediate solution until the required semantics for `@FlaggedApi` was determined. The `--revert-annotation` option provides those semantics. When the `@FlaggedApi` is applied to an existing API, e.g. because it has moved from system to public, or because it has changed in some way, e.g. modifiers, then the correct semantics for when that API is not required is not to hide the API but to revert it to what it was before the change necessitating the `@FlaggedApi` annotation was made. Use --revert-annotation instead of --hide-annotation Use of `--hide-annotation android.annotation.FlaggedApi` was always an intermediate solution until the required semantics for `@FlaggedApi` was determined. The `--revert-annotation` option provides those semantics. When the `@FlaggedApi` is applied to an existing API, e.g. because it has moved from system to public, or because it has changed in some way, e.g. modifiers, then the correct semantics for when that API is not required is not to hide the API but to revert it to what it was before the change necessitating the `@FlaggedApi` annotation was made. Bug: 314196587 Test: ./gradlew Change-Id: Ic97f29dd2b9f598ba0851f5f622c2a2724f18037 --- java/config/droidstubs.go | 2 +- java/droidstubs_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/config/droidstubs.go b/java/config/droidstubs.go index b7aab5a98..7029fee06 100644 --- a/java/config/droidstubs.go +++ b/java/config/droidstubs.go @@ -57,7 +57,7 @@ var ( MetalavaAnnotationsWarningsFlags = strings.Join(metalavaAnnotationsWarningsFlags, " ") metalavaHideFlaggedApis = []string{ - "--hide-annotation", + "--revert-annotation", "android.annotation.FlaggedApi", } diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go index b97ae29d2..17cad8958 100644 --- a/java/droidstubs_test.go +++ b/java/droidstubs_test.go @@ -393,5 +393,5 @@ func TestDroidstubsHideFlaggedApi(t *testing.T) { m := result.ModuleForTests("foo", "android_common") manifest := m.Output("metalava.sbox.textproto") cmdline := String(android.RuleBuilderSboxProtoForTests(t, result.TestContext, manifest).Commands[0].Command) - android.AssertStringDoesContain(t, "flagged api hide command not included", cmdline, "--hide-annotation android.annotation.FlaggedApi") + android.AssertStringDoesContain(t, "flagged api hide command not included", cmdline, "--revert-annotation android.annotation.FlaggedApi") }