RFR v2 - 8027634: Support @argfiles for java command-line tool

Henry Jen henry.jen at oracle.com
Fri Jul 17 23:48:38 UTC 2015

Thanks Mandy and Magnus for looking into the patch, and feedbacks from Kumar Srinivasan and Michel Trudeau.

We have an updated version to be reviewed at,


This version changes the syntax a little bit as following, but pretty much still javac compatible,

1) Whitespace characters are ‘ ‘, ‘\t’. ‘\n’ and ‘\r’, not everything from ‘\0\ to ‘ ‘.
2) Open quote still stop at EOL unless ‘\’ is the last character, which will join the next line by removing leading white spaces. This allows multiple line supports in quote. If leading space is significant, add ‘\’ to escape the white space character.
3) Escape sequences is now only limited to ‘\n’ and ‘\r’. No octal character support.

In terms of javac compatibility, unless octal or \a\b\f\t\v escaping sequence are used, they should be completely compatible. 

I don’t have plan to remove the test as it would be convenient to have it around. Move it into a separate test is probably desirable, though. I am not sure about what is a better place, seems to me test inside implementation file is quite common as in wildcard.c and cmdtoargs.c.


> On Jul 15, 2015, at 7:51 AM, Mandy Chung <mandy.chung at oracle.com> wrote:
>> On Jul 10, 2015, at 11:48 AM, Henry Jen <henry.jen at oracle.com> wrote:
>> Hi,
>> Please review proposed patch for JDK-8027634[1]. This patch is to enable java support command line argument file like javac does. The implementation use the same syntax rule, which is implemented in CommandLine.java[3] with java.io.StreamTokenizer.
>> Some early comment is that we probably don’t need such complexity to support same syntax, also require to quote whole token is a little inconvenient. For example, must be -cp “c:\\foo bar\\lib;c:\\lib” instead of -cp c:\”foo bar”\lib;c:\lib.
>> I am debating if such compatibility is necessary useful, after all, easy and intuitive is more important, and with simpler rule, the implementation will be cleaner as well.
> I have a slight preference to maintain consistent syntax as javac @argfile support in terms of the quotation.  A user could use the same path specified in -cp for both javac @argfile an java @argfile use.
> I skimmed on the webrev and looks okay to me.  I’ll leave it for Kumar to do detailed review.  One minor comment:
> args.c
>   Are you planning to remove the test within #ifdef DEBUG_ARGFILE block?
> thanks
> Mandy

More information about the core-libs-dev mailing list