You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2015/06/19 23:19:00 UTC

[jira] [Resolved] (GROOVY-4811) exception while compiling annotation type

     [ https://issues.apache.org/jira/browse/GROOVY-4811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King resolved GROOVY-4811.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 2.5.0-beta-1
         Assignee: Paul King

This can be considered a bug (unneeded difference from Java) or new feature (a convenience syntax we didn't use to support but will now). Certainly IDEA also complains about the syntax - so there is 3rd party tool implications for this change. For that reason I'll do the change just in 2.5 for now.

If there is a huge demand, we could consider back-porting to the 2_4_X branch.

> exception while compiling annotation type
> -----------------------------------------
>
>                 Key: GROOVY-4811
>                 URL: https://issues.apache.org/jira/browse/GROOVY-4811
>             Project: Groovy
>          Issue Type: Bug
>          Components: parser-antlr
>    Affects Versions: 1.8-rc-3, 2.4.0-beta-3
>            Reporter: Maxim Medvedev
>            Assignee: Paul King
>             Fix For: 2.5.0-beta-1
>
>
> {code}
> @interface Inter {
>   String[] bar() default "1"
> }
> {code}
> 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)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)