Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.1
-
Fix Version/s: 1.7.2, 1.8-beta-1
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Create class Foo
class Foo {
static foo=2
static getFoo(){
return 3
}
}
and a script
import static Foo.foo print foo
This script calls getter getFoo and prints "3".
But if you delete declaration "static foo=2" from the class the script fails with MissingPropertyException.
IMHO the script should call getter in both cases.
Issue Links
- relates to
-
GROOVY-4153
Statically imported properties
-
Groovy has never (intentionally) supported
as anything other than a shorthand for getting to a foo field. But as this issue showed, there was an unintentional case where the property rather than the field was used.
Given that there is another issue open about this topic (
GROOVY-4153), instead of reopening this one, any further clarifications wrt desired behavior will occur as part of that issue.