question about symlink handling

Liam Miller-Cushon cushon at
Wed Dec 7 20:36:19 UTC 2016

This is somewhat related to:

Starting in 9, javac uses canonical paths in isNameCompatible. So if a
source file is a symlink, it reports errors if the symlink target (rather
than the user-supplied path) doesn't match the public class name:

$ echo 'public class Hello {}' > SOURCE
$ ln -s SOURCE
$ javac error: class Hello is public, should be declared in a file

The diagnostic is confusing because it still uses the user-supplied path,
but I'm more interested in whether isNameCompatible should be using
canonical paths.

For what it's worth I prefer the previous behaviour, because our build
system uses symlinks extensively and the symlink target is a hash of the
content instead of a valid Java file name.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the compiler-dev mailing list