Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8182871

JDK 9 change to symlink handling affects SourceFile attributes

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 10
    • tools
    • None
    • minimal
    • File or wire format

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: