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/09/24 16:03:00 UTC
[jira] [Commented] (GROOVY-10768) Macro class should be able to resolve macro-method arguments
[ https://issues.apache.org/jira/browse/GROOVY-10768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17609016#comment-17609016 ]
Eric Milles commented on GROOVY-10768:
--------------------------------------
Not sure how much {{MacroClass}} is compatible with static methods or static type checking. Does it work outside of STC?
> Macro class should be able to resolve macro-method arguments
> ------------------------------------------------------------
>
> Key: GROOVY-10768
> URL: https://issues.apache.org/jira/browse/GROOVY-10768
> Project: Groovy
> Issue Type: Improvement
> Affects Versions: 4.0.5
> Reporter: Christopher Smith
> Priority: Major
>
> I'm using {{MacroClass}} to create some boilerplate methods to attach to an annotated class. My no-arg methods are working perfectly, but I'm having trouble with a static builder method:
> {code:java}
> var jat = constX(jsonApiType)
> ... in MacroClass ...
> public static final com.example.JsonApiResourceId id(java.lang.String value) {
> return new com.example.JsonApiResourceId( $v { jat }, value)
> }{code}
> This produces a (static) compiler error
> {code:java}
> Cannot find matching method com.example.JsonApiResourceId#<init>(java.lang.String, java.lang.Object). Please check if the declared type is correct and if the method exists. {code}
> Somehow the method body can't resolve the locally-declared parameter, and this is "local enough context" that it ought to.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)