RFR: 8214126: Method signatures not formatted correctly in browser
Hannes Wallnöfer
hannes.wallnoefer at oracle.com
Tue May 28 14:04:29 UTC 2019
Please review:
Issue: https://bugs.openjdk.java.net/browse/JDK-8214126
Webrev: http://cr.openjdk.java.net/~hannesw/8214126/webrev.02/
This changes the formatting of member signatures to use individual spans and CSS classes for different parts of the signature, making use of the „display“ and „white-space“ CSS properties. This allows as to adapt display depending on the properties of the signature. In above webrev, there are two such adaptations:
- If the combined length of modifier, type parameters, and return type of a method signature exceeds 50 characters, a line break is inserted between the modifier/type parameters and the return type. See [1] for an example.
- If the length of the type parameter span alone exceeds 50 characters, individual type parameter elements are separated by a line break instead of being displayed in a single line. This does never occur in JDK API, see [2] for a contrived example.
[1]: http://cr.openjdk.java.net/~hannesw/8214126/docs/api/java.base/java/util/stream/Collectors.html#toConcurrentMap(java.util.function.Function,java.util.function.Function,java.util.function.BinaryOperator,java.util.function.Supplier)
[2]: http://cr.openjdk.java.net/~hannesw/8214126/docs2/vavr/Try.html#withResources(vavr.Try.CheckedFunction0,vavr.Try.CheckedFunction0,vavr.Try.CheckedFunction0,vavr.Try.CheckedFunction0)
From an implementation side, I created a new HtmlTree subclass called MemberSignatureTree as an inner class of AbstractMemberWriter that implements the display policies listed above. It is used by all member signature writers, simplifying the #getSignature methods in various MemberWriter classes quite a bit.
You can browse the complete JDK API docs generated with this webrev here:
http://cr.openjdk.java.net/~hannesw/8214126/docs/api/index.html
Thanks,
Hannes
More information about the javadoc-dev
mailing list