Closed
Description
The most common use of GenericType
, as explained even in its own Javadocs, is:
new GenericType<List<Integer>>() { }
However, for reasons I don't understand, GenericType
implements Serializable
. This means that in ever single usage like the above, I will need to suppress a warning related to the lack of a serialVersionUID
.
- The original example in Neil Gafter's famous Super Type Tokens does not implement
Serializable
. - Jackson's
TypeReference
does not implementSerializable
. - Spring's
ParameterizedTypeReference
does not implementSerializable
. - The Guice
TypeLiteral
does not implementSerializable
. - The GeantyRef fork of gentyref has a
TypeToken
which does not implementSerializable
. - Guava's
TypeToken
unfortunately does implementSerializable
, so at least ClassMate is not alone on this.
So only ClassMate and Guava implement Serializable
for the class with identical functionality. The rest don't. It's not clear to me how it would ever be useful.
Can we remove implements Serializable
from ClassMate GenericType<T>
? No one needs or even wants Serializable
in 2023. There are few if any cases that anyone should be creating new code using Serializable
, and here it just brings a headache.
Metadata
Metadata
Assignees
Labels
No labels