Closed yloiseau closed 7 years ago
Not sure it's a bug .... The current method resolution looks in order for:
name
, the property finder looks for (in order) :
getName
isName
setName
name
, it looks for a method named name
+ number of arguments required.So basically it's the normal behavior so now 2 options, either we say it's not a bug and we document the Method finding algo. or we modify the algo.
For me current behavior sounds wise because the classic Java methods (the explicit ones) are used in the first place.
I think it qualifies as a bug, since in my example, there is no way to call the value()
method.
What would be the correct order? Method, property then augmentation ?
I think so. IMO we should involve the "magic" only when "normal" method fails. Don't know if others agree @Artpej @jponge
I'd say it can be considered bad design to have both a "bean" interface and a fluent one (as in my example) but it could be useful (e.g. for framework compatibility). Anyway, we should not make such objects unusable.
We introduced fluent properties, that allows to call
setValue(v)
as justvalue(v)
andgetValue()
orisValue()
asvalue()
. However, if avalue()
method exists, the property is called instead.For instance, given:
and
javac A.java && golo golo --files test.golo
will printgetter
, while42
is expected