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

@MapConstructor with @CompileStatic: Creating inner class instance => IncompatibleClassChangeError ... does not implement the requested interface java.util.Map

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5.2
    • 3.0.0-alpha-4, 2.5.5
    • Compiler
    • None

    Description

      import groovy.transform.CompileStatic
      import groovy.transform.MapConstructor
      
      @CompileStatic // static bug only
      class GroovyMapConstructorCheck {
      
          @MapConstructor(noArg = true)
          class Goo {
              final int x0
      
              @Override
              public String toString() {
                  return "Goo(|$x0|)"
              }
          }
      
          void go() {
              println new Goo(x0:123)
          }
      }
      
      final check = new GroovyMapConstructorCheck()
      check.go() 
      

      throws

      java.lang.IncompatibleClassChangeError: Class GroovyMapConstructorCheck does not implement the requested interface java.util.Map

      at GroovyMapConstructorCheck$Goo.<init>(VerifyError - Bad type on operand stack 2 v1.groovy)

      at GroovyMapConstructorCheck.go(VerifyError - Bad type on operand stack 2 v1.groovy:18)

      at GroovyMapConstructorCheck$go.call(Unknown Source)

      at VerifyError_-_Bad_type_on_operand_stack_2_v1.run(VerifyError - Bad type on operand stack 2 v1.groovy:23)

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: