summaryrefslogtreecommitdiff
path: root/java/lint_test.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2024-01-29 13:49:14 -0800
committer Cole Faust <colefaust@google.com> 2024-01-29 14:48:23 -0800
commit5d0aaf42dbc6bc3e492c3dd19ff66458baccb587 (patch)
treeb01a10f4bf34fec040ab4f4c8f498fb7eacde335 /java/lint_test.go
parent78885cae81eb54053953fbcfb9af8c1715265e06 (diff)
Prevent disabling checks via flags property
strict_updatability_linting currently only checks that updatability checks aren't disabled via disabled_checks / warning_checks, you could get around it using the `flags` property. Only allow controlling checks via the *_checks properties. Bug: 322802379 Test: m nothing --no-skip-soong-tests Change-Id: Ia311622e1409f9cc201ab55f8749f2d13fccf551
Diffstat (limited to 'java/lint_test.go')
-rw-r--r--java/lint_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/java/lint_test.go b/java/lint_test.go
index b7e6aad8e..751b139e7 100644
--- a/java/lint_test.go
+++ b/java/lint_test.go
@@ -260,3 +260,22 @@ func TestJavaLintDatabaseSelectionFull(t *testing.T) {
}
}
}
+
+func TestCantControlCheckSeverityWithFlags(t *testing.T) {
+ bp := `
+ java_library {
+ name: "foo",
+ srcs: [
+ "a.java",
+ ],
+ min_sdk_version: "29",
+ sdk_version: "current",
+ lint: {
+ flags: ["--disabled", "NewApi"],
+ },
+ }
+ `
+ PrepareForTestWithJavaDefaultModules.
+ ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern("Don't use --disable, --enable, or --check in the flags field, instead use the dedicated disabled_checks, warning_checks, error_checks, or fatal_checks fields")).
+ RunTestWithBp(t, bp)
+}