[
https://issues.apache.org/jira/browse/GROOVY-11721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18029897#comment-18029897
]
Bartosz Popiela edited comment on GROOVY-11721 at 10/16/25 6:05 PM:
--------------------------------------------------------------------
_> There is no guarantee that if Groovy adds something here that IntelliJ will
indeed implement specialized support._
Well, that's true, but it's much more likely then, because in that case it
would be a bug in IDE. At the moment, it’s debatable whether the IDE should
eagerly execute a transformation from the compilation classpath, which might
not be available on the runtime classpath. :)
Nevertheless, adding yet another target (Element.TYPE) to the @Field annotation
seems a backward compatible and not very invasive change and IMO Groovy
community can benefit from that.
I can submit a pr if you are willing to approve this change. Once merged, I
will add support to IntelliJ Community as well.
was (Author: bartoszpop):
_> There is no guarantee that if Groovy adds something here that IntelliJ will
indeed implement specialized support._
Well, that's true, but it's much more likely then, because in that case it
would be a bug in IDE. At the moment, it’s debatable whether the IDE should
eagerly execute a transformation from the compilation classpath, which might
not be available on the runtime classpath. :)
Nevertheless, adding yet another target (Element.TYPE) to the @Field annotation
seems a backward compatible and not very invasive change and IMO Groovy
community can benefit from that.
I can submit a pr if you are willing to approve this change.
> @groovy.transform.Field to annotate a script class
> --------------------------------------------------
>
> Key: GROOVY-11721
> URL: https://issues.apache.org/jira/browse/GROOVY-11721
> Project: Groovy
> Issue Type: New Feature
> Affects Versions: 5.0.0-beta-2
> Reporter: Bartosz Popiela
> Priority: Major
> Attachments: image-2025-08-27-14-08-33-523.png,
> image-2025-08-28-02-47-30-911.png, image-2025-10-13-21-02-09-808.png,
> image-2025-10-13-21-08-16-216.png, image-2025-10-13-21-08-47-735.png,
> image-2025-10-14-01-06-43-631.png
>
>
> We use undeclared Groovy Scripts together with JUnit for writing unit tests
> because it supports sentences as method names and doesn’t impose restrictions
> on the file name (we need the test script name to match the name of the YAML
> file being tested). This solution works very well; the only downside is that
> in order to use annotations on a field, such as [email protected]_, we
> also need to use [email protected]_, since those annotations typically
> don’t have target = LOCAL_VARIABLE. It would be convenient if _@Field_ could
> be placed on the script class (with _@Inherited_ to support a base script)
> and be automatically applied to all local variables in the script
--
This message was sent by Atlassian Jira
(v8.20.10#820010)