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

DocTrees.getElement returns a package when none is expected or defined

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 20
    • tools
    • None
    • macOS Monterey 12.6 (21G115)

      Consider this example used to test JavaDoc:

          package x;

          public class Parent {

              /** @throws X sometimes */
              public <X extends Throwable> void m() throws X { }
          }
          
          ...
          
          package x;

          public class Child extends Parent {

              /** @throws X {@inheritDoc} */
              @Override
              public void m() { }
          }

      When asked for an element corresponding to a doc path pointing at `X` in "@throws X sometimes", the DocTrees.getElement methods returns a package element with the name `X`.

      If either the package `x` or the "type parameter" `X` gets renamed to a unique identifier, that method returns `null` as one would expect it to.

      Since this bug can only be reproduced on macOS, I have a suspicion that it's due to the filesystem (APFS) being case-insensitive and/or case-preserving.

      On Linux and Windows DocTrees.getElement for the above case returns null.

            Unassigned Unassigned
            prappo Pavel Rappo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: