diff options
author | Tobias Thierer <tobiast@google.com> | 2020-01-09 23:52:21 +0000 |
---|---|---|
committer | Tobias Thierer <tobiast@google.com> | 2020-01-10 14:28:21 +0000 |
commit | 4effc4b64a1070279acc2e97c5c6f85b88dbd476 (patch) | |
tree | a0546e65dc14d5eefc3ab2d6d52a92e8e7e561de /tools/hiddenapi | |
parent | a9298cc06f00efcad0386aa7b142dc735946a352 (diff) |
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
Diffstat (limited to 'tools/hiddenapi')
-rwxr-xr-x | tools/hiddenapi/generate_hiddenapi_lists.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/hiddenapi/generate_hiddenapi_lists.py b/tools/hiddenapi/generate_hiddenapi_lists.py index 46105f4d66b0..0b2077d9bba0 100755 --- a/tools/hiddenapi/generate_hiddenapi_lists.py +++ b/tools/hiddenapi/generate_hiddenapi_lists.py @@ -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: |