First, a puzzle: What does the following code print?
public class RecursiveStatic {
public static void main(String[] args) {
System.out.println(scale
It's not a bug at all, simply put it is not an illegal form of forward references, nothing more.
String x = y;
String y = "a"; // this will not compile
String x = getIt(); // this will compile, but will be null
String y = "a";
public String getIt(){
return y;
}
It's simply allowed by the Specification.
To take your example, this is exactly where this matches:
private static final long X = scale(10) + 3;
You are doing a forward reference to scale that is not illegal in any way as said before, but allows you to get the default value of X. again, this is allowed by the Spec (to be more exact it is not prohibited), so it works just fine