#18 null exception for early uplevel ref

open
nobody
5
2002-09-09
2002-09-09
Neal M Gafter
No

The pizza compiler fails this javac regression test

/*
* @test @(#)Closure1.java 1.3 02/01/24
* @bug 4030374
* @summary Initialization of up-level links,
immediately after super(), occurs too late.
* @author gafter
*
* @compile -target 1.4 Closure1.java
* @run main Closure1
*/

// Make sure the closure is present when the superclass
is constructed.
// Specifically, N must have its T.this initialized
when S calls hi().

public class Closure1 {
static class S {
void hi() { throw new Error(); }
S() { hi(); }
}
static class T {
void greet() { }
class N extends S {
void hi() {
T.this.greet();
}
}
}
public static void main(String av[]) { new T().new
N(); }
}

Discussion