Please see the minimized test below to reproduce the issue.
Minimized test:
===============
$ cat Test.java
import java.lang.invoke.*;
import java.util.Arrays;
public class Test {
public static void main(String[] args) throws Exception {
Object[][] data = new Object[][] {
{ (Class) null, (Class[]) null },
{ (Class) null, new Class[]{Object.class} },
{ Object.class, new Class[]{ null} },
{ Object.class, new Class[]{Object.class, (Class) null} },
{ Object.class, (Class[]) null }
};
for (int i = 0; i < data.length; i++) {
Class<?> rtype = (Class) data[i][0];
Class<?>[] ptypes = (Class[]) data[i][1];
try {
MethodType.methodType(rtype, ptypes);
System.out.println("FAILED: NPE not thrown for " + rtype + ", " + Arrays.toString(ptypes));
} catch(NullPointerException ok) {
System.out.println("OK: NPE is thrown for " + rtype + ", " + Arrays.toString(ptypes));
}
}
}
}
Minimized test output:
========================
$ javac Test.java
$ java -showversion -verify Test
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b138)
Java HotSpot(TM) Server VM (build 21.0-b08, mixed mode)
OK: NPE is thrown for null, null
OK: NPE is thrown for null, [class java.lang.Object]
OK: NPE is thrown for class java.lang.Object, [null]
OK: NPE is thrown for class java.lang.Object, [class java.lang.Object, null]
FAILED: NPE not thrown for class java.lang.Object, null