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/11/09 14:09:00 UTC
[jira] [Updated] (GROOVY-10815) SC: Access is forbidden for property-style access to getProperties() default Groovy method
[ https://issues.apache.org/jira/browse/GROOVY-10815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10815:
---------------------------------
Summary: SC: Access is forbidden for property-style access to getProperties() default Groovy method (was: [STC] Access is forbidden for property-style access to getProperties() default Groovy method)
> SC: Access is forbidden for property-style access to getProperties() default Groovy method
> ------------------------------------------------------------------------------------------
>
> Key: GROOVY-10815
> URL: https://issues.apache.org/jira/browse/GROOVY-10815
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 4.0.6
> Reporter: Damir Murat
> Assignee: Eric Milles
> Priority: Major
>
> With Groovy 4.0.6, the following code does not compile:
> {code:java}
> import groovy.transform.CompileStatic
> @CompileStatic
> class Person {
> String firstName
> String lastName
> }
> @CompileStatic
> class Runner {
> static void runMe() {
> Person person = new Person(firstName: "First", lastName: "Last")
> println person.getProperties()
> println person.properties // -> Does not compile with an error "Access to Person#properties is forbidden"
> }
> }
> Runner.runMe()
> Person person = new Person(firstName: "First", lastName: "Last")
> println person.getProperties()
> println person.properties
> {code}
> If I comment/delete {{CompileStatic}} on the Runner class, the code works as expected.
> Similarly, and probably related to the issue, my own extension methods starting with "{{{}get{}}}" cannot be accessed too.
> Tnx.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)