Is it possible to inline (and the other way around) variables with a NetBeans refactoring?
Something like this:
Something s = new Something();
render(s);
should become
render(new Something());
The ReSharper equivalent is Ctrl+R+I.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It seems that this functionality has been requested and subsequently integrated into 7.1. The RFE in question is Bug 57545 – Inline Method/Variable Refactoring and according to comment #17 has been integrated into
main_golden.Also according to comment #19 this feature will be included in version 7.1 which is in Beta now (download here) and according to the roadmap is due to be released on Dec 14, 2011
Edit
I downloaded NetBeans 7.1 Beta and successfully refactored your example into your requirement. To do this, I placed my cursor on the
sofSomething s = new Something();and from the context menu (right click) I selectedInline.... This brought up this warning:After clicking Preview you get the following diff:
After clicking on the
Do Refactoringbutton, the refactor is complete.