summaryrefslogtreecommitdiff
path: root/annotations/generate_annotated_java_files.py
diff options
context:
space:
mode:
authorPrzemyslaw Szczepaniak <pszczepaniak@google.com>2018-02-06 19:28:13 +0000
committerPrzemyslaw Szczepaniak <pszczepaniak@google.com>2018-02-14 15:46:03 +0000
commit841f853ac37a07fb7fa9c5598c84841f9858d9bf (patch)
tree63abff44f39fa7a637b24aeb266b0c42502e6953 /annotations/generate_annotated_java_files.py
parent526cd9137d3ac3b03f8045442ea39d970bda7e88 (diff)
Null annotations for java.lang.(Character|Byte)
Annotated Integer.java can be found at out/target/common/obj/JAVA_LIBRARIES/core-oj_intermediates/ annotated/java/lang/(Character|Byte).java + Updated generate_annotated_java_files.py to correctly handle nested classes. Test: make docs Bug: 64930165 Change-Id: Icda613b60a406f0bc5e127a12e0916ddd6542d04
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
-rwxr-xr-xannotations/generate_annotated_java_files.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/annotations/generate_annotated_java_files.py b/annotations/generate_annotated_java_files.py
index de8b131da6..2f12eea105 100755
--- a/annotations/generate_annotated_java_files.py
+++ b/annotations/generate_annotated_java_files.py
@@ -15,7 +15,7 @@ BP_TEMPLATE = '''filegroup {
],
}'''
-srcs_list = []
+srcs_list = set()
current_package = None
with open(os.sys.argv[1], 'r') as jaif_file:
for line in jaif_file:
@@ -23,7 +23,13 @@ with open(os.sys.argv[1], 'r') as jaif_file:
current_package = line[len(PACKAGE_STRING): line.find(':')]
if line.startswith(CLASS_STRING) and current_package is not None:
current_class = line[len(CLASS_STRING): line.find(':')]
- srcs_list.append(SRC_PREFIX + current_package.replace('.', '/') + '/' + current_class + '.java')
+
+ # In case of nested classes, discard substring after nested class name separator
+ nested_class_separator_index = current_class.find('$')
+ if nested_class_separator_index != -1:
+ current_class = current_class[:nested_class_separator_index]
+
+ srcs_list.add(SRC_PREFIX + current_package.replace('.', '/') + '/' + current_class + '.java')
print '// Do not edit; generated using libcore/annotations/generate_annotated_java_files.py'
print BP_TEMPLATE % ('\n'.join([' "' + src_entry + '",' for src_entry in sorted(srcs_list)]),)