Community
Participate
Working Groups
When you use the "extract local variable" rafactor in a statement/block that receive parameters the result code may not has the same result as the original code. Example: ==================================================== ... int i; .... Matcher m; .... // i =0; int did = Integer.parseInt( m.group( ++i ) ); int ddd = Integer.parseInt( m.group( ++i ) ); int ddi = Integer.parseInt( m.group( ++i ) ); ==================================================== If the refactor "extract local variable" is used on the first "m.group( ++i )" The resulting code does not do the same thing... ==================================================== ... int i; .... Matcher m; .... // i =0; String didStr = m.group( ++i ); int did = Integer.parseInt( didStr ); int ddd = Integer.parseInt( didStr ); int ddi = Integer.parseInt( didStr ); ==================================================== In the resulting code the variable did, ddd, ddi will have the same value, and i will value 1 at the end of the code. In the original code did, ddd, ddi probably will have differente values and i will value 3 at the end. I think this glitch happen, because this refactor does no test if the parameters ( i in the case ) are modified in the code.
Move to JDT/UI.
*** This bug has been marked as a duplicate of bug 27740 ***