Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4745638

(spec) File javadoc should clarify alternate separator chars

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0_01
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux_redhat_7.2

      Description

      Javadoc here:

      http://java.sun.com/j2se/1.4/docs/api/java/io/File.html

      says:

      "When a pathname string is converted into an abstract pathname, the names within it may be separated by the default name-separator character or by any other name-separator character that is supported by the underlying system."

      How would you know what other name-separator characters are supported by the underlying system, if not separatorChar? What does that mean exactly?

      For the File(File,String) constructor:

      "Creates a new File instance from a parent abstract pathname and a child pathname string. [...] Otherwise each pathname string is converted into an abstract pathname and the child abstract pathname is resolved against the parent."

      [Probably "each pathname string" should read "each pathname string component".]

      So the semantics of this constructor depends on the meaning of the "other name-separator characters" mentioned in the class Javadoc.

      Specifically: on Windows, this works:

      new File(new File("C:\\"), "dir/subdir/file")

      to refer to C:\dir\subdir\file. Fine, but how would you know that this works based on the Javadoc? Or is it unspecified whether or not it will work? (Note that Windows itself does *not* accept '/' as a separator character.)

      IMHO either it should fail with an explanation, or it should be documented to work. Otherwise you create an implicit dependency on an implementation detail in countless JRE-based applications, and weaken the specification of the language.

      Wed Sep 11 12:48:23 MDT 2002 jg97958

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jglick Jesse Glick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: