@Spence asked this Previous Question.
So, how's that work in Java? Generic types are discarded at runtime in Java, so what happens to static variables of classes instantiated with different generic types?
@Spence asked this Previous Question.
So, how's that work in Java? Generic types are discarded at runtime in Java, so what happens to static variables of classes instantiated with different generic types?
Static members in Java can't have generic type arguments from the class that contains them.
Static variables are shared among all the instances of that type, even of different type parameters.
From the generics tutorial, page 14: