[
https://issues.apache.org/jira/browse/GROOVY-11199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-11199.
----------------------------------
Fix Version/s: 5.0.0-alpha-3
Resolution: Fixed
https://github.com/apache/groovy/commit/ea26b2d55f2f736153e31f375a49c118ac96ab9d
> 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
> Fix For: 5.0.0-alpha-3
>
>
> 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)