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

SimpleFileObject inconsistency between getName and getShortName

XMLWordPrintable

    • b13

        SimpleFileObject overrides getName() to use the user path, but inherits the default implementation of getShortName() which uses a canonical path. Is this inconsistency deliberate?

        Demo:

        $ cat A.java
        public class B {
          int f() {}
        }
        $ ln -s A.java B.java

        # the raw diagnostic formatter uses getShortName(), which uses the canonical path A.java

        $ javac -XDrawDiagnostics B.java
        A.java:2:12: compiler.err.missing.ret.stmt
        1 error

        # the default diagnostic formatter uses getName(), which uses the user path B.java

        $ javac B.java
        B.java:2: error: missing return statement
          int f() {}
                   ^
        1 error

              cushon Liam Miller-Cushon
              cushon Liam Miller-Cushon
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: