FULL PRODUCT VERSION :
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux host 4.11.6-1-ARCH #1 SMP PREEMPT Sat Jun 17 08:19:42 CEST 2017 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Under certain conditions, a protected nested class is not visible to a subclass of the outer class. Below is a console transcript demonstrating the issue. Changing the example to instead have B extend A<Integer> causes the example to compile successfully with javac.
$ cat A.java
package pkgA;
public class A<T> {
protected static class Nested {}
}
$ cat B.java
package pkgB;
import pkgA.A;
public class B extends A<B.NestedB> {
protected static class NestedB extends A.Nested {}
}
$ javac A.java B.java
B.java:6: error: Nested has protected access in A
protected static class NestedB extends A.Nested {}
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux host 4.11.6-1-ARCH #1 SMP PREEMPT Sat Jun 17 08:19:42 CEST 2017 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Under certain conditions, a protected nested class is not visible to a subclass of the outer class. Below is a console transcript demonstrating the issue. Changing the example to instead have B extend A<Integer> causes the example to compile successfully with javac.
$ cat A.java
package pkgA;
public class A<T> {
protected static class Nested {}
}
$ cat B.java
package pkgB;
import pkgA.A;
public class B extends A<B.NestedB> {
protected static class NestedB extends A.Nested {}
}
$ javac A.java B.java
B.java:6: error: Nested has protected access in A
protected static class NestedB extends A.Nested {}
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.