Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe822ece authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "check-flagged-apis: make interfaces inherit from java/lang/Object" into main

parents 0ea5497c aa41dac8
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -120,6 +120,26 @@ class CheckFlaggedApisTest {
    assertEquals(expected, actual)
  }

  @Test
  fun testParseApiSignatureInterfacesInheritFromJavaLangObject() {
    val apiSignature =
        """
          // Signature format: 2.0
          package android {
            @FlaggedApi("android.flag.foo") public interface Interface {
            }
          }
        """
            .trim()
    val expected =
        setOf(
            Pair(
                Symbol.createClass("android/Interface", "java/lang/Object", setOf()),
                Flag("android.flag.foo")))
    val actual = parseApiSignature("in-memory", apiSignature.byteInputStream())
    assertEquals(expected, actual)
  }

  @Test
  fun testParseFlagValues() {
    val expected: Map<Flag, Boolean> =
+5 −1
Original line number Diff line number Diff line
@@ -205,7 +205,11 @@ internal fun parseApiSignature(path: String, input: InputStream): Set<Pair<Symbo
            val symbol =
                Symbol.createClass(
                    cls.baselineElementId(),
                    cls.superClass()?.baselineElementId(),
                    if (cls.isInterface()) {
                      "java/lang/Object"
                    } else {
                      cls.superClass()?.baselineElementId()
                    },
                    cls.allInterfaces()
                        .map { it.baselineElementId() }
                        .filter { it != cls.baselineElementId() }