Menu ▾ ▴

#32 incorrect outer instance (4)

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

The Pizza compiler fails the following javac regression
test

/**
* @test @(#)WhichImplicitThis4.java 1.1 02/06/04
* @bug 4696701
* @summary wrong enclosing instance for local class
creation
*
* @compile WhichImplicitThis4.java
* @run main WhichImplicitThis4
*/

public class WhichImplicitThis4 {
boolean isCorrect() { return true; }
void check() {
class I2 {
I2() {
if (!isCorrect()) throw new Error();
}
}
class I3 extends WhichImplicitThis4 {
boolean isCorrect() { return false; }
public void check() {
new I2() {
/*
<init>() {

(WhichImplicitThis4.this).super();
}
*/
};
}
}
new I3().check();
}
public static void main(String[] args) {
new WhichImplicitThis4().check();
}
}

Discussion


Log in to post a comment.