Summary
Restore pre-JDK 9 behavior where the SourceFile attribute in the classfile was based on the user-provided file name, not on the canonical file name.
Problem
Consider example from the bug (JDK-8181897):
$ echo 'class Hello {}' > SOURCE $ ln -s SOURCE Hello.java JDK 8: javac Hello.java && javap -v Hello |& grep 'Compiled from' Compiled from "Hello.java" JDK 9: javac Hello.java && javap -v Hello |& grep 'Compiled from' Compiled from "SOURCE"
The SourceFile attribute is based on the real/canonical file name, instead of the user-provided name.
Solution
Restore the JDK 8 behavior, and use the user-provided file name as the basis for the SourceFile attribute.
Specification
The SourceFile attribute will be based on the user-provided file name, instead of the canonical file name.
- csr of
-
JDK-8181897 JDK 9 change to symlink handling affects SourceFile attributes
-
- Resolved
-