Nothing bad would happen if they were a design to allow static things. I donβt think that there are no problems at the class file level, the bytecode does not have the concept of an inner class.
This will be confusing though:
class X class Y static int z; X x1 = new X(); XY y1 = x1.new Y(); X x2 = new X(); XY y2 = x2.new Y(); XY y3 = x2.new Y();
Intuitively, y2 and y3 must share the same z , but should it be the same z visible y1 ?
Conceptually, the inner class is valid only in the outer instance. Even imagine that the JVM unloads it when an external instance of GC'ed; the argument specified in [1] for class unloading is not applied, since inner classes do not have a static variable or a static initializer.
However, the reality is that there is one class shared by all internal instances, regardless of external instances. This is certainly true: y1.getClass()==y2.getClass()==y3.getClass() .
It can be argued that the language specification determines that this is true: [2]
Two types of links are the same type of runtime if ... defined by the same class loader and having the same binary name
The class y1 and class y2 have the same classloader, the binary name XY is well defined and independent of the external instance. Therefore, y1 and y2 must have the same runtime class.
If the language specification actually implied that the inner class is independent of the outer instance, the generally accepted explanation against the static state in inner classes is weakened.
[1] http://java.sun.com/docs/books/jls/third_edition/html/execution.html#12.7
[2] http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.3.4