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 2019/04/25 23:44:00 UTC

[jira] [Commented] (GROOVY-9095) Default retention policy not implemented for annotation

    [ https://issues.apache.org/jira/browse/GROOVY-9095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16826537#comment-16826537 ] 

Paul King commented on GROOVY-9095:
-----------------------------------

The default is indeed wrong, the workaround is to add an explicit CLASS retention policy.

> Default retention policy not implemented for annotation
> -------------------------------------------------------
>
>                 Key: GROOVY-9095
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9095
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.5.6
>            Reporter: Eric Milles
>            Priority: Major
>
> Consider the following:
> Anno.java
> {code:java}
> public @interface Anno {}
> {code}
> Pogo.groovy
> {code:groovy}
> @Anno public class Pogo {}
> {code}
> Pojo.java
> {code:java}
> @Anno public class Pojo {}
> {code}
> When compiled, Pogo lacks the annotation in its class file.
> {code}
> // Compiled from Pogo.groovy (version 1.8 : 52.0, super bit)
> public class Pogo implements groovy.lang.GroovyObject {
> {code}
> vs.
> {code}
> // Compiled from Pojo.java (version 1.8 : 52.0, super bit)
> @Anno
> public class Pojo {
> {code}
> The default for an annotation that lacks an {{@Retention}} annotation is {{@Retention(RetentionPolicy.CLASS)}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)