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 196683 - Refactor Introduce method does not work properly (ending with return)
Summary: Refactor Introduce method does not work properly (ending with return)
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jan Lahoda
URL: http://wiki.netbeans.org/TS_60_Refact...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-14 15:17 UTC by ttokoly
Modified: 2011-03-28 11:23 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ttokoly 2011-03-14 15:17:51 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. Mark code between //7 and //8
8. Refactor -> Introduce Method
9. Perform refactoring
10. Undo changes
11. Try to change the continue command to break and return respectively. 

According to the Refactoring TS ( http://wiki.netbeans.org/TS_60_Refactoring2
-> Ending with return/break/continue ) expected result is that in the step 3 a new method is created. The original selection is replaced with method call and the last statement ( continue; ) stays as it is.

In continue and break case is everything alright, but in case where you change the statement to the return, some unexpected behavior shows up -> return statement doesn't stay as it is and in created method is return statement empty.
Comment 1 Jan Becicka 2011-03-14 15:42:37 UTC
implemented in hints module.
Comment 2 Jan Lahoda 2011-03-15 12:35:17 UTC
http://hg.netbeans.org/jet-main/rev/a9314ebd0aa8
Comment 3 Quality Engineering 2011-03-16 09:43:39 UTC
Integrated into 'main-golden', will be available in build *201103160400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a9314ebd0aa8
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #196683: IntroduceMethod should not mangle assignments and return statements.
Comment 4 ttokoly 2011-03-28 11:23:44 UTC
Verified! Works for me. Thanks.