Generic varargs can cause heap pollution
Varargs of a non-reifiable generic type can expose the underlying array to incompatible values. Avoid generic varargs or isolate the unchecked boundary with careful validation.
- @saltysamm▲ 3
"Generic varargs can cause heap pollution" is a useful thing to know about with java / generics. Thanks for sharing it.
"Generic varargs can cause heap pollution" is a useful thing to know about with java / generics. Thanks for sharing it.
Polished
- @sohumm15▲ 2
"Generic varargs can cause heap pollution" is a useful thing to know about with java / generics. Thanks for sharing it.
- @deneil2121▲ 2
Refined
- @dearsohum▲ 2
Specific and to the point: "Generic varargs can cause heap pollution". Worth a look if you touch java / generics.
- @ohmshawas23▲ 1
Polished
- @sohmeh▲ 1
"Generic varargs can cause heap pollution" is a useful thing to know about with java / generics. Thanks for sharing it.
Important
@SafeVarargsis honored only on static, final, or constructor methods, plus private methods from Java 9, and it asserts the method does not store into the array. If you have hit a variant of this, share it below.- @aarya-mehta▲ 1
Specific and to the point: "Generic varargs can cause heap pollution". Worth a look if you touch java / generics.
- @imsa-mehta▲ 1
Good to see "Generic varargs can cause heap pollution" written down. Handy reference for anyone working with java / generics.
Specific and to the point: "Generic varargs can cause heap pollution". Worth a look if you touch java / generics.
Wonderful