[
https://issues.apache.org/jira/browse/GROOVY-10403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17460901#comment-17460901
]
Eric Milles edited comment on GROOVY-10403 at 12/16/21, 5:38 PM:
-----------------------------------------------------------------
This method from {{org.spockframework.compiler.SpecRewriter}} is where "def" is
transformed to "void". If "ClassHelper.VOID_TYPE" is replaced by
"ClassHelper.VOID_TYPE.getPlainNodeReference(false)" you should be good to go.
{code:java}
private MethodNode copyMethod(MethodNode method, String newName) {
// can't hurt to set return type to void
MethodNode newMethod = new MethodNode(newName, method.getModifiers(),
ClassHelper.VOID_TYPE, method.getParameters(), method.getExceptions(),
method.getCode());
{code}
You should inspect your code for any other direct uses of ClassHelper shared
instances. If you could be modifying them with node metadata to type
annotations, you will want to make a redirected instance there as well.
was (Author: emilles):
This method from {{org.spockframework.compiler.SpecRewriter}} is where "def" is
transformed to "void". If "ClassHelper.VOID_TYPE" is replaced by
"ClassHelper.VOID_TYPE.getPlainNodeReference()" you should be good to go.
{code:java}
private MethodNode copyMethod(MethodNode method, String newName) {
// can't hurt to set return type to void
MethodNode newMethod = new MethodNode(newName, method.getModifiers(),
ClassHelper.VOID_TYPE, method.getParameters(), method.getExceptions(),
method.getCode());
{code}
You should inspect your code for any other direct uses of ClassHelper shared
instances. If you could be modifying them with node metadata to type
annotations, you will want to make a redirected instance there as well.
> @CompileStatic causes weird error "Access to java.lang.Object#windows is
> forbidden" with Groovy 4.0.0-rc-1
> ----------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-10403
> URL: https://issues.apache.org/jira/browse/GROOVY-10403
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.0-rc-1
> Reporter: Leonard Brünings
> Priority: Major
>
> We have a weird error with Groovy 4.0.0-rc1
> https://github.com/spockframework/spock/runs/4422060586?check_suite_focus=true#step:8:111
> which fails for this line
> https://github.com/leonard84/spock/blob/47a3a69b0f53c8e1dd1a576331c8d9933e761ac8/spock-specs/src/test/groovy/org/spockframework/smoke/WithBlocksStatic.groovy#L29
--
This message was sent by Atlassian Jira
(v8.20.1#820001)