RFR: 8272728: javac ignores any -J option in @argfiles silently

Jonathan Gibbons jjg at openjdk.java.net
Tue Oct 12 14:22:03 UTC 2021


On Mon, 11 Oct 2021 14:56:29 GMT, Christian Stein <cstein at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java line 518:
>> 
>>> 516:             String message = "-J is not valid here (e.g. in an @argfile): pass -J"
>>> 517:                 + arg
>>> 518:                 + " arguments directly to the launcher";
>> 
>> The suggestion to pass `-J` args directly to the launcher may not apply in all cases ... it only applies when invoking tools, not when running the JVM.   But generally, throwing `InvalidValueException` seems like the right way to go.
>
> Okay. Which one do you prefer?
> 
> - `"-J is not valid here (e.g. in an @argfile)"` without the actual argument or
> - `"-J%s is not valid here (e.g. in an @argfile)".formatted(arg)` with the actual argument included?

Also, we tend not to use Latin contractions like `e.g.` and `i.e.` -- use the English equivalent, or avoid the need altogether.

Note that arg-files are not the only way to tunnel `-J` options into `javac`, so that may be another reason to generalize the message and make it less specific.   For example, `-J is not valid here; pass JVM options directly to the launcher.`

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

PR: https://git.openjdk.java.net/jdk/pull/5891


More information about the compiler-dev mailing list