check-flagged-apis: skip self-referential interfaces

The return value of ClassItem.allInterfaces will sometimes include the
interface itself (e.g.
android.accessibilityservice.BrailleDisplayController). It is unclear
when this happens; it doesn't happen for the unit test.

Update the logic to record the interfaces for a class to filter out
interfaces named the same as the class.

Bug: 334870672
Test: atest --host check-flagged-apis-test
Test: croot && ./build/tools/check-flagged-apis/check-flagged-apis.sh
Change-Id: I8d93c230dfedde30e8d43fefd560a47944085d3a
This commit is contained in:
Mårten Kongstad
2024-05-06 16:26:40 +02:00
parent 7c3571fe8b
commit 04d8b46c37

View File

@@ -198,7 +198,10 @@ internal fun parseApiSignature(path: String, input: InputStream): Set<Pair<Symbo
val symbol =
Symbol.createClass(
cls.baselineElementId(),
cls.allInterfaces().map { it.baselineElementId() }.toSet())
cls.allInterfaces()
.map { it.baselineElementId() }
.filter { it != cls.baselineElementId() }
.toSet())
output.add(Pair(symbol, flag))
}
}