Bug 80996 [Quick Fix] Incorrect return type of created method
Eclipse Version: 3.1.0 Build id: 200412081200 Place the following code in Eclipse - The class name is QuickFixEquals. package eclipse.bug; import java.util.List; public class QuickFixEquals { public boolean hasChildren() { if(getContentSpec().equals("Test")) return true; return false; } } Note that the code is importing java.util.List This would give a compilation error with a quick fix option. On applying QuickFix the following code is generated: private List getContentSpec() { // TODO Auto-generated method stub return null; } I would expect the return type to be Object - but it turned out to be List! [If you remove the import statement, it correctly sets the return type of getContentSpec to Object.] If the original class was import java.util.ArrayList; import java.util.List; public class QuickFixEquals { public boolean hasChildren() { if(getContentSpec().equals("Test")) return true; return false; } public List<String> getList() { return new ArrayList<String>(); } } The QuickFix creates the following method - private AbstractList<E> getContentSpec() { // TODO Auto-generated method stub return null; }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ASTResolving.java
}
		if (type.isCapture()) {
			type= type.getWildcard();
		}
		
		if (type.isWildcardType()) {
			if (noWildcards) {
				return false;
			}
			if (type.getBound() != null) {
				return isUseableTypeInContext(type.getBound(), context, noWildcards);
			}
		}
		return true;
	}
		
	/**
	 * Use this method before creating a type for a wildcard. Either to assign a wildcard to a new type or for a type to be assigned.
	 * @param wildcardType the wildcard type to normalize
	 * @param isBindingToAssign If true, then a new receiver type is searched (X x= s), else the type of a sender (R r= x)
	 * @return Returns the normalized binding or null when only the 'null' binding 
	 */
	public static ITypeBinding normalizeWildcardType(ITypeBinding wildcardType, boolean isBindingToAssign, AST ast) {
		ITypeBinding bound= wildcardType.getBound();
		if (isBindingToAssign) {
			if (bound == null || !wildcardType.isUpperbound()) {
				return ast.resolveWellKnownType("java.lang.Object"); 
			}
		} else {
			if (bound == null || wildcardType.isUpperbound()) {