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

exception while compiling annotation type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8-rc-3, 2.4.0-beta-3
    • 2.5.0-alpha-1
    • parser-antlr2
    • None

    Description

      @interface Inter {
        String[] bar() default "1"
      }
      

      While compiling this annotation type the compiler throws

      java.lang.ClassCastException: org.codehaus.groovy.ast.expr.ConstantExpression cannot be cast to org.codehaus.groovy.ast.expr.ListExpression
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitAnnotationDefaultExpression(AsmClassGenerator.java:316)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitAnnotationDefault(AsmClassGenerator.java:350)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:259)
      at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:366)
      at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056)
      at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:171)
      at org.codehaus.groovy.control.CompilationUnit$13.call(CompilationUnit.java:763)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:957)
      at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:542)
      at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:520)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497)
      at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:43)
      at org.jetbrains.groovy.compiler.rt.GroovycRunner.main(GroovycRunner.java:128)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:75)

      Attachments

        Activity

          People

            paulk Paul King
            mxm-groovy Maxim Medvedev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: