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

@CompileStatic in combo with @IndexProperty transform is broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.3.4, 2.4.0-beta-2
    • None
    • None

    Description

      This script:

      import groovy.transform.*
      @CompileStatic
      class Demo {
          @IndexedProperty List<Integer> foo
          @IndexedProperty String[] bar
          @IndexedProperty List baz
      }
      
      def d = new Demo()
      d.foo = [11, 22, 33]
      d.setFoo(0, 100)
      d.setFoo(1, 200)
      assert d.foo == [100, 200, 33]
      assert d.getFoo(1) == 200
      d.bar = ['cat']
      d.setBar(0, 'dog')
      assert d.getBar(0) == 'dog'
      d.baz = ['cat']
      d.setBaz(0, 'dog')
      assert d.getBaz(0) == 'dog'
      

      gives:

      BUG! exception in phase 'class generation' in source unit 'ConsoleScript4' At line -1 column -1
      On receiver: foo with message: getAt and arguments: index
      This method should not have been called. Please try to create a simple example reproducing this error and filea bug report at http://jira.codehaus.org/browse/GROOVY
        at org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.makeSingleArgumentCall(StaticTypesCallSiteWriter.java:558)
        ...
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:560)
        ...
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: