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.

Bug 196658

Summary: Refactor Introduce method does not work properly
Product: java Reporter: ttokoly
Component: HintsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 7.0   
Hardware: PC   
OS: Linux   
URL: http://wiki.netbeans.org/TS_60_Refactoring2
Issue Type: DEFECT Exception Reporter:

Description ttokoly 2011-03-14 08:52:53 UTC
Product Version: NetBeans IDE Dev (Build 201103130400)
Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02
System: Linux version 2.6.32-29-generic running on i386; UTF-8; en_US (nb)

1. Unzip a project Refactoring to some work directory - there is link:
http://wiki.netbeans.org/wiki/images/0/0e/Refactoring_TS_60_Refactoring2.zip
2. Start IDE with a clean userdir
3. Invoke File | Open Project... action
4. Select unzipped project Refactoring
5. Scanning structure of project should be performed (It takes a while)

6. Open file packageA.ClassA
7. Select the code form mark //4 to //5
8. Call Refactor -> Introduce Method
9. Enter any name and confirm dialog 

According to the Refactoring TS ( http://wiki.netbeans.org/TS_60_Refactoring2 -> Method with return statement 2 ) expected result is that the new method with two parameters is created. One of the parameters is final the second is ordinary (not final). The method contains return statement. At the original place there is assignment of method's result to a single variable.

But there shows up method with only one parameter. Return statement is correct. Instead of second parameter there is created new variable witch is declared but no initialized, so error "variable c might not have been initialized" shows on return statement. Assignment of method's result at original place is correct.
Comment 1 Jan Becicka 2011-03-14 09:25:51 UTC
implemented as hint
Comment 2 Jan Lahoda 2011-04-11 12:00:56 UTC

*** This bug has been marked as a duplicate of bug 114371 ***