Bug 43558

Summary: [extract method] allow changing the type of a parameters
Product: [Eclipse Project] JDT Reporter: Thorsten Schäfer <Uni>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: mn
Version: 3.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Thorsten Schäfer CLA 2003-09-24 05:37:09 EDT
Consider you have a method with code like this:

try {
 ...
} catch (IOException e) {
 String errorstring = "Error: ";
 // do some work
 log.error(errorstring, e);
}

If you want to extract the whole code in the catch statement, you have one 
parameter with the name e of type IOException. You can change the name, but 
not the type of this parameter. It would be nice, if you could also change the 
type (e.g. show a tree with all super type and the user could decide to use 
Exception as type in the example above).
Comment 1 Dirk Baeumer CLA 2003-09-24 06:17:38 EDT
This isn't so easy since a super class might not be suficient API wise.
Comment 2 Thorsten Schäfer CLA 2003-10-18 05:14:32 EDT
I just saw this functionality elsewere:
If you make a method call and the used method throws for example an 
IOException and you don't throw an exception in the caller method or have a 
try-catch statement. Then you can use quickfix to add a try-catch or to make 
the caller method throw the exception. If you select the second alternative, 
in M3 there will be added an IOException but you can also select to throw an 
Exception or Throwable. Probably this code can be reused for this issue.