question about symlink handling

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


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/20161207/cd79d725/attachment.html>


More information about the compiler-dev mailing list