[
https://issues.apache.org/jira/browse/GROOVY-6019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-6019:
--------------------------------
Labels: annotations (was: )
> Cross compilation of Groovy annotation on Java class does not work
> ------------------------------------------------------------------
>
> Key: GROOVY-6019
> URL: https://issues.apache.org/jira/browse/GROOVY-6019
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.1.0, 2.1.1
> Environment: originally: Linux jato-rafal 3.0.0-31-generic #49-Ubuntu
> SMP Tue Feb 19 20:02:57 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> reproduced on Windows 7 x64
> Reporter: wujek srujek
> Assignee: Paul King
> Priority: Major
> Labels: annotations
> Fix For: 2.1.2, 2.2.0-beta-1
>
>
> This annotation:
> {code}
> @Retention(RetentionPolicy.RUNTIME)
> @Target([ElementType.TYPE, ElementType.METHOD])
> @interface Tx {
> String value() default 'def'
> }
> {code}
> on this class:
> {code}
> @Tx
> public class PersonServiceJava {
> }
> {code}
> results in the following failure:
> {quote}
> $ groovyc -j PersonServiceJava.java Tx.groovy
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> Compile error during compilation with javac.
> /home/wujek/Playground/annotation_test/src/main/groovy/test/PersonServiceJava.java:4:
> error: annotation Tx is missing value for the attribute value
> @Tx
> ^
> 1 error
> {quote}
> I originally submitted it to Gradle
> (http://issues.gradle.org/browse/GRADLE-2682), but it seems to be a core
> groovy issue. The generated stub for the Groovy annotation look like the
> following:
> {code}
> @java.lang.annotation.Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME)
>
> @java.lang.annotation.Target(value={java.lang.annotation.ElementType.TYPE,java.lang.annotation.ElementType.METHOD})
> public @interface Tx
> {
> java.lang.String value();
> }
> {code}
> The default value is missing. A sample project can be downloaded in the
> Gradle issue, so I won't attach it here, unless you want me to.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)