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

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


On Mon, 11 Oct 2021 12:20:02 GMT, Christian Stein <cstein 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.

> Remove process method that takes 2 arguments?

Just checking ... what is the code path if someone uses just `-J` with no arg.

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.

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

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


More information about the compiler-dev mailing list