eclipse-collections icon indicating copy to clipboard operation
eclipse-collections copied to clipboard

Add @SafeVarargs everywhere it is needed (Java 7+)

Open victornoel opened this issue 5 years ago • 3 comments

Hi,

I noticed that many classes are not using the annotation @SafeVarargs while it would make sense to use it. In the user code, this would avoid many unneeded warnings.

If I'm not wrong EC is now for Java 8+ right? It was introduced with Java 7.

victornoel avatar Feb 16 '20 18:02 victornoel

For the record, according to https://stackoverflow.com/a/37959022/9046139, it's not possible to avoid the warnings (I think both at declaration AND usage site) for interfaces.

victornoel avatar Mar 01 '20 12:03 victornoel

There are a few places where I believe the warning may be true, like wrapCopy() methods. On the other hand, I've never seen valuable information come from the warning (never seen anyone catch a real bug) so I'd be open to suppressing it across the board. If someone comes up with a counter-example, we could always revert the annotations.

motlin avatar Mar 01 '20 19:03 motlin