Skip to content

Cannot start refactoring from within with { } closure #1092

@mauromol

Description

@mauromol

Consider this (very similar to #1091 , but here we use @CompileStatic in Test63 class):

package test62

class GBean {
	String fooBar
	String bar
}

and this:

package test62
import groovy.transform.CompileStatic
@CompileStatic
class Test63 {
	void doSomething() {
		def g = new GBean()
		g.with { 
			fooBar = 'foo'
			bar = 'bar'
		}
	}
}

Now go to Test63, highlight fooBar and hit Alt+Shift+R to rename: the status bar shows "No positions found. Cannot do refactoring..." and rename cannot be done. It seems like fooBar is not recognized as a reference to GBean.fooBar. If you remove @CompileStatic from Test63, you can do the renaming (although then #1091 holds).

If you try to do the refactoring from GBean.fooBar, even with @CompileStatic in place you can do the renaming and you get the exact same result as per #1091.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions