[
https://issues.apache.org/jira/browse/GROOVY-11900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18071124#comment-18071124
]
Paul King commented on GROOVY-11900:
------------------------------------
[~emilles] I created a PR to assess. This is a minimal risk change. It removes
annotation definitions from Grab processing. It also skips annotation checking
for static initialisers since we skip processing them when writing annotations
in the bytecode. As for the larger question about Grab init code being added in
multiple places, I can't remember the details - but we can search a bit more. I
have a vague recollection that this was specifically added previously because
it was needed, perhaps but I'm not 100% sure to support situations like
containers (think EE or perhaps OSGi) or multi-threading. It is harmless, in
that reloading grapes will essentially be a noop, but it would be good to be
sure it is needed and properly document that. Or remove it if we think the
earlier scenarios are no longer relevant. Maybe a separate issue?
> grab adds static constructor to annotation definition
> -----------------------------------------------------
>
> Key: GROOVY-11900
> URL: https://issues.apache.org/jira/browse/GROOVY-11900
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:groovy}
> @Grab('org.apache.commons:commons-lang3:3.20.0')
> import org.apache.commons.lang3.StringUtils
> @interface A { String value() }
> @A(StringUtils.EMPTY) class C { }
> {code}
> The last line produces error "No explicit/default value found for annotation
> attribute '<clinit>' ".
> Not sure if static clinit is supported for annotations. If it is, the
> attribute checking needs a filter for it. Maybe the filter should include
> all static methods.
> WRT grab, should it be adding its magic to all classes of a script class or
> just the script class?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)