question about symlink handling
Liam Miller-Cushon
cushon at google.com
Tue Apr 4 00:07:30 UTC 2017
I filed https://bugs.openjdk.java.net/browse/JDK-8178017 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 google.com>
wrote:
> This is somewhat related to: http://mail.openjdk.java.net/
> 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 Hello.java
> $ javac Hello.java
> Hello.java:1: error: class Hello is public, should be declared in a file
> named Hello.java
>
> 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: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20170403/ea6c3002/attachment.html>
More information about the compiler-dev
mailing list