summaryrefslogtreecommitdiff
path: root/annotations/generate_annotated_java_files.py
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2019-05-13 12:20:55 +0100
committerPaul Duffin <paulduffin@google.com>2019-05-14 09:32:25 +0100
commit16a057f0c8ed4f7212043615228da9311760850a (patch)
tree59eaee1020b7471f97ea7253f0275ef76445001e /annotations/generate_annotated_java_files.py
parent287d9b5a379c532f03393d0411aca55b37ecf895 (diff)
Fix tests broken by D8's handling of class retention annotations
A recent change to the dexer (see b/130028992) caused it to discard class retention annotations from the generated dex code. That broke the testRetentionPolicy_targetSdkVersion_23 test in the libcore.j.l.reflect.annotations.AnnotationsTest class which was testing to ensure that class retention annotations were visible to APKs that target <= 23. This change extracts the annotations and annotated classes used by the affected test into their own JAR that is built using the --intermediate option which prevents the class retention annotations from being discarded. That JAR is then included in core-tests as a resource. The retention policy tests extract the resource into its own file, creates a PathClassLoader for it and then loads the test classes and annotations from there. Rather than extract the resource and create the PathClassLoader for each test this uses JUnit 4 mechanisms to extract the resource once for the whole class. The retention policy test methods were extracted into their own class to minimize the change from switching to JUnit 4 and to minimize the lifespan of the PathClassLoader. Bug: 132100102 Test: atest \ CtsLibcoreTestCases:libcore.java.lang.reflect.annotations.RetentionPolicyTest \ CtsLibcoreTestCases:libcore.java.lang.reflect.annotations.AnnotationsTest Change-Id: I67d46b9094d2da94c9cb02da9f0b2c619d0b5cdb
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions