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

Incomplete classpath causes infinite recursion in Resolve.isAccessible

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u161, 9
    • Fix Version/s: 11
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b07

      Description

      === Lib.java
      import java.util.Optional;

      abstract class B {
        abstract <M> Optional<M> g(F<M> p);
      }

      interface F<M> {
        M u(A o);
      }

      interface A {
        <T> T v(Class<? extends T> o);
      }
      === Test.java
      abstract class Test {
        class Two {}

        class One {}

        abstract Two f(One proto);

        Two test(B o) {
          return f(o.g((x) -> x.v(One.class)).get());
        }
      }
      ===

      $ javac -fullversion
      javac full version "10-ea+41"
      $ javac *.java;
      $ rm A.class;
      $ javac -sourcepath : Test.java
      ...
      Test.java:9: error: cannot access A
                      return f(o.g((x) -> x.v(One.class)).get());
                                   ^
        class file for A not found
      1 error


      The system is out of resources.
      Consult the following stack trace for details.
      java.lang.StackOverflowError
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:321)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:384)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:361)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:384)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:361)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:384)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jlahoda Jan Lahoda
              Reporter:
              cushon Liam Miller-Cushon
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: