JDK 9 change to symlink handling affects SourceFile attributes

XMLWordPrintable

    • Type: CSR
    • Resolution: Approved
    • Priority: P4
    • 10
    • Component/s: tools
    • None
    • minimal
    • File or wire format

      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):

      <pre> $ 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" </pre>

      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.

            Assignee:
            Jan Lahoda
            Reporter:
            Liam Miller-Cushon
            Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: