Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8345272

Improve rules for line wraps in signatures

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • 11
    • tools
    • None

      JavaDoc uses various HTML and CSS features to control how signatures can be wrapped if their content overflows the available space. Unfortunately, the feature has degraded over time as signature generating code has been added or changed without taking line wrapping into consideration.

      For example, we us non-breaking-space between parameter type and parameter name so that parameters are kept kept on a single line, but we don't use non-breaking space for bounded type parameters/wildcards, so if a method parameter has a bounded parameter type line wrapping can and typically will occur there (and this is a much worse place than between parameter type and name).

      Another problem is that the "?" character in wildcards as a punctuation mark is considered a place where line wraps are allowed, leading to `<?>` to be wrapped after the question mark. This is also one of the worst places to wrap a type signature.

      Other minor issues are the use of non-breaking space in method signatures between modifiers, type parameters and return type. While these pleaces usually don't require line wrapping there are very long signatures that do.

            hannesw Hannes Wallnoefer
            hannesw Hannes Wallnoefer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: