You cannot declare static properties inside generic types. The language doesn't support it today. This is because the semantics aren't very clear, should Structure<Int>
share the same static variables as Structure<String>
or should they be distinct? You probably should be able to do the former, but that hasn't been decided yet and behaviour and syntax are simply not designed. Hence, the compiler bans it outright.
This applies to nested or top level types, static properties inside generic types simply are not allowed anywhere. In your case, as Foo
is generic on content
, then any nested type inside Foo
is also generic on content
(this might be easier to grasp if you think about the fully-qualified type of Holder
— it is Foo<content>.Holder
).