bookmark

generics - java warning: Varargs method could cause heap pollution from non-reifiable varargs parameter - Stack Overflow


Description

@SafeVarargs

Is a cure for the warning: [unchecked] Possible heap pollution from parameterized vararg type Foo.
Is part of the method's contract, hence why the annotation has runtime retention.
Is a promise to the caller of the method that the method will not mess up the heap using the generic varargs argument.

Preview

Tags

Users

  • @jil

Comments and Reviews