RFR: JDK-8242056,Merge support for AnnotationType builders/writers into support for other types
Jonathan Gibbons
jonathan.gibbons at oracle.com
Thu Apr 2 20:37:17 UTC 2020
Please review a mostly-cleanup change to merge support for annotation
types into the support for other types, like classs, interfaces, enums,
and records. Apart from some very small changes, there should be no
visible difference to any generated documentation.
At the high level this means moving annottaion-type-specific
functionality, i.e. for required and optional elements, from
AnnotationType{Builder,Writer,WriterImpl} to
Class{Builder,Writer,WriterImpl} so that the annotation-type classes can
be deleted.
A bonus is that what was previously treated as ANNOTATION_FIELD is
really the same as FIELD, and so the
AnnotationTypeField{Builder,Writer,WriterImpl} classes can be removed as
well.
The changes are mostly moving or deleting code. There are some minor
exceptions:
* In VisibleMemberTable, we more accurately determine the kind of fields
and methods in annotation types, and suppress the methods inherited from
java.lang.Annotation, which otherwise show up in the "inherited methods"
summary.
* In ClassWriterImpl, we suppress writing out the extends/implements
clauses for annotation types. Also, there is one minor notatable
difference that for annotation types, an additional "id" is declared on
the details section. This "id" is referenced by the annotation-type
support in the navbar. Maybe this could be cleaned up later; for now it
seems better to minimize the changes in the generated code.
* In various places, references to ANNOTATION_TYPE_FIELDS is changed to
FIELDS
* In various places, signatures referencing AnnotationTypeBuilder and
friends were updated to use ClassBuilder and friends.
Tests: 3 tests need to be updated.
1. TestAnnotationTypes is updated for the ANNOTATET_TYPE_FIELD to FIELD
rename. It seems perverse to retain the old behavior.
2. Bug fix: the old code incorrectly used CSS class "member-name-label"
when the more appropriate name is "type-name-label".
3. TestMetadata.java is updated to indicate that
AnnotationTypeWriterImpl no longer writes out any pages (because it has
been deleted.)
There are some potential downstream enhancements, for later:
* Improve the reporting of annotation type member elements in the static
A-Z index. Right now, they're reported as "methods".
* Verify that nested types are now properly handled in annotation types.
(And maybe anno types in regular classes)
* Improve the navigation (i.e. top nav bar) to nested types in
annotation types.
-- Jon
JBS: https://bugs.openjdk.java.net/browse/JDK-8242056
Webrev: http://cr.openjdk.java.net/~jjg/8242056/webrev.00/
API: http://cr.openjdk.java.net/~jjg/8242056/api.00/
More information about the javadoc-dev
mailing list