For method-local inner classes, only "compile time constants" are available. a is final and initialized at declaration, so the compiler knows it at compile time.
This is not true. It doesn't have to be a compile time constant. It just needs it to be a constant.
Basically, during instantiation of the inner class, when both the method and the class is in scope, the inner class will make a copy of the variables which are constants. This means, that the method can go out of scope, since the inner class is only using a copy of the variable.
Henry