RFR: 8357862: Java argument file is parsed unexpectedly with trailing comment [v2]

David Beaumont duke at openjdk.org
Wed Jun 11 11:44:29 UTC 2025


On Wed, 11 Jun 2025 08:30:18 GMT, Christian Stein <cstein at openjdk.org> wrote:

>> Please review this fix to correctly parse tokens in an argument file that contains trailing comments without preceding whitespace characters before the '#' comment marker, the number sign.
>> 
>> The specifaction of the `java` Command has in section [java Command-Line Argument Files](https://docs.oracle.com/en/java/javase/12/docs/specs/man/java.html#java-command-line-argument-files):
>> 
>> Use the number sign `#` in the argument file to identify comments.
>> All characters following the `#` are ignored until the end of line.
>> 
>> There is not requirement specified to prepend a comment in a line with at least one argument with one or more preceding whitespace characters.
>
> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Extract shared function to compute current token

test/jdk/tools/launcher/ArgFileSyntax.java line 177:

> 175:         },
> 176:         { // multiple args in one line and comments without preceding whitespace
> 177:             { "-Xmx32m -XshowSettings#COMMENT 1",

First case feels like a duplicate of the test at line 73. What's different?
Maybe this case should just live next to that?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25589#discussion_r2139921427


More information about the core-libs-dev mailing list