summaryrefslogtreecommitdiff
path: root/api/coverage/tools
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-07-02 16:21:14 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-07-02 16:21:14 +0000
commitb983c5bc5f240e9a4958cd3edcf19472c0ab7713 (patch)
tree2e5cdf362ff513a32b6370ac4bba7cb1d711692e /api/coverage/tools
parentee330cda39d2b4b20f5114920df8ecd07ac073ff (diff)
parentecb807b69b92f200ceefc8ab56eed303f8f86385 (diff)
Merge "Simplify handling of nested classes" into main
Diffstat (limited to 'api/coverage/tools')
-rw-r--r--api/coverage/tools/ExtractFlaggedApis.kt6
1 files changed, 3 insertions, 3 deletions
diff --git a/api/coverage/tools/ExtractFlaggedApis.kt b/api/coverage/tools/ExtractFlaggedApis.kt
index 5efda98a1518..bf67187f4bad 100644
--- a/api/coverage/tools/ExtractFlaggedApis.kt
+++ b/api/coverage/tools/ExtractFlaggedApis.kt
@@ -75,10 +75,10 @@ fun addFlaggedApi(builder: FlagApiMap.Builder, api: JavaMethod.Builder, flag: St
fun getClassFlag(classItem: ClassItem): String? {
var classFlag = getFlagAnnotation(classItem)
var cur = classItem
- // If a class is not an inner class, use its @FlaggedApi annotation value.
+ // If a class is not a nested class, use its @FlaggedApi annotation value.
// Otherwise, use the flag value of the closest outer class that is annotated by @FlaggedApi.
- while (cur.isInnerClass() && classFlag == null) {
- cur = cur.parent() as ClassItem
+ while (classFlag == null) {
+ cur = cur.containingClass() ?: break
classFlag = getFlagAnnotation(cur)
}
return classFlag