javac (for 1.5.0_08 and 1.6.0b2) allows circular defs
Hi,
Anyone know why javac.exe allows the following program to be compiled, and why java.exe allows it to be run, all without any circularity errors or warnings?
//Test.java
//Demonstrates cyclic behavior that's not caught by compiler.
//Program is allowed to run (first problem), and
//gives unexpected results (second problem)
publicclass Test{
staticinterface I1extends I2{int i = 1;}
staticinterface I2extends I1{int i = 2;}
staticclass A1extends A2{staticint j = 1;}
staticclass A2extends A1{staticint j = 2;}
publicstaticvoid main(String[] args){
System.out.println(I1.i);//prints 1
System.out.println(I2.i);//prints 2
System.out.println(A1.j);//prints 0 (<clinit> doesn't run)
System.out.println(A2.j);//prints 0 (<clinit> doesn't run)
}
}
Thanks,
Will

