[
https://issues.apache.org/jira/browse/GROOVY-12293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18107845#comment-18107845
]
Björn Kautler commented on GROOVY-12293:
----------------------------------------
Ah, right, must have been sleepy when writing this.
With Spock {{@Use}} the category is of course only "patched in" at runtime, so
STC can of course not see it in any way.
If there were some way in Groovy to do it like a {{@UseCategory}} extension
that can work with STC, that would be nice, then Spock could eventually be
modified to add this in the Spock AST transformation so that it is there when
STC hits the AST.
> STC with category classes or at least consistent error
> ------------------------------------------------------
>
> Key: GROOVY-12293
> URL: https://issues.apache.org/jira/browse/GROOVY-12293
> Project: Groovy
> Issue Type: Improvement
> Reporter: Björn Kautler
> Priority: Major
>
> If you use a category like `use(...) { ... }` the STC throws a compile error,
> that usage of categories is not possible with STC due to their dynamic nature.
> It would be nice if this limitation could be lifted. Why can't the category
> method not be resolved like other methods and under static compilation used
> directly?
> I probably miss something why this is not possible, but maybe then at least a
> consistent error could somehow be issued. If I have a Spock specification
> under STC (there is a PR to make this possible and I ported it to an AST
> transform that also makes it possible) and there have a `@Use(...)`
> annotation, then the compile error just says that the method is not found
> while expectation was that it was resolved from the category.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)