Bug 78688 [1.5] [Generics] Erroneous quick fix results generated for this code. [quick fix]
I had this code which needs fixing where marked. % cat Test.java import java.util.LinkedHashMap; public class Test<K, V> { public void check() { final LinkedHashMap<K, V> data = new LinkedHashMap<K, V>(); final Integer x = data.entrySet(); // this line needs fixing. } } <<<< So I did Ctrl-1 to get the quickfix and selected "Change type of 'x' to 'Set<Map.Entry<K,V>>'" - this gives a drop down of choices .. Set<Map.Entry<K,V>> Collection<Map.Entry<K,V>> Iterable<Map.Entry<K,V>> So I choose Iterable<Map.Entry<K,V>> but notice the code is inserted incorrectly -- I get final Iterable<Entry<K,V x = data.entrySet(); // this line needs fixing. ^^^^^ missing terminating >>
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/TypeChangeCompletionProposal.java
}
				} else if (parent instanceof VariableDeclarationExpression) {
					VariableDeclarationExpression varDecl= (VariableDeclarationExpression) parent;
					
					rewrite.set(varDecl, VariableDeclarationExpression.TYPE_PROPERTY, type, null);
					rewrite.set(declNode, VariableDeclarationFragment.EXTRA_DIMENSIONS_PROPERTY, new Integer(0), null);
				}
			} else if (declNode instanceof SingleVariableDeclaration) {
				SingleVariableDeclaration variableDeclaration= (SingleVariableDeclaration) declNode;
				rewrite.set(variableDeclaration, SingleVariableDeclaration.TYPE_PROPERTY, type, null);
				rewrite.set(variableDeclaration, SingleVariableDeclaration.EXTRA_DIMENSIONS_PROPERTY, new Integer(0), null);
			}
			
			
			final String KEY_TYPE= "type"; 
			addLinkedPosition(rewrite.track(type), true, KEY_TYPE);
			if (fOfferSuperTypeProposals) {
				ITypeBinding[] typeProposals= ASTResolving.getRelaxingTypes(ast, fNewType);
				for (int i= 0; i < typeProposals.length; i++) {
					addLinkedPositionProposal(KEY_TYPE, typeProposals[i]);
				}
			}
			return rewrite;
		}
		return null;
	}
	
	
}