You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/02/01 23:19:06 UTC

[jira] [Closed] (GROOVY-6107) Unable to access an outer class static method from a super call in the inner-class constructor

     [ https://issues.apache.org/jira/browse/GROOVY-6107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-6107.
-----------------------------

> Unable to access an outer class static method from a super call in the inner-class constructor
> ----------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-6107
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6107
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.1.3, 2.4.0-beta-3
>         Environment: OpenSUSE 12.2
> OpenJDK 1.7u17
> Groovy 2.1.3
>            Reporter: Dmitry Ovchinnikov
>              Labels: call, class, constructor, inner, outer, super
>             Fix For: 2.4.8
>
>         Attachments: super_call_bug.groovy
>
>
> The following code
> {code}
> import groovy.transform.*
> //@CompileStatic
> class X {
>     
>     final Y y = new Y();
>     
>     public static List<String> l() {
>         return Arrays.asList("a", "b");
>     }
>     
>     class Y extends ArrayList<String> {
>         Y() {
>             super(l());
>         }
>     }
> }
> new X()
> {code}
> works fine with @CompileStatic but doesn't work without it.
> Full stack trace:
> {noformat}
> Apr 17, 2013 2:48:57 PM org.codehaus.groovy.runtime.StackTraceUtils sanitize
> WARNING: Sanitizing stacktrace:
> groovy.lang.MissingMethodException: No signature of method: static X$Y.l() is applicable for argument types: () values: []
> Possible solutions: is(java.lang.Object), any(), min(), last(), pop(), tail()
> 	at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1373)
> 	at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1359)
> 	at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.callStatic(StaticMetaClassSite.java:62)
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:53)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:161)
> 	at X$Y.<init>(super_call_bug.groovy:14)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> 	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
> 	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
> 	at X.<init>(super_call_bug.groovy:6)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> 	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
> 	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
> 	at super_call_bug.run(super_call_bug.groovy:19)
> 	at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:257)
> 	at groovy.lang.GroovyShell.run(GroovyShell.java:481)
> 	at groovy.lang.GroovyShell.run(GroovyShell.java:163)
> 	at groovy.lang.GroovyShell$run.call(Unknown Source)
> 	at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy:951)
> 	at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy)
> 	at sun.reflect.GeneratedMethodAccessor207.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
> 	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> 	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
> 	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
> 	at groovy.lang.Closure.call(Closure.java:411)
> 	at groovy.lang.Closure.call(Closure.java:405)
> 	at groovy.lang.Closure.run(Closure.java:492)
> 	at java.lang.Thread.run(Thread.java:662)
> groovy.lang.MissingMethodException: No signature of method: static X$Y.l() is applicable for argument types: () values: []
> Possible solutions: is(java.lang.Object), any(), min(), last(), pop(), tail()
> 	at X$Y.<init>(super_call_bug.groovy:14)
> 	at X.<init>(super_call_bug.groovy:6)
> 	at super_call_bug.run(super_call_bug.groovy:19)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)