You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
packagetestclassTest {
staticclassFoo {
String someString ='foo'String other ='other'
}
staticclassBar {
String someString ='bar'Foo foo =newFoo()
voiddoSomething() {
foo.with {
println"someString inside with closure = $someString"println"other inside with closure = $other"
}
}
}
staticmain(args) {
Bar b =newBar()
println"b.someString = $b.someString"println"b.foo.someString = $b.foo.someString"
b.doSomething()
}
}
Run the main method. You'll see that doSomething() prints foo, i.e. the someString reference within the with closure refers to Foo.someString. However, Greclipse thinks that is Bar.someString, as you can see by all of these facilities:
F3 over $someString
Ctrl+Click over $someString
"mark occurences" highlighting when you select $someString
Maybe it's just a problem of "precedence" between this/owner and delegate properties, because Greclipse behaves correctly with the other property (which is defined only in Foo class).
The text was updated successfully, but these errors were encountered:
Consider the following:
Run the main method. You'll see that
doSomething()
printsfoo
, i.e. thesomeString
reference within thewith
closure refers toFoo.someString
. However, Greclipse thinks that isBar.someString
, as you can see by all of these facilities:$someString
$someString
$someString
Maybe it's just a problem of "precedence" between this/owner and delegate properties, because Greclipse behaves correctly with the
other
property (which is defined only inFoo
class).The text was updated successfully, but these errors were encountered: