Menu

#29 incorrect outer instance

open
nobody
5
2002-09-09
2002-09-09
No

The Pizza compiler fails the following javac regression
test...

/**
* @test @(#)WhichImplicitThis1.java 1.1 02/06/04
* @bug 4635044
* @summary Invalid error when implicitly referencing
enclosing type
*
* @compile WhichImplicitThis1.java
* @run main WhichImplicitThis1
*/

/** Check that non-inheritance (private) prevents
enclosing class selection. */
public class WhichImplicitThis1 {
boolean isT() { return true; }
private class Middle extends WhichImplicitThis1 {
boolean isT() { return false; }
boolean enclIsT() { return
WhichImplicitThis1.this.isT(); }
class Inner {}
boolean check() {
return /*WhichImplicitThis1.this.*/new
WhichImplicitThis1.Middle().enclIsT();
}
}
public static void main(String[] args) {
WhichImplicitThis1 t = new WhichImplicitThis1();
Middle m = t.new Middle();
if (!m.check()) throw new Error();
}
}

Discussion


Log in to post a comment.