Jason Garrett created GROOVY-11199:
--------------------------------------
Summary: 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-2, 5.0.0-alpha-1
Reporter: Jason Garrett
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)