You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (JIRA)" <ji...@apache.org> on 2019/04/26 14:45:00 UTC

[jira] [Updated] (GROOVY-9096) Repeatable annotation not wrapped with container type in class file

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

Eric Milles updated GROOVY-9096:
--------------------------------
    Description: 
Consider the following:
Anno.java
{code:java}
import java.lang.annotation.*;

@Retention(RetentionPolicy.CLASS)
@Repeatable(Annos.class)
@interface Anno {
  String value() default "";
}

@Retention(RetentionPolicy.CLASS)
@interface Annos {
  Anno[] value();
}
{code}

Pogo.groovy
{code:groovy}
@Anno @Anno('x')
class Pogo {}
{code}

When this is compiled, the annotations in the class file are incorrect:
{code}
// Compiled from Pogo.groovy (version 1.8 : 52.0, super bit)
@Anno@pack.Anno(value="x")
public class Pogo implements groovy.lang.GroovyObject {
{code}
vs.
{code}
// Compiled from Pojo.java (version 1.8 : 52.0, super bit)
@Annos(value={@Anno,@Anno(value="x")})
public class Pojo {
{code}

See GROOVY-8234 for initial support for {{@Repeatable}}.

  was:
Consider the following:
Anno.java
{code:java}
import java.lang.annotation.*;

@Retention(RetentionPolicy.CLASS)
@Repeatable(Annos.class)
@interface Anno {
  String value() default "";
}

@interface Annos {
  Anno[] value();
}
{code}

Pogo.groovy
{code:groovy}
@Anno @Anno('x')
class Pogo {}
{code}

When this is compiled, the annotations in the class file are incorrect:
{code}
// Compiled from Pogo.groovy (version 1.8 : 52.0, super bit)
@Anno@pack.Anno(value="x")
public class Pogo implements groovy.lang.GroovyObject {
{code}
vs.
{code}
// Compiled from Pojo.java (version 1.8 : 52.0, super bit)
@Annos(value={@Anno,@Anno(value="x")})
public class Pojo {
{code}

See GROOVY-8234 for initial support for {{@Repeatable}}.


> Repeatable annotation not wrapped with container type in class file
> -------------------------------------------------------------------
>
>                 Key: GROOVY-9096
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9096
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.5.6
>            Reporter: Eric Milles
>            Priority: Major
>
> Consider the following:
> Anno.java
> {code:java}
> import java.lang.annotation.*;
> @Retention(RetentionPolicy.CLASS)
> @Repeatable(Annos.class)
> @interface Anno {
>   String value() default "";
> }
> @Retention(RetentionPolicy.CLASS)
> @interface Annos {
>   Anno[] value();
> }
> {code}
> Pogo.groovy
> {code:groovy}
> @Anno @Anno('x')
> class Pogo {}
> {code}
> When this is compiled, the annotations in the class file are incorrect:
> {code}
> // Compiled from Pogo.groovy (version 1.8 : 52.0, super bit)
> @Anno@pack.Anno(value="x")
> public class Pogo implements groovy.lang.GroovyObject {
> {code}
> vs.
> {code}
> // Compiled from Pojo.java (version 1.8 : 52.0, super bit)
> @Annos(value={@Anno,@Anno(value="x")})
> public class Pojo {
> {code}
> See GROOVY-8234 for initial support for {{@Repeatable}}.



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