JDK-8033669 : Groovy fails to pass tests with invokedynamic activated
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7u60
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2014-02-04
  • Updated: 2014-11-14
  • Resolved: 2014-02-11
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 7
7u60Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_60-ea"
Java(TM) SE Runtime Environment (build 1.7.0_60-ea-b04)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b07, mixed mode)


FULL OS VERSION :
Linux Ubuntu-1310-saucy-64-minimal 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
The Groovy language build fails to pass with JDK 7u60 b04 when invokedynamic is activated. We have 23 failing tests (http://ci.groovy-lang.org/viewLog.html?buildId=410&tab=buildResultsDiv&buildTypeId=Groovy_Jdk7snapshotBuild), all of them failing with a similar error:

java.lang.IllegalArgumentException: target and fallback types must match: (Object,Object,Object,Object,Object,Object,Object,Object,Object)Object != (HelpFormatter,PrintWriter,int,String,String,Options,Object,Object,String)Object

It is very important to note that Groovy doesn't build with JDK 7 since u40. u11 is the latest version which passes successfully all tests. u25 had a serious bug (infinite loop) with classloaders and u40+ are all buggy.

We also run the build against JDK8 (built from sources) and *everything passes* so it's really a JDK7 specific issue.

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 7u11

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
git clone git@github.com:groovy/groovy-core.git
cd groovy-core
export JAVA_HOME=/path/to/jdk7u60b04
./gradlew -Pindy=true test


EXPECTED VERSUS ACTUAL BEHAVIOR :
The build should pass.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.IllegalArgumentException: target and fallback types must match: (Object,Object,Object,Object,Object,Object,Object,Object,Object,Object)Object != (TypeCheckingExtensionsTest,String,String,String,String,String,String,String,String,String)Object
    at java.lang.invoke.MethodHandleStatics.newIllegalArgumentException(MethodHandleStatics.java:113)
    at java.lang.invoke.MethodHandles.misMatchedTypes(MethodHandles.java:2198)
    at java.lang.invoke.MethodHandles.guardWithTest(MethodHandles.java:2182)
    at org.codehaus.groovy.vmplugin.v7.Selector$MethodSelector.setGuards(Selector.java:706)
    at org.codehaus.groovy.vmplugin.v7.Selector$MethodSelector.setCallSiteTarget(Selector.java:820)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:208)
    at groovy.transform.stc.TypeCheckingExtensionsTest.testNthArgMatches(TypeCheckingExtensionsTest.groovy:293)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at junit.framework.TestCase.runTest(TestCase.java:176)
    at junit.framework.TestCase.runBare(TestCase.java:141)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:129)
    at junit.framework.TestSuite.runTest(TestSuite.java:255)
    at junit.framework.TestSuite.run(TestSuite.java:250)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:50)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:103)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Use 7u11, the only known version of JDK7 which works properly with Groovy and invokedynamic.


Comments
Although it didn't look like at first this seems to be a duplicate of JDK-8019184.
11-02-2014

Yes, it is a duplicate of JDK-8019184. A test run using 7u45 with the patch results in: 6668 tests completed, 6 failed
11-02-2014

I was able to reproduce the issue with JDK 7u45 and a recent clone of: https://github.com/groovy/groovy-core.git 6668 tests completed, 69 failed With JDK 8 I get: 6668 tests completed, 7 failed but none of these: java.lang.IllegalArgumentException: target and fallback types must match: (Object,Object,Object,Object,Object,Object,Object,Object,Object)Object != (Class,String,int,Wrapper,Wrapper,long,Wrapper,BigDecimal,float)Object
06-02-2014

Since it passes in 8, the main culprit is a missed backport from 8.
05-02-2014