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

[2238 byte] By [will608a] at [2007-10-3 5:41:43]
# 1
I cannot reproduce this problem on Sun's JDK 5.0u8.
PeterAhea at 2007-7-14 23:49:35 > top of Java-index,Developer Tools,Java Compiler...
# 2
I got 8 errors when i tried it. It must just be your compiler/runner isnt working right.
Mdoga at 2007-7-14 23:49:35 > top of Java-index,Developer Tools,Java Compiler...
# 3
And I cannot reproduce it in JDK 6.
PeterAhea at 2007-7-14 23:49:35 > top of Java-index,Developer Tools,Java Compiler...
# 4
and what does your javac -version say?
ejpa at 2007-7-14 23:49:35 > top of Java-index,Developer Tools,Java Compiler...