Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8066746

MHs.explicitCastArguments does incorrect type checks for VarargsCollector

    Details

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_40-ea"
        Java(TM) SE Runtime Environment (build 1.8.0_40-ea-b15)
        Java HotSpot(TM) 64-Bit Server VM (build 25.40-b18, mixed mode)


        FULL OS VERSION :
        Linux macnux 3.16.3-031603-generic #201409171435 SMP Wed Sep 17 18:36:23 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


        A DESCRIPTION OF THE PROBLEM :
        First of all, reported on 8u40 but he bug occurs with JDK 1.8.0u40 and JDK 1.9.0b39.

        It is a blocker for Groovy (invokedynamic version), that we test against the latest EAP releases. The test case attached runs fine on 8u20, but fails on the above versions with the following stack trace:

        java.lang.ClassCastException: Cannot cast [Ljava.lang.String; to java.lang.String
        at java.lang.invoke.MethodHandleImpl.newClassCastException(MethodHandleImpl.java:365)
        at java.lang.invoke.MethodHandleImpl.castReference(MethodHandleImpl.java:360)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:625)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at TestScript0.getStringArrayIndirectlyWithType_Length(TestScript0.groovy:6)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:625)
        at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
        at TestScript0.run(TestScript0.groovy:8)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:627)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:608)
        at groovy.test.GroovyAssert.assertScript(GroovyAssert.java:80)
        at groovy.util.GroovyTestCase.assertScript(GroovyTestCase.java:200)

        THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

        THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

        REGRESSION. Last worked in version 8u20

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. Download https://dl.dropboxusercontent.com/u/20288797/bug_jdk9.tgz
        2. tar xzvf bug_jdk9.tgz
        3. cd bug_jdk9
        4. ./gradlew test

        The test will fail and generate a report with the exception above.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        java.lang.ClassCastException: Cannot cast [Ljava.lang.String; to java.lang.String
        at java.lang.invoke.MethodHandleImpl.newClassCastException(MethodHandleImpl.java:365)
        at java.lang.invoke.MethodHandleImpl.castReference(MethodHandleImpl.java:360)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:625)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at TestScript0.getStringArrayIndirectlyWithType_Length(TestScript0.groovy:6)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.LambdaForm.interpret_L(LambdaForm.java:681)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:625)
        at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
        at TestScript0.run(TestScript0.groovy:8)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:627)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:608)
        at groovy.test.GroovyAssert.assertScript(GroovyAssert.java:80)
        at groovy.util.GroovyTestCase.assertScript(GroovyTestCase.java:200)

        REPRODUCIBILITY :
        This bug can be reproduced always.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  vlivanov Vladimir Ivanov
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  9 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: