Raymond said:
John C. Bollinger wrote:
It is inconsistent with the definition of the word canonical. A
canonical form should be unique.
I'll make that stronger: a canonical form *must* be unique. The
canonicalization algorithm used by a Java implementation meets this
criterion or it is broken. The issue, though, is the definition of
"unique" in the problem domain. On UNIXen, and perhaps other systems,
whether or not two pathnames refer to the same inode is not a relevant
criterion for this decision, as File objects have nothing whatsoever to
do with inodes, and have only an arm's-length relationship with any file
referred to by the *path* they represent -- if, indeed, there even is
such a file. Canonicalization is relative to the node in a hierarchical
filesystem tree represented by a File, and how or whether that
corresponds to any actual data is not relevant.
Do read the class-level docs of java.io.File if you haven't before. The
class is somewhat misnamed, IMO, and it's important to this discussion
to have a firm grasp of what it actually represents. (As I wrote in a
previous post, that's a path, not the actual file referred to by a path.)