diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2022-06-10 22:51:15 +0900 |
---|---|---|
committer | Cherrypicker Worker <android-build-cherrypicker-worker@google.com> | 2022-06-13 02:05:42 +0000 |
commit | 9e1d0907154f0d7193abaeef016a83330888480b (patch) | |
tree | a759a4c1f4c17ef1dcd48ef8bdc814cded6f0fdc | |
parent | becbc679e655085454efc9a16fddf665773433cb (diff) | |
download | net-9e1d0907154f0d7193abaeef016a83330888480b.tar.gz |
Fix DevSdkIgnoreRule target SDK annotation processing.
The code added to DevSdkIgnoreRule to process the max target SDK
annotations in aosp/2110064 was incorrect. It is trying to match
the annotation name, but ::class.simpleName returns something
like Proxy$3, not the actual name of the annotation. Use
annotationClass.simpleName instead, which actually works.
This was not caught in aosp/2110064 because it contained an even
worse error which broke DevSdkIgnoreRule completely. That was
fixed in aosp/2114653.
Bug: 233553525
Test: LinkPropertiesTest#testExcludedRoutesDisabled passes on user build
Change-Id: If9220e5ef00fafea556604b251b2106d15d063f8
(cherry picked from commit 3af9b34bad03ac0a7ad061bac64a1ace9e1aac7a)
Merged-In: If9220e5ef00fafea556604b251b2106d15d063f8
-rw-r--r-- | common/testutils/devicetests/com/android/testutils/DevSdkIgnoreRule.kt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/testutils/devicetests/com/android/testutils/DevSdkIgnoreRule.kt b/common/testutils/devicetests/com/android/testutils/DevSdkIgnoreRule.kt index 6a073eae..3fcf8011 100644 --- a/common/testutils/devicetests/com/android/testutils/DevSdkIgnoreRule.kt +++ b/common/testutils/devicetests/com/android/testutils/DevSdkIgnoreRule.kt @@ -74,7 +74,7 @@ private fun isDevSdkUpTo(maxInclusive: Int): Boolean { private fun getMaxTargetSdk(description: Description): Int? { return description.annotations.firstNotNullOfOrNull { - MAX_TARGET_SDK_ANNOTATION_RE.matcher(it::class.simpleName).let { m -> + MAX_TARGET_SDK_ANNOTATION_RE.matcher(it.annotationClass.simpleName).let { m -> if (m.find()) m.group(1).toIntOrNull() else null } } |