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

Can't find class which is declared in a superclass

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      javac 1.8.0_141

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.10586]

      A DESCRIPTION OF THE PROBLEM :
      The attached program can't find E, which is a class in an interface which extends another interface in the outer class' superclass. JDK 9 and Eclipse compiles this fine.

      This seems similar to JDK-7177814, but that relates more to import statements.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the attached files.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The compilation succeeds.
      ACTUAL -
      Compilation fails.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      javac -sourcepath src/main/java/ -d bin src/main/java/c/C.java
      src\main\java\c\C.java:12: error: cannot find symbol
              public interface D extends B {
                                         ^
        symbol: class B
        location: class C
      1 error


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ==== a/A.java ====

      package a;

      import java.util.EventListener;

      public abstract class A {
      public interface B extends EventListener {
      public void changedEvent(A a);
      }
      }

      ==== c/C.java ====

      package c;

      import c.C.D.E;
      import a.A;

      public abstract class C extends A {

      public void f() {
      new E();
      }

      public interface D extends B {
      public static class E {
      }
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Change "new E()" to "new D.E", and remove "import c.C.D.E".

            fmatte Fairoz Matte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: