Add more context to BanUncheckedReflection lint error message
Also update baseline files
Bug: 227674401
Test: BanUncheckedReflectionTest
Change-Id: Iacaad4b1d918365afdebb20c679d8d882b0b51ea
diff --git a/testutils/testutils-runtime/lint-baseline.xml b/testutils/testutils-runtime/lint-baseline.xml
index a1a835e..af574bc 100644
--- a/testutils/testutils-runtime/lint-baseline.xml
+++ b/testutils/testutils-runtime/lint-baseline.xml
@@ -1,27 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 8.3.0-alpha04" type="baseline" client="gradle" dependencies="false" name="AGP (8.3.0-alpha04)" variant="all" version="8.3.0-alpha04">
-
- <issue
- id="BanThreadSleep"
- message="Uses Thread.sleep()"
- errorLine1=" Thread.sleep(TIME_SLICE);"
- errorLine2=" ~~~~~">
- <location
- file="src/main/java/androidx/testutils/PollingCheck.java"/>
- </issue>
+<issues format="6" by="lint 8.3.0-alpha10" type="baseline" client="gradle" dependencies="false" name="AGP (8.3.0-alpha10)" variant="all" version="8.3.0-alpha10">
<issue
id="BanUncheckedReflection"
- message="Calling `Method.invoke` without an SDK check"
- errorLine1=" durationSetter.invoke(null, 1.0f)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/testutils/AnimationActivityTestRule.kt"/>
- </issue>
-
- <issue
- id="BanUncheckedReflection"
- message="Calling `Method.invoke` without an SDK check"
+ message="Method.invoke requires both an upper and lower SDK bounds checks to be safe, and the upper bound must be below SdkVersionInfo.HIGHEST_KNOWN_API."
errorLine1=" private val originalDurationScale = durationGetter.invoke(null) as Float"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -30,7 +12,7 @@
<issue
id="BanUncheckedReflection"
- message="Calling `Method.invoke` without an SDK check"
+ message="Method.invoke requires both an upper and lower SDK bounds checks to be safe, and the upper bound must be below SdkVersionInfo.HIGHEST_KNOWN_API."
errorLine1=" durationSetter.invoke(null, animationDurationScale)"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -39,7 +21,7 @@
<issue
id="BanUncheckedReflection"
- message="Calling `Method.invoke` without an SDK check"
+ message="Method.invoke requires both an upper and lower SDK bounds checks to be safe, and the upper bound must be below SdkVersionInfo.HIGHEST_KNOWN_API."
errorLine1=" durationSetter.invoke(null, originalDurationScale)"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -47,6 +29,15 @@
</issue>
<issue
+ id="LambdaLast"
+ message="Functional interface parameters (such as parameter 1, "owner", in androidx.testutils.LifecycleOwnerUtils.waitUntilState) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions"
+ errorLine1=" final @NonNull Lifecycle.State state) throws Throwable {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/testutils/LifecycleOwnerUtils.java"/>
+ </issue>
+
+ <issue
id="ClassVerificationFailure"
message="This call references a method added in API level 24; however, the containing class androidx.testutils.LocaleTestUtils is reachable from earlier API levels and will fail run-time class verification."
errorLine1=" newConfig.setLocales(locales.unwrap() as LocaleList)"
@@ -56,48 +47,12 @@
</issue>
<issue
- id="ObsoleteSdkInt"
- message="Unnecessary; SDK_INT is always >= 19"
- errorLine1=" if (Build.VERSION.SDK_INT >= 16 &&"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ id="BanThreadSleep"
+ message="Uses Thread.sleep()"
+ errorLine1=" Thread.sleep(TIME_SLICE);"
+ errorLine2=" ~~~~~">
<location
- file="src/main/java/androidx/testutils/AnimationActivityTestRule.kt"/>
- </issue>
-
- <issue
- id="ObsoleteSdkInt"
- message="Unnecessary; SDK_INT is always >= 19"
- errorLine1=" return if (Build.VERSION.SDK_INT >= 16) {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/testutils/AnimationDurationScaleRule.kt"/>
- </issue>
-
- <issue
- id="ObsoleteSdkInt"
- message="Unnecessary; SDK_INT is always >= 19"
- errorLine1=" Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ->"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/testutils/LocaleTestUtils.kt"/>
- </issue>
-
- <issue
- id="ObsoleteSdkInt"
- message="Unnecessary; SDK_INT is always >= 19"
- errorLine1=" if (Build.VERSION.SDK_INT >= 17) {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/fragment/app/StrictFragment.kt"/>
- </issue>
-
- <issue
- id="LambdaLast"
- message="Functional interface parameters (such as parameter 1, "owner", in androidx.testutils.LifecycleOwnerUtils.waitUntilState) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions"
- errorLine1=" final @NonNull Lifecycle.State state) throws Throwable {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/testutils/LifecycleOwnerUtils.java"/>
+ file="src/main/java/androidx/testutils/PollingCheck.java"/>
</issue>
</issues>