JDK-8168774 : Polymorhic signature method check crashes javac
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8,9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-10-26
  • Updated: 2017-11-29
  • Resolved: 2016-10-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u131Fixed 9 b143Fixed
Related Reports
Relates :  
Relates :  
Description
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)

Comments
Add change where issue was introduced (argtypes.length() == 1 is replaced with argtypes.tail.tail == null, which can cause NPE)
18-04-2017

BPR no longer needed - fix is shipping in Update
28-02-2017