Eclipse says that the instanceof operation is not allowed with Type Parameter due to generic type eraser.
I agree that at runtime, no type information stays. But con
But if I instantiate this class of type Integer, then the corresponding object will have a field t of type Integer.
Actually, it wouldn't. It'd have a field t
of type Object
. As you've said, generics are almost entirely syntactic sugar (the exception is that when you extend a generic class and specify a type parameter, the type remains as metadata in the class file).