/*
Jikes and javac both compile this such that the null check is performed
in C$1, AFTER the increment, so the output is 2. However, 15.9.4
states that the null check occurs first, so the output is required
to be 1.
*/
class C {
class Inner {
Inner(int i) {}
}
public static void main(String[] args) {
int i = 1;
try {
C c = null;
c.new Inner(i++) {};
} catch (NullPointerException e) {
System.out.println(i);
}
}
}
Jikes and javac both compile this such that the null check is performed
in C$1, AFTER the increment, so the output is 2. However, 15.9.4
states that the null check occurs first, so the output is required
to be 1.
*/
class C {
class Inner {
Inner(int i) {}
}
public static void main(String[] args) {
int i = 1;
try {
C c = null;
c.new Inner(i++) {};
} catch (NullPointerException e) {
System.out.println(i);
}
}
}