Skip to content

Code assist does not add necessary "owner" qualifier when accepting owner property suggestions within 'with' closure #364

@mauromol

Description

@mauromol

Consider the following:

package test

class Test {
  static class Foo {
	  String someString = 'foo'
  }
  
  static class Bar {
	  String someString = 'bar'
	  Foo foo = new Foo()
	  
	  void doSomething() {
		  foo.with {
			  println "someString inside with closure = $someString"
			  println "someString of owner inside with closure = $owner.someString"
			  someS|
		  }
	  }
  }
  
  static main(args) {
	  Bar b = new Bar()
	  println "b.someString = $b.someString"
	  println "b.foo.someString = $b.foo.someString"
	  b.doSomething()
  }
}

Invoke code assist at "|": Greclipse correctly suggests both Foo.someString and Bar.someString, but if you choose any of those, it completes with just someString.
However, if I choose Bar.someString, I would expect code assist to change/complete my word as owner.someString, as this is the right way (AFAIK) to actually reference Bar.someString from there.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions