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 2023/10/18 20:32:00 UTC
[jira] [Assigned] (GROOVY-11199) inner class cannot set property of enclosing class that has a getter without a setter
[ https://issues.apache.org/jira/browse/GROOVY-11199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-11199:
------------------------------------
Assignee: Eric Milles
> inner class cannot set property of enclosing class that has a getter without a setter
> -------------------------------------------------------------------------------------
>
> Key: GROOVY-11199
> URL: https://issues.apache.org/jira/browse/GROOVY-11199
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 5.0.0-alpha-1, 5.0.0-alpha-2
> Reporter: Jason Garrett
> Assignee: Eric Milles
> Priority: Minor
>
> With static compilation, an inner class cannot set the value of a property of its enclosing class if that property has a getter but does not have a setter.
> {code:java}
> import groovy.transform.CompileStatic
> @CompileStatic // compiles without this
> class GetterOnly {
> String theString = ""
> String getTheString() {
> return theString
> }
> class InnerClass {
> void doStuff() {
> theString = "here!" // [Static type checking] - Cannot set read-only property: theString
> }
> }
> } {code}
> This example fails to compile with: [Static type checking] - Cannot set read-only property: theString
--
This message was sent by Atlassian Jira
(v8.20.10#820010)