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

@Memoized not working for inner classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.0-beta-2
    • 2.5.0-beta-3
    • xforms
    • None

    Description

      import groovy.transform.Memoized
      
      class Outer {
        private static class Inner {
          @Memoized
          static calc(int arg1, int arg2) { arg1 + arg2}
        }
      }
      
      println Outer.Inner.calc(3, 4)
      

      Works with 2.4.12 but for 2.5+, results in:

      groovy.lang.GroovyRuntimeException: NPE while processing ConsoleScript12
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:286)
      ...
      Caused by: java.lang.NullPointerException
      	at org.codehaus.groovy.classgen.asm.ClosureWriter.getClosureSharedVariables(ClosureWriter.java:360)
      	at org.codehaus.groovy.classgen.asm.ClosureWriter.createClosureClass(ClosureWriter.java:194)
      	at org.codehaus.groovy.classgen.asm.ClosureWriter.getOrAddClosureClass(ClosureWriter.java:156)
      ...
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              paulk Paul King
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: