title: How do I lookup an array constructor MethodHandle with MethodHandles.Lookup?
body: <p>How do I get the <code>MethodHandle</code> for an array constructor like <code>int[]::new</code>?</p>
  
  <p>This doesn't work:</p>
  
  <pre><code>public static void main(String[] args) throws Throwable {
      MethodHandles.Lookup lookup = MethodHandles.publicLookup();
      MethodHandle mh = lookup.findConstructor(int[].class, MethodType.methodType(void.class, int.class));
      System.out.println(mh);
      System.out.println(mh.invoke());
  }
  </code></pre>
  
  <p>It results in this:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodException: no such constructor: [I.&lt;init&gt;(int)void/newInvokeSpecial
      at java.lang.invoke.MemberName.makeAccessException(MemberName.java:871)
      at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:990)
      at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1382)
      at java.lang.invoke.MethodHandles$Lookup.findConstructor(MethodHandles.java:920)
      at xx.main(xx.java:11)
  Caused by: java.lang.NoSuchMethodError: java.lang.Object.&lt;init&gt;(I)V
      at java.lang.invoke.MethodHandleNatives.resolve(Native Method)
      at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:962)
      at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:987)
      ... 3 more
  </code></pre>
  
  <p>Nor does this:</p>
  
  <pre><code>public static void main(String[] args) throws Throwable {
      MethodHandles.Lookup lookup = MethodHandles.publicLookup();
      MethodHandle mh = lookup.findConstructor(int[].class, MethodType.methodType(void.class));
      System.out.println(mh);
      System.out.println(mh.invoke());
  }
  </code></pre>
  
  <p>It seems to find the constructor for <code>Object</code> instead:</p>
  
  <pre><code>MethodHandle()Object
  java.lang.Object@36baf30c
  </code></pre>