JDK-8186962 : Can't find class which is declared in a superclass
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2017-08-29
  • Updated: 2017-08-30
  • Resolved: 2017-08-30
Related Reports
Duplicate :  
Description
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".


Comments
This is known issue which has been already fixed in 9 ea b42 possibly a duplicate of 7177813 Below are the results 8u141 - Fail 8u144 - Fail 8u152 - Pass 9 ea b41- Fail 9 ea b42 - Pass 9 ea b181 - Pass
30-08-2017