On 26.06.20 17:52, OCsite wrote:
Jochen,
On 26 Jun 2020, at 17:33, Jochen <blackd...@gmx.org
<mailto:blackd...@gmx.org>> wrote:
On 26.06.20 17:21, Jochen Theodorou wrote:
[...]
public class X {
private String foo;
public String getFoo(){ return this.foo; }
public void setFoo(String foo){ this.foo = foo; }
}
This works perfectly fine in Java
Correct me please if I am wrong, but the reason it work in the thing is
that in Java /this.foo/ is something completely different than in Groovy.
the point was about migrating Java code to Groovy though - the reason
why we have many constructs in Groovy we do not really need.
[...]
What if there's a case when someone /would/ want a limited recursion?
def getX() { some_condition?this.x:1 }
That said, an error would be infinitely better than the current behaviour :)
then call a method that does this and do the recursion on that method.
If we call about migrated Java code, where Groovy idioms have been used,
then you will not see "getFoo(){ return this.foo; }" or "private String
foo;", you will see "String foo" and all problems are solved. My concern
is really solely about the migration story, of Java code executed in Groovy.
bye Jochen