Bug 74312 - [refactoring] "Loosen" quick assist / refactoring
Summary: [refactoring] "Loosen" quick assist / refactoring
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-20 11:56 EDT by Tom Hofmann CLA
Modified: 2010-11-04 06:44 EDT (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 Tom Hofmann CLA 2004-09-20 11:56:55 EDT
I20040914-gtk

I would like to see a refactoring / quick assist "Loosen Type Constraint" or
"Widen Type Constraint" that helps to widen a generic type bound in a method
signature as far as possible. This would be similar to the current "Use
supertype where possible" refactoring.

Consider the following examples:

public void write(List<? super Number> list) {
	list.add(new Integer(1));
	list.add(new Integer(2));
	list.add(new Integer(3));
}

"Loosen" should propose to widen the type bound to <? super Integer>, since that
is all that is needed by the current implementation.

public void read(List<? extends Integer> list) {
	Number num= list.get(0);
	System.out.println(obj);
}

"Loosen" should propose to widen the type bound to <? extends Number>, since
that is all that is needed by the current implementation.
Comment 1 Markus Keller CLA 2004-09-20 13:06:57 EDT
Fair request.