diff options
author | Pete Gillin <peteg@google.com> | 2018-06-26 18:33:50 +0100 |
---|---|---|
committer | Pete Gillin <peteg@google.com> | 2018-06-26 18:45:48 +0100 |
commit | 871d81d828b1e8840117fc2d72d392241a48b311 (patch) | |
tree | 6420d9ecaf8611bc89bb342f5363aa25bd34bac3 /annotations/generate_annotated_java_files.py | |
parent | 460784a97f8505c0b7bc738492e305a4ea1298b5 (diff) |
Fix a bug in ojluni.jaif for HashMap.entrySet().
Prior to this change, `make docs` or just `make
metalava-api-stubs-docs` was giving the warnings about not being able
to apply three annotations[1], and inspecting the
ojluni_jaif_annotated_srcs.srcjar showed that those annotations
mentioned were missing from the generated annotated source. With this
change, the warnings go away, and the annotations are correct in the
generated annotated source.
The previous ojluni.jaif fragment was produced by running the CF
extract-annotations tool, but it is incorrect. In the declaration
public Set<Map.Entry<K,V>> entrySet()
the path `inner-type 3, 0` refers to the `Map`, not to the
`Map.Entry`; you need `inner-type 3, 0, 1, 0` to refer to the
`Map.Entry`. See the definition of the type-path production in the
JAIF spec[2] for details.
[1] These are the warnings:
Found class java.util.HashMap, but unable to insert @libcore.util.NonNull:
@libcore.util.NonNull (nl=false) @ {GENERIC_ARRAY_LOCATION=GenericArrayLocationCriterion at ( [TYPE_ARGUMENT(0)] ), RETURN_TYPE=ReturnTypeCriterion for method: entrySet()Ljava/util/Set;, IN_METHOD=in method 'entrySet()Ljava/util/Set;', IN_CLASS=In class 'java.util.HashMap' (exactly)}
Found class java.util.HashMap, but unable to insert @libcore.util.NullFromTypeParam:
@libcore.util.NullFromTypeParam (nl=false) @ {GENERIC_ARRAY_LOCATION=GenericArrayLocationCriterion at ( [TYPE_ARGUMENT(0), TYPE_ARGUMENT(0)] ), RETURN_TYPE=ReturnTypeCriterion for method: entrySet()Ljava/util/Set;, IN_METHOD=in method 'entrySet()Ljava/util/Set;', IN_CLASS=In class 'java.util.HashMap' (exactly)}
Found class java.util.HashMap, but unable to insert @libcore.util.NullFromTypeParam:
@libcore.util.NullFromTypeParam (nl=false) @ {GENERIC_ARRAY_LOCATION=GenericArrayLocationCriterion at ( [TYPE_ARGUMENT(0), TYPE_ARGUMENT(1)] ), RETURN_TYPE=ReturnTypeCriterion for method: entrySet()Ljava/util/Set;, IN_METHOD=in method 'entrySet()Ljava/util/Set;', IN_CLASS=In class 'java.util.HashMap' (exactly)}
[2] https://checkerframework.org/annotation-file-utilities/annotation-file-format.html
Test: `make metalava-api-stubs-docs` and inspect ojluni_jaif_annotated_srcs.srcjar
Bug: 109869600
Change-Id: Ia923fd352b8ce510be344844a4409d090faf82a8
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions