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

Iterating over elements of a Scope can return spurious inner class elements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • tools
    • b131
    • Verified

      This problem has been discovered in the context of Valhalla. Altering the way in which inner classes are laid out inside the InnerClasses attribute results in visible changes in the way jshell suggests completions.

      The attached test case reproduces the problem without valhalla - a simple JDK 9 repo is required to compile and run the test.

      The test attempts to list all elements available from the scope of a fake class which imports java.util.concurrent; surprisingly, the following members are also returned:

      java.util.concurrent.CompletableFuture.AsynchronousCompletionTask
      java.lang.Thread.State
      java.lang.ProcessBuilder.Redirect.Type
      java.lang.Character.UnicodeScript
      java.lang.Character.UnicodeBlock
      java.lang.Character.Subset

      These are nested classes and should not be listed.

      If the list process is repeated twice, the problem disappears.

            jlahoda Jan Lahoda
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: