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

Commit 4effc4b6 authored by Tobias Thierer's avatar Tobias Thierer
Browse files

Make extract_package() work for toplevel classes.

Before this CL, classes in the unnamed package, such as

L$r8$backportedMethods$utility$Objects$2$checkIndex

(which looks like it is generated by R8 for Objects.checkIndex() calls)
were breaking the build because extract_package was incorrectly assuming
that there would always be a '/' in the identifier string.

Test: Build that previously broke is now working.

Change-Id: Ice78d6b31c4f38a3c9d529bc6156d625d19bcacf
parent a9298cc0
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -149,7 +149,12 @@ def extract_package(signature):
        The package name of the class containing the field/method.
    """
    full_class_name = signature.split(";->")[0]
    package_name = full_class_name[1:full_class_name.rindex("/")]
    # Example: Landroid/hardware/radio/V1_2/IRadio$Proxy
    if (full_class_name[0] != "L"):
        raise ValueError("Expected to start with 'L': %s" % full_class_name)
    full_class_name = full_class_name[1:]
    # If full_class_name doesn't contain '/', then package_name will be ''.
    package_name = full_class_name.rpartition("/")[0]
    return package_name.replace('/', '.')

class FlagsDict: