Hei,

I ran into this writing a build tool that drives the JDK tools in process
rather than forking them. javac, javadoc, jar, jpackage and jnativescan all
expand @argfiles when invoked through ToolProvider. jlink does not, and
fails with "Error: invalid argument: @file". The bin/jlink launcher expands
them fine, so the difference only shows up on the in-process path, which is
presumably why it has gone unnoticed.

I know this is JDK-8225560, closed as Won't Fix in December 2021, on the
grounds that Java-side expansion cannot support -J options and that jlink
users are likely to have those in their argfiles.

What prompts the question is JDK-8236919, which landed in 20, after that
decision was made. CommandLine now lives in jdk.internal.opt, and JlinkTask
already imports it for the saved-options resource. JDK-8275072 was closed
Won't Fix as well, but that one asked for public API on ToolProvider, which
is not needed here.

So: is normalizing this still out of scope, or would a change be considered
if it handled -J explicitly, say by expanding in JlinkTask.run and
rejecting any -J that comes out of a file with a message saying why? I am
happy to hear that the inconsistency is the lesser evil. Mostly I would
like to know whether it is settled, so I can stop wondering whether to keep
a note for possible future change on this.

Thanks, Rafael

Reply via email to