summaryrefslogtreecommitdiff
path: root/java/lint.go
diff options
context:
space:
mode:
author Orion Hodson <oth@google.com> 2022-08-15 20:23:38 +0100
committer Orion Hodson <oth@google.com> 2022-08-17 09:34:09 +0100
commitb816652ee0175b279c2bb83c7ca4e16df6daa6ff (patch)
tree325969a690443f641e0effcdcc669be8d4a8358d /java/lint.go
parenta2f3b77ad5d0a10a21671dbdd28b0adbbfc59da0 (diff)
Allow libcore to have NewApi warnings
The majority of libcore NewApi warnings come from references to new methods, constants, fields added in a file and then referenced in the same source file. Maintaining suppressions is not scalable: they need to work across multiple API versions in different branches. Bug: 208656169 Test: TH Change-Id: If5e746f25f1bd34931ee8c89b363aa92c81e23b3
Diffstat (limited to 'java/lint.go')
-rw-r--r--java/lint.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/java/lint.go b/java/lint.go
index c27ca9821..6ef109f97 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -328,12 +328,18 @@ func (l *linter) lint(ctx android.ModuleContext) {
if l.minSdkVersion != l.compileSdkVersion {
l.extraMainlineLintErrors = append(l.extraMainlineLintErrors, updatabilityChecks...)
- _, filtered := android.FilterList(l.properties.Lint.Warning_checks, updatabilityChecks)
- if len(filtered) != 0 {
- ctx.PropertyErrorf("lint.warning_checks",
- "Can't treat %v checks as warnings if min_sdk_version is different from sdk_version.", filtered)
+ // Skip lint warning checks for NewApi warnings for libcore where they come from source
+ // files that reference the API they are adding (b/208656169).
+ if ctx.ModuleDir() != "libcore" {
+ _, filtered := android.FilterList(l.properties.Lint.Warning_checks, updatabilityChecks)
+
+ if len(filtered) != 0 {
+ ctx.PropertyErrorf("lint.warning_checks",
+ "Can't treat %v checks as warnings if min_sdk_version is different from sdk_version.", filtered)
+ }
}
- _, filtered = android.FilterList(l.properties.Lint.Disabled_checks, updatabilityChecks)
+
+ _, filtered := android.FilterList(l.properties.Lint.Disabled_checks, updatabilityChecks)
if len(filtered) != 0 {
ctx.PropertyErrorf("lint.disabled_checks",
"Can't disable %v checks if min_sdk_version is different from sdk_version.", filtered)