You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/10/12 23:11:00 UTC

[jira] [Created] (GROOVY-10302) StackOverflowError on Java 16+ for override method that delegates to super

Eric Milles created GROOVY-10302:
------------------------------------

             Summary: StackOverflowError on Java 16+ for override method that delegates to super
                 Key: GROOVY-10302
                 URL: https://issues.apache.org/jira/browse/GROOVY-10302
             Project: Groovy
          Issue Type: Bug
          Components: jdk conflict
    Affects Versions: 4.0.0-beta-1
            Reporter: Eric Milles


Consider the following:
{code:groovy}
void test() {
    def list = []

    def loader = new GroovyClassLoader() {
        @Override
        protected Class<?> findClass(String name) throws ClassNotFoundException {
            list.add(name); super.findClass(name)
        }
    }

    Class result = loader.findClass('foo.bar.Baz')
}
{code}

When executed on Java 16+ it produces a StackOverflowError when resolving "super.findClass(name)".

{code}
    java.lang.StackOverflowError
        at org.codehaus.groovy.runtime.memoize.LRUCache.getAndPut(LRUCache.java:63)
        at org.codehaus.groovy.vmplugin.v8.CacheableCallSite.getAndPut(CacheableCallSite.java:48)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.lambda$fromCache$2(IndyInterface.java:298)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.doWithCallSite(IndyInterface.java:367)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:295)
        at TestScript0$1.findClass(TestScript0.groovy:8)
        at java.base/jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:116)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1424)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1140)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:146)
        at TestScript0$1.findClass(TestScript0.groovy:8)
        at java.base/jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:116)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1424)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1140)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:146)
        at TestScript0$1.findClass(TestScript0.groovy:8)
        at java.base/jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:116)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1424)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1140)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:146)
        at TestScript0$1.findClass(TestScript0.groovy:8)
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)