Jochen Eddelbuettel created GROOVY-9379:
-------------------------------------------
Summary: Binding shadows getters in script or base script
Key: GROOVY-9379
URL: https://issues.apache.org/jira/browse/GROOVY-9379
Project: Groovy
Issue Type: Bug
Components: groovy-runtime
Affects Versions: 3.0.0-rc-2
Environment: CentOS 8, OpenJDK 11
Reporter: Jochen Eddelbuettel
{code:java}
boolean isPasswordOK() { false }
binding.setVariable("passwordOK", true)
if (passwordOK) print "You're in"
{code}
Accessing a variable available in the binding takes precedent over utilizing a
getter. This is extremely risky if the script author doesn't have full control
over the binding and forgets to call all his getters explicitly, especially
when they come from a BaseScript and he/she uses the code suggestions from
IntelliJ, which show any getters as simple property names.
The expected behaviour of the code above, should be NOT to let anyone in.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)