Bug 43558 - [extract method] allow changing the type of a parameters
Summary: [extract method] allow changing the type of a parameters
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-24 05:37 EDT by Thorsten Schäfer CLA
Modified: 2008-12-01 09:39 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.