Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
@CustomAnnotation package com.foo class Foo {} @interface CustomAnnotation {}
Generates a stub that has @com.foo.CustomAnnotation package com.foo 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 only if it makes sense.