Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352785 - [extract method] Refactor > Extract Method with break statement in switch causes NPE
Summary: [extract method] Refactor > Extract Method with break statement in switch cau...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.8 M7   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-21 12:57 EDT by Shawn Lauzon CLA
Modified: 2012-04-16 14:05 EDT (History)
2 users (show)

See Also:


Attachments
Stack dump (5.06 KB, text/plain)
2011-07-21 12:58 EDT, Shawn Lauzon CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shawn Lauzon CLA 2011-07-21 12:57:27 EDT
Build Identifier: 20110615-0604

If I attempt to Refactor > Extract Method which includes a break statement inside a switch, an unexpected exception occurs, which is an NPE (will attach stack later).

It should give an error which says something like you can't refactor a method which includes multiple exit points, or something like that.





Reproducible: Always

Steps to Reproduce:
1. Write some code:
   public void foo(int i) {

    	switch (i) {
    	case 1:
         	if (true) {
        		break;
        	}
    	}
} 

2. Highlight the some code within the case 1 statement.

3. Choose Refactor > Extract Method
Comment 1 Shawn Lauzon CLA 2011-07-21 12:58:56 EDT
Created attachment 200107 [details]
Stack dump
Comment 2 Ayushman Jain CLA 2011-07-21 13:01:37 EDT
Moving to JDT/UI
Comment 3 Dani Megert CLA 2011-07-22 02:29:14 EDT
Used to work but got broken during 3.6.