Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5564

@CompileStatic(SKIP) throws an error

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.1
    • Component/s: Static compilation
    • Labels:
      None

      Description

      If you annotate a class with @CompileStatic, then use @CompileStatic(SKIP) on a method, then calling that method throws an error. However, annotating each method separately with @CompileStatic works.

      Example:

      import groovy.transform.CompileStatic
      import static groovy.transform.TypeCheckingMode.SKIP
      
      @CompileStatic
      class A {
          @CompileStatic(SKIP)
          void m() {}
      }
      
      new A().m()
      

      throws:

      java.lang.NoSuchMethodError: A.$getCallSiteArray()[Lorg/codehaus/groovy/runtime/callsite/CallSite;
      	at A.m(ConsoleScript0)
      	at A$m.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
      	at ConsoleScript0.run(ConsoleScript0:10)
      	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 org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
      	at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy:951)
      	at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy)
      	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:601)
      	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:904)
      	at groovy.lang.Closure.call(Closure.java:410)
      	at groovy.lang.Closure.call(Closure.java:404)
      	at groovy.lang.Closure.run(Closure.java:488)
      	at java.lang.Thread.run(Thread.java:722)
      
      

        Attachments

          Activity

            People

            • Assignee:
              melix Cédric Champeau
              Reporter:
              melix Cédric Champeau
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: