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.
NB 4.2 (200506151800) JDK 1.5.0_04 The introduced variable is added to the very begining of the appropriate method in front of others local declarations but it can be dependent on then. Example: int i=1; int b; b=i+1; introducing new variable lokalek from i+1 leads to this case: int lokalek = i + i; int i=1; int b; b=lokalek; in the first line the variable i is not declared yet.
The whole method: public void method() { int i=1; int b; b=/*begin*/ i+1 /*end*/; } Selection marks by /*begin*/ and /*end*/ Result: public void method() { int lokalek = i + 1; //here is error int i=1; int b; b=/*begin*/ lokalek /*end*/; }
*** Issue 60021 has been marked as a duplicate of this issue. ***
*** Issue 70208 has been marked as a duplicate of this issue. ***
IMHO a P2: a compilable source file is converted to an uncompilable source file by this transformation, with no warning; and not just in obscure border cases, but usually.
This functionality should be probably implemented differently - probably as a hint (similar to surround with...)
Anonymous to inner, Introduce variable and Extract method features are now (or will be) implemented in java/hints module.
Should not happen with the new impl. of introduce variable.
verified