changeset 3728:6a79477df95d

8168774: Polymorhic signature method check crashes javac Summary: Check for polysig method assumes arity is greater than zero Reviewed-by: vromero
author mcimadamore
date Wed, 26 Oct 2016 15:41:25 +0100
parents a94763e89674
children edad5f2365b6
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java test/tools/javac/meth/BadPolySig.java
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Wed Oct 26 12:27:51 2016 +0100
+++ b/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/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();
+}