You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Owen Thomas <ow...@gmail.com> on 2025/12/01 00:10:34 UTC

Re: Warning in Netbeans: what does it mean?

On Mon, 1 Dec 2025 at 10:38, Owen Thomas <ow...@gmail.com> wrote:

> 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.
>

A single argument to a method with this signature would be a single byte
array - not a single byte. Providing a byte array could be a manifestation
of the mistaken apprehension by the developer that a single byte is indeed
a single argument - and this probably would lead to a problem that might
not be picked up until runtime.

Hence, upon reflection, I think the warning is a legitimate reason for
alerting the developer to the possibility of a mistake; and so I think all
is good with issuing the warning.

Re: Warning in Netbeans: what does it mean?

Posted by Pablo Rodriguez Pina <pa...@anahata.uno>.
I am too busy Michael, thanks for the offer

On Mon, Dec 1, 2025 at 11:39 AM Michael Bien <mb...@gmail.com> wrote:

> On 12/1/25 01:10, Owen Thomas wrote:
> >
> >
> > On Mon, 1 Dec 2025 at 10:38, Owen Thomas <ow...@gmail.com>
> wrote:
> >
> >     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.
> >
> >
> > A single argument to a method with this signature would be a single byte
> array - not a single byte. Providing a byte array could be a manifestation
> of the mistaken apprehension by the developer that a single byte is indeed
> a single argument - and this probably would lead to a problem that might
> not be picked up until runtime.
> >
> > Hence, upon reflection, I think the warning is a legitimate reason for
> alerting the developer to the possibility of a mistake; and so I think all
> is good with issuing the warning.
>
> Btw: if anyone wants to update the hint description text for this or other
> hints its fairly easy to do
>
> E.g adding
>
>         int size = Arrays.asList(new byte[3]).size();
>         System.out.println(size); // returns 1
>
> to the description might help to visualize the problem.
>
>
> https://github.com/apache/netbeans/blob/f914d7fecd5bb0a4537b706cf6a22d93bc33b6d1/java/java.hints/src/org/netbeans/modules/java/hints/bugs/Bundle.properties#L228-L229
>
> in case anyone wants to contribute it ;)
>
> best regards,
> michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

Re: Warning in Netbeans: what does it mean?

Posted by Michael Bien <mb...@gmail.com>.
On 12/1/25 01:10, Owen Thomas wrote:
>
>
> On Mon, 1 Dec 2025 at 10:38, Owen Thomas <ow...@gmail.com> wrote:
>
>     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.
>
>
> A single argument to a method with this signature would be a single byte array - not a single byte. Providing a byte array could be a manifestation of the mistaken apprehension by the developer that a single byte is indeed a single argument - and this probably would lead to a problem that might not be picked up until runtime.
>
> Hence, upon reflection, I think the warning is a legitimate reason for alerting the developer to the possibility of a mistake; and so I think all is good with issuing the warning.

Btw: if anyone wants to update the hint description text for this or other hints its fairly easy to do

E.g adding

        int size = Arrays.asList(new byte[3]).size();
        System.out.println(size); // returns 1

to the description might help to visualize the problem.

https://github.com/apache/netbeans/blob/f914d7fecd5bb0a4537b706cf6a22d93bc33b6d1/java/java.hints/src/org/netbeans/modules/java/hints/bugs/Bundle.properties#L228-L229

in case anyone wants to contribute it ;)

best regards,
michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists