From b679bdd997687a489cb203ba7732a636fa3c5876 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Mon, 10 Jun 2024 14:29:41 +0100 Subject: [PATCH] Hide some noisy Metalava issues Changes https://r.android.com/3106478 and https://r.android.com/3110137 unintentionally started reporting some previously hidden issues as error when new. This change hides those issues again. Bug: 343157584 Test: m checkapi before and after Change-Id: I2e04c919ce5c4f2b39fab65afd13bc31725031f0 --- java/droidstubs.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/java/droidstubs.go b/java/droidstubs.go index 5ca6c256f..b32b754d3 100644 --- a/java/droidstubs.go +++ b/java/droidstubs.go @@ -1054,8 +1054,7 @@ func (d *Droidstubs) everythingOptionalCmd(ctx android.ModuleContext, cmd *andro } if !treatDocumentationIssuesAsErrors { - // Treat documentation issues as warnings, but error when new. - cmd.Flag("--error-when-new-category").Flag("Documentation") + treatDocumentationIssuesAsWarningErrorWhenNew(cmd) } // Add "check released" options. (Detect incompatible API changes from the last public release) @@ -1083,6 +1082,22 @@ func (d *Droidstubs) everythingOptionalCmd(ctx android.ModuleContext, cmd *andro } } +// HIDDEN_DOCUMENTATION_ISSUES is the set of documentation related issues that should always be +// hidden as they are very noisy and provide little value. +var HIDDEN_DOCUMENTATION_ISSUES = []string{ + "Deprecated", + "IntDef", + "Nullable", +} + +func treatDocumentationIssuesAsWarningErrorWhenNew(cmd *android.RuleBuilderCommand) { + // Treat documentation issues as warnings, but error when new. + cmd.Flag("--error-when-new-category").Flag("Documentation") + + // Hide some documentation issues that generated a lot of noise for little benefit. + cmd.FlagForEachArg("--hide ", HIDDEN_DOCUMENTATION_ISSUES) +} + // Sandbox rule for generating exportable stubs and other artifacts func (d *Droidstubs) exportableStubCmd(ctx android.ModuleContext, params stubsCommandConfigParams) { optionalCmdParams := stubsCommandParams{ @@ -1154,7 +1169,7 @@ func (d *Droidstubs) optionalStubCmd(ctx android.ModuleContext, params stubsComm } // Treat documentation issues as warnings, but error when new. - cmd.Flag("--error-when-new-category").Flag("Documentation") + treatDocumentationIssuesAsWarningErrorWhenNew(cmd) if params.stubConfig.generateStubs { rule.Command().