RFR: 8296420: javac has long lines in its command-line help

Jonathan Gibbons jjg at openjdk.org
Tue Apr 4 17:40:08 UTC 2023


On Tue, 4 Apr 2023 16:16:51 GMT, Archie L. Cobbs <duke at openjdk.org> wrote:

> The issue states that the output of `javac --help` and `javac --help-extra` should not overflow 80 columns.
> 
> This patch updates `javac.properties` to add newlines, etc. to address this issue, and adds a regression test.

Nice work; nice test!

One optional suggestion to improve the test.

src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties line 102:

> 100:     Options to pass to annotation processors
> 101: javac.opt.implicit=\
> 102:     Specify whether or not to generate class files\n\

There's been a lot of discussion (elsewhere) of late regarding the phrase _whether or not_.
Generally, the consensus seems to be that the correct form in cases like this is just _whether_ and that _whether or not_ idiomatically means something else.   With that in mind, I'd suggest dropping _or not_ and then see how that affects the needs for any line-wrapping.

src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties line 335:

> 333:     are found for an implicitly compiled class
> 334: javac.opt.preview=\
> 335:     Enable preview language features. To be used in conjunction\n\

I'd consider breaking "early", after the initial period.

test/langtools/tools/javac/options/HelpOutputColumnWidthTest.java line 88:

> 86:         if (tooLongLine != null)
> 87:             throw new Exception("output line too long: \"" + tooLongLine.trim() + "\"");
> 88:     }

This is good. It would be even better if you removed `findFirst` and then reported all the lines if the resulting list is non-empty.

-------------

Marked as reviewed by jjg (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13329#pullrequestreview-1371473526
PR Review Comment: https://git.openjdk.org/jdk/pull/13329#discussion_r1157564897
PR Review Comment: https://git.openjdk.org/jdk/pull/13329#discussion_r1157567049
PR Review Comment: https://git.openjdk.org/jdk/pull/13329#discussion_r1157569385


More information about the compiler-dev mailing list