Will Java ever allow comments to nest?

Johannes Kuhn info at j-kuhn.de
Tue Jul 7 10:40:02 UTC 2020

This is a source incompatible change.

It would break /* inside comments:

      * Determines whether or not the tokenizer recognizes C-style comments.
      * If the flag argument is {@code true}, this stream tokenizer
      * recognizes C-style comments. All text between successive
      * occurrences of {@code /*} and <code>*/</code> are discarded.
      * <p>
      * If the flag argument is {@code false}, then C-style comments
      * are not treated specially.
      * @param   flag   {@code true} indicates to recognize and ignore
      *                 C-style comments.

That's the javadoc of StreamTokenizer.slashStarComments(boolean).
With your proposed change, the javadoc comment would not be closed at 
the end.

- Johannes

More information about the discuss mailing list