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

Keegan Witt updated GROOVY-9717:
--------------------------------
    Description: 
{code:java}
@CustomAnnotation
package com.foo

Foo {}


@interface CustomAnnotation {}
{code}
Generates a stub that has {{@com.foo.CustomAnnotationpackage}} in _Foo.java_, 
which javac won't compile because it requires package annotations to be in 
_package-info.java_.  Groovy 2.4 and 2.5 don't include this annotation in the 
stub.

Ideally, the annotation would be included if in _package-info.groovy_, and 
otherwise omitted.  But if we had to, and always omitted it, it at least 
wouldn't be a regression (assuming this difference wasn't made on purpose).

Possibly we should also consider having the Groovy compiler not allow 
annotations on packages if not in package-info.groovy, though this would have 
to be a Groovy 4 thing, and not only if it makes sense.

  was:
{code:java}
@CustomAnnotation
package com.foo

Foo {}


@interface CustomAnnotation {}
{code}
Generates a stub that has {{@com.foo.CustomAnnotationpackage}} in _Foo.java_, 
which javac won't compile because it requires package annotations to be in 
_package-info.java_.  Groovy 2.4 and 2.5 don't include this annotation in the 
stub.

Ideally, the annotation would be included if in _package-info.groovy_, and 
otherwise omitted.  But if we had to, and always omitted it, it at least 
wouldn't be a regression (assuming this difference wasn't made on purpose).

Possibly we should also consider having the Groovy compiler not allow 
annotations on packages if not in package-info.groovy.  I'm not clear what use 
cases there are for using the annotation outside a package info file.


> 3.0 stubs include packages annotations on classes other than 
> package-info.groovy
> --------------------------------------------------------------------------------
>
>                 Key: GROOVY-9717
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9717
>             Project: Groovy
>          Issue Type: Bug
>          Components: Stub generator / Joint compiler
>            Reporter: Keegan Witt
>            Priority: Major
>
> {code:java}
> @CustomAnnotation
> package com.foo
> Foo {}
> @interface CustomAnnotation {}
> {code}
> Generates a stub that has {{@com.foo.CustomAnnotationpackage}} in _Foo.java_, 
> which javac won't compile because it requires package annotations to be in 
> _package-info.java_.  Groovy 2.4 and 2.5 don't include this annotation in the 
> stub.
> Ideally, the annotation would be included if in _package-info.groovy_, and 
> otherwise omitted.  But if we had to, and always omitted it, it at least 
> wouldn't be a regression (assuming this difference wasn't made on purpose).
> Possibly we should also consider having the Groovy compiler not allow 
> annotations on packages if not in package-info.groovy, though this would have 
> to be a Groovy 4 thing, and not only if it makes sense.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to