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

SKIP is not honored when an inner class is defined in a SKIP method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.0.2, 2.1.0-beta-1
    • 2.0.2
    • Compiler
    • None

    Description

          @CompileStatic(TypeCheckingMode.SKIP)
          static Closure memoize(MemcacheService memcache, Closure closure) {
              return new Closure(closure.owner) {
                  Object call(Object[] args) {
                      // a closure call is identified by its hashcode and its call argument values
                      def key = [
                              closure: closure.hashCode(),
                              arguments: args.toList()
                      ]
                      // search for a result for such a call in memcache
                      def result = memcache.get(key)
                      if (result != null) {
                          // a previous invocation exists
                          return result
                      } else {
                          // no previous invocation, so calling the closure and caching the result 
                          result = closure(* args)
                          put(memcache, key, result, Expiration.byDeltaSeconds(60), SetPolicy.SET_ALWAYS)
                          return result
                      }
                  }
              }
          }
      

      results in

      /glaforge-gaelyk/core/src/main/groovyx/gaelyk/GaelykCategory.groovy: 1687: [Static type checking] - The spread operator cannot be used as argument of method or closure calls with static type checking because the number of arguments cannot be determined at compile time
       @ line 1687, column 38.
                             result = closure(* args)
                                              ^
      
      1 error
      

      yet it has been annotated with
      @CompileStatic(TypeCheckingMode.SKIP)

      Attachments

        Activity

          People

            melix Cédric Champeau
            sdmurphy Scott Murphy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: