Skip to content

"Assign statement to new local variable" quickfix producing a compilation error when "return" is present #393

@mauromol

Description

@mauromol

This was inspired by the old GRECLIPSE-1523.

Consider the following:

package a 

class TestF { 
	public PrintStream test() { 
		return System.out 
	} 
} 

Highlight "System.out", press Ctrl+1 and choose "Assign statement to new local variable". This is the result:

return def temp = System.out

which produces a compilation error.

Probably, in this case that quickfix should not be available (just like in JDT), because a more proper quickfix is "Extract to local variable" (which, by the way, produces the correct result).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions