Thank you Alonso and Pete for your responses.
This warning's short message was "Confusing primitive array passed to
vararg method", and it was suppressed with the following:
@SuppressWarnings({"ConfusingArrayVararg",
"PrimitiveArrayArgumentToVariableArgMethod"})
Thanks again.
Owen.
On Mon, 1 Dec 2025 at 00:56, Peter Hull <[email protected]> wrote:
> On Sun, 30 Nov 2025 at 13:01, Alonso Del Arte <[email protected]>
> wrote:
> > However, I did notice that when I only had array1 as a parameter for
> gatherFirstElems(), NetBeans gave a warning: "Confusing primitive array
> passed to vararg method".
>
> That's the one that Owen means, I think?
>
> I have come to the conclusion it might be a bit of a red herring; I
> don't think it is confusing. Does this help:
> https://northcoder.com/post/how-to-break-javas-type-safety-syst/
>
> If the function is generic 'T f(T... arrays)' or if there is an
> overload 'byte[] f(byte... b)' then maybe it is confusing. In the
> generic case if you passed one byte array you might expect the
> function to get an array of bytes and return a byte, but it gets an
> array of one array of bytes and returns an array of bytes. In the
> overload case it prefers f(byte...) over f(byte[]...) if you call it
> with f(new byte[] {1,2,3}).
>
> So I'd say - ignore the warning (or suppress it!)
>
> Pete
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>