RFR: 8272728: javac ignores any -J option in @argfiles silently
Christian Stein
cstein at openjdk.java.net
Tue Oct 12 14:22:03 UTC 2021
On Mon, 11 Oct 2021 14:52:39 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> Make javac error on `-J` being present in `@argfiles` or other locations, where the launcher didn't process and remove them.
>
> 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?
-------------
PR: https://git.openjdk.java.net/jdk/pull/5891
More information about the compiler-dev
mailing list