title: Why does NetBeans warn about passing int[] to vararg?
body: <p><strong>Why does the NetBeans precompiler give a warning for this?</strong></p>
  
  <pre><code>public class PrimitiveVarArgs
  {
      public static void main(String[] args)
      {
          int[] ints = new int[]{1, 2, 3, 4, 5};
          prints(ints);
      }
  
      static void prints(int... ints)
      {
          for(int i : ints)
              System.out.println(i);
      }
  }
  </code></pre>
  
  <p>It complains about line 5, saying:</p>
  
  <pre><code>Confusing primitive array passed to vararg method
  </code></pre>
  
  <p>but as far as I (<a href="https://stackoverflow.com/a/2426504/453435">and others on SO</a>) know, <code>int...</code> is the same as <code>int[]</code>. This works if it's a non-primitive type, like <code>String</code>, but not on primitives.</p>
  
  <p>I can't even add this method:</p>
  
  <pre><code>void prints(int[] ints)
  {
      for(int i : ints)
          System.out.println(i);
  }
  </code></pre>
  
  <p>because the compiler says:</p>
  
  <pre><code>name clash: prints(int[]) and prints(int...) have the same erasure
  
  cannot declare both prints(int[]) and prints(int...) in PrimitiveVarArgs
  </code></pre>
  
  <p>Upon looking into the NetBeans hints settings, I find it says this:</p>
  
  <blockquote>
    <p>A primitive array passed to variable-argument method will not be unwrapped and its items will not be seen as items of the variable-length argument in the called method. Instead, the array will be passed as a single item.</p>
  </blockquote>
  
  <p>However, when I run the file (since it's just a warning and not an error), I get exactly the output I expect:</p>
  
  <pre><code>1
  2
  3
  4
  5
  </code></pre>
  
  <p>so, <strong>why doesn't NetBeans like me passing a native array to a varargs method?</strong></p>