Bug 74312

Summary: [refactoring] "Loosen" quick assist / refactoring
Product: [Eclipse Project] JDT Reporter: Tom Hofmann <eclipse>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

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.