8168774: Polymorhic signature method check crashes javac
Summary: Check for polysig method assumes arity is greater than zero
Reviewed-by: vromero
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Wed Oct 26 12:27:51 2016 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Wed Oct 26 15:41:25 2016 +0100
@@ -1004,7 +1004,7 @@
List<Type> argtypes = msym.type.getParameterTypes();
return (msym.flags_field & NATIVE) != 0 &&
(msym.owner == syms.methodHandleType.tsym || msym.owner == syms.varHandleType.tsym) &&
- argtypes.tail.tail == null &&
+ argtypes.length() == 1 &&
argtypes.head.hasTag(TypeTag.ARRAY) &&
((ArrayType)argtypes.head).elemtype.tsym == syms.objectType.tsym;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/meth/BadPolySig.java Wed Oct 26 15:41:25 2016 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test
+ * @bug 8168774
+ * @summary Polymorhic signature method check crashes javac
+ * @compile -Xmodule:java.base BadPolySig.java
+ */
+
+package java.lang.invoke;
+
+class MethodHandle {
+ native Object m();
+}