You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/07/06 16:55:00 UTC

[jira] [Comment Edited] (GROOVY-9510) DelegatesTo and similar for annotation member methods

    [ https://issues.apache.org/jira/browse/GROOVY-9510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17089727#comment-17089727 ] 

Eric Milles edited comment on GROOVY-9510 at 7/6/22 4:54 PM:
-------------------------------------------------------------

You can define [DSLD|https://github.com/groovy/groovy-eclipse/wiki/DSL-Descriptors] or [GDSL|https://confluence.jetbrains.com/display/GRVY/Scripting+IDE+for+DSL+awareness] and include it with Spock so that IDE is informed that {{@Requires}} delegates to {{PreconditionContext}} within its value closure.


was (Author: emilles):
You can define DSLD or GDSL and include it with Spock so that IDE is informed that {{@Requires}} delegates to {{PreconditionContext}} within its value closure.

> DelegatesTo and similar for annotation member methods
> -----------------------------------------------------
>
>                 Key: GROOVY-9510
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9510
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Björn Kautler
>            Priority: Major
>              Labels: annotations
>
> If you have an annotation with a closure field like for example this in Spock:
> {code:java}
> @Retention(RetentionPolicy.RUNTIME)
> @Target({ElementType.TYPE, ElementType.METHOD})
> @ExtensionAnnotation(RequiresExtension.class)
> public @interface Requires {
>   Class<? extends Closure> value();
> }{code}
> you can use it like
> {code:java}
> @Requires({ os.windows }){code}
> But I see no way to add IDE-hints for that closure like {{@DelegatesTo(PreconditionContext.class)}} as it is restriced to parameters.
> It would be nice if you could also annotate annotation member methods (and if IDEs would then support that too).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)