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.
Introduce variable does not work properly in this case: To reproduce this bug: 1. Write this code (new keyword is important): someExpression; new MyClass.myMethod(); 2. Select |someExpression|, call function Introduce variable You get this wrong result: newfinal ExpressionDataType variableName = someExpression; MyClass.myMethod(); Expected result: final ExpressionDataType variableName = someExpression; new MyClass.myMethod(); Reproducable both 6.7b and 6.5.1.
Can you please attach specific example? thanks
Why this bug was moved into "hints" subcomponent? It's refactoring bug... >>Can you please attach specific example? Dummy example: "hello" new String("bug").getBytes();
Thanks for example The introduce variable is implemented in java/hint module, even it is located in Refactor menu, that's why the issue was moved. The code contains error before refactoring, so the AST is broken and the code is not updated correctly. If there is ';' behind the expression, the code is generated correctly. -> downgrading to P4
I think that this is very annoying bug, because I must write ';' at the end of line a then select whole line without ';' and then use 'Introduce variable'. I think that with ';' is not necessary selection, NB can automatically select all between ';'. Another smaller problem is that netbeans remove empty line before selected statement during this refactoring.
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss