This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
It seems that whenever I use the Introduce Variable refactoring, the new variable gets put in an inappropriate location. It is apparently always put at the start of the current method, which almost never works. E.g. void m() { // some stuff.. if (test) { // some stuff... String x = ...; use(x + ".suffix"); } } Now select 'x + ".suffix"' and use Introduce Var and call it y. You will get something like void m() { String y = x + ".suffix"; // some stuff.. if (test) { // some stuff... String x = ...; use(y); } } which of course does not compile. The refactoring needs to examine the expression for all local variables and introduce the new variable sometime after the definition of the last used local variable.
*** This issue has been marked as a duplicate of 60103 ***