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 2021/12/16 15:37:00 UTC

[jira] [Commented] (GROOVY-10403) @CompileStatic causes weird error "Access to java.lang.Object#windows is forbidden" with Groovy 4.0.0-rc-1

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

Eric Milles commented on GROOVY-10403:
--------------------------------------

The compiler is visiting method {{org.codehaus.groovy.ast.MethodNode@6c9caec5[java.lang.Object doCall(java.lang.Object) from org.spockframework.smoke.WithBlocksStatic$__spock_feature_0_0_closure1]}} with code like:
{code:groovy}
{
  return os.windows
}
{code}

There is no metadata on variable expression "os" so the compiler cannot determine the property and falls into {{StaticTypesCallSiteWriter#addPropertyAccessError}}.

Not sure where this comes from, but the method could be tagged with {{org.codehaus.groovy.transform.sc.StaticCompilationMetadataKeys.STATIC_COMPILE_NODE}} false in the node metadata to revert to dynamic compilation.

> @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)