If javac encounters a native method with no arguments in either MethodHandle or VarHandle, an NPE will occur:
//Test.java
package java.lang.invoke;
class MethodHandle {
native Object m();
}
javac -source 8 Test.java
warning: [options] bootstrap class path not set in conjunction with -source 1.8
1 warning
An exception has occurred in the compiler (9-internal). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.code.Types.isSignaturePolymorphic(jdk.compiler@9-internal/Types.java:1079)
at com.sun.tools.javac.comp.MemberEnter.visitMethodDef(jdk.compiler@9-internal/MemberEnter.java:199)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(jdk.compiler@9-internal/JCTree.java:852)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(jdk.compiler@9-internal/MemberEnter.java:161)
at com.sun.tools.javac.comp.MemberEnter.memberEnter(jdk.compiler@9-internal/MemberEnter.java:173)
at com.sun.tools.javac.comp.TypeEnter$MembersPhase.finishClass(jdk.compiler@9-internal/TypeEnter.java:956)
at com.sun.tools.javac.comp.TypeEnter$MembersPhase.runPhase(jdk.compiler@9-internal/TypeEnter.java:941)
at com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(jdk.compiler@9-internal/TypeEnter.java:273)
at com.sun.tools.javac.comp.TypeEnter$MembersPhase.doCompleteEnvs(jdk.compiler@9-internal/TypeEnter.java:876)
at com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(jdk.compiler@9-internal/TypeEnter.java:248)
at com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(jdk.compiler@9-internal/TypeEnter.java:257)
at com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(jdk.compiler@9-internal/TypeEnter.java:257)
at com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(jdk.compiler@9-internal/TypeEnter.java:257)
at com.sun.tools.javac.comp.TypeEnter.complete(jdk.compiler@9-internal/TypeEnter.java:198)
at com.sun.tools.javac.code.Symbol.complete(jdk.compiler@9-internal/Symbol.java:623)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(jdk.compiler@9-internal/Symbol.java:1236)
at com.sun.tools.javac.comp.Enter.complete(jdk.compiler@9-internal/Enter.java:549)
at com.sun.tools.javac.comp.Enter.main(jdk.compiler@9-internal/Enter.java:526)
at com.sun.tools.javac.main.JavaCompiler.enterTrees(jdk.compiler@9-internal/JavaCompiler.java:1069)
at com.sun.tools.javac.main.JavaCompiler.compile(jdk.compiler@9-internal/JavaCompiler.java:940)
at com.sun.tools.javac.main.Main.compile(jdk.compiler@9-internal/Main.java:304)
at com.sun.tools.javac.main.Main.compile(jdk.compiler@9-internal/Main.java:160)
at com.sun.tools.javac.Main.compile(jdk.compiler@9-internal/Main.java:55)
at com.sun.tools.javac.Main.main(jdk.compiler@9-internal/Main.java:41)