question about symlink handling

Liam Miller-Cushon cushon at
Tue Apr 4 00:07:30 UTC 2017

I filed for this.

Would you consider taking a patch to restore the JDK 8 behaviour? The idea
would be to use the userPath in SimpleFileObject#getShortName, and then use
that definition of getShortName in getKind and isNameCompatibleWith.

On Wed, Dec 7, 2016 at 12:36 PM, Liam Miller-Cushon <cushon at>

> This is somewhat related to:
> pipermail/compiler-dev/2016-November/010544.html
> 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
> named
> 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