Bug 102846 [quick fix] Convert to enhanced for loop does not remove obsolete import
I20050627-1435 (3.1) The 'Convert to enhanced for loop' quick fix does not remove the obsolete import java.util.Iterator in this example: import java.util.Iterator; import java.util.List; public class Try { public static void print(List<String> names) { for (Iterator iter= names.iterator(); iter.hasNext();) { String name= (String) iter.next(); System.out.println(name); } } }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ConvertIterableLoopProposal.java
}
	/**
	 * Is this proposal applicable?
	 * 
	 * @return <code>true</code> if it is applicable, <code>false</code> otherwise
	 */
	public final boolean isApplicable() {
		if (JavaModelUtil.is50OrHigher(getCompilationUnit().getJavaProject())) {
			for (final Iterator outer= fStatement.initializers().iterator(); outer.hasNext();) {
				final Expression initializer= (Expression) outer.next();
				if (initializer instanceof VariableDeclarationExpression) {
					final VariableDeclarationExpression declaration= (VariableDeclarationExpression) initializer;
					for (Iterator inner= declaration.fragments().iterator(); inner.hasNext();) {
						final VariableDeclarationFragment fragment= (VariableDeclarationFragment) inner.next();
						fragment.accept(new ASTVisitor() {
							public final boolean visit(final MethodInvocation node) {
								final IMethodBinding binding= node.resolveMethodBinding();
								if (binding != null) {
									final ITypeBinding type= binding.getReturnType();
									if (type != null) {
									final String qualified= type.getQualifiedName();
									if (qualified.startsWith("java.util.Enumeration<") || qualified.startsWith("java.util.Iterator<")) { 
										final Expression qualifier= node.getExpression();
										if (qualifier != null) {
											final ITypeBinding resolved= qualifier.resolveTypeBinding();
											if (resolved != null) {
												final ITypeBinding iterable= getSuperType(resolved, "java.lang.Iterable"); 
												if (iterable != null) {
													fExpression= qualifier;
													if (qualifier instanceof Name) {