The following test case, fails to compile cleanly as it should. Perhaps this is
due to the lookup finding the private one hiding the one from the enclosing scope.
See also 4717593.
/**
* @test @(#)WhichImplicitThis6.java 1.1 02/07/19
* @bug 4717633
* @summary compiler fails to allow access to enclosing instance in super()
*
* @compile WhichImplicitThis6.java
*/
class WhichImplicitThis6 {
private int i;
WhichImplicitThis6(int i) {}
class Sub extends WhichImplicitThis6 {
Sub() {
super(i); // i is not inherited, so it is the enclosing i
}
}
}
due to the lookup finding the private one hiding the one from the enclosing scope.
See also 4717593.
/**
* @test @(#)WhichImplicitThis6.java 1.1 02/07/19
* @bug 4717633
* @summary compiler fails to allow access to enclosing instance in super()
*
* @compile WhichImplicitThis6.java
*/
class WhichImplicitThis6 {
private int i;
WhichImplicitThis6(int i) {}
class Sub extends WhichImplicitThis6 {
Sub() {
super(i); // i is not inherited, so it is the enclosing i
}
}
}