You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Keegan Witt (Jira)" <ji...@apache.org> on 2020/09/03 22:27:00 UTC

[jira] [Created] (GROOVY-9717) 3.0 stubs include packages annotations on classes other than package-info.groovy

Keegan Witt created GROOVY-9717:
-----------------------------------

             Summary: 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


{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.



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