documentation says in the last paragraph of this section that The static type second formal parameter of the add method is String, but this method is called with an actual parameter of a different type, Integer. the add(int,Object) is called on l which static type is List<Number> as doc says. could someone please explain why static type is String when it seems that it is Number.
Thanks,
George
Heap Pollution
The static type of
lsisList<String>because that is what it was defined as.Using type erasure allows you to change the static type. When this is done incorrectly, you can get “heap pollution.”