Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.0-JSR-3
-
None
-
None
-
Groovy jsr-03, java version "1.5.0_05", winXP
Description
Try this:
class Foo { private _xxx public void setBar(b) { println "before setting" _xxx = b println "after setting" } } def x = new Foo() x.bar = 1 x.bar = 2
When run, the output is:
C:\Temp>groovy settertest.groovy
before setting
after setting
before setting
after setting
Caught: groovy.lang.GroovyRuntimeException: Cannot read property: bar
even though the property bar was never read. If you add e.g.
println "goodbye"
as the last line of the script, the exception does not occur.
Attachments
Issue Links
- duplicates
-
GROOVY-2244 Write-only JavaBeans properties cannot be set via the '=' operator
- Closed