https://app.pluralsight.com/library/courses/java-se-17-advanced-language-features/
- You can not use primitive types as type arguments, because primitive types are not objects.
- It is not possible to create a new instance of a type parameter.
new T() // Error
Class<T> cls = ....;
var obj = cls.getDeclaredConstructor().newInstance();- instanceof does not work non-reifiable types (a type which type information is lost during type erasure). Parameterized types with at least one concrete or bounded wildcard type argument.
obj instanceof List<String> //Error
obj instance of List<?> //OK- Operations where type safety cannot be guaranteed cause unchecked warnings.
- You cannot overload methods with the same method signature
- after type erasure.
void print(List<String> strings)
void print(List<Integer> integers)