Unclear docs regarding escaping of Windows paths.

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Jan 10 21:44:50 UTC 2019


I've filed JDK-8216522 [1] to track this general issue.

For JDK 9 onward, the syntax rules in this area come down to:

* outside of quotes, the backslash character has no special meaning and 
is treated literally

* inside quotes, the backslash character is an escape character, and 
must be doubled to pass through a backslash character.

As an example, the following are equivalent

    C:\Users\me\myfile.java

    "C:\\Users\\me\\myfile.java"


Likewise the following are equivalent

    C:\Program" "Files\myfile.java

    "C:\\Program Files\\myfile.java"

So, in terms of specifying paths, you only need to be careful if tyhe 
path contains whitespace characters.


-- Jon


[1]: https://bugs.openjdk.java.net/browse/JDK-8216522



On 01/07/2019 03:46 AM, Thorsten Schöning wrote:
> Guten Tag Jonathan Gibbons,
> am Freitag, 4. Januar 2019 um 00:19 schrieben Sie:
>
>> The change that you noted in the URIs is just a side-effect of internal
>> changes in the way that the documentation was generated. We removed the
>> documentation for the old implementation from 9, and it is a bug that we
>> did not get to update it with a reference to the new syntax, as
>> described for the Java launcher in [1].
> Do you take care of creating a bug adding such a reference? [1] make
> some points a lot more clear and is actually what I hoped to find. So
> thanks for that.
>
>> Please also note that the handling of command-line arguments is
>> different from the handling of the contents of argument files.[...]
> My link is explicitly mentioning argument files:
>
>> Examples
>> Single Argument File[...]
>> Two Argument Files
> https://docs.oracle.com/en/java/javase/11/javadoc/javadoc-command.html#GUID-EFE927BC-DB00-4876-808C-ED23E1AAEF7D
>
> And the example for Windows contains the following:
>
>> -overview \java\jdk9\docs\api\overview-summary.html
>> -sourcepath \java\
> Which uses unescaped backslashs and should be a bug as per your linked
> [1]. Am I wrong or do you take care of that as well or should I add
> some bug somewhere or ...?
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/javadoc-dev/attachments/20190110/cd1bb541/attachment.html>


More information about the javadoc-dev mailing list