Bug 30553 Quick fix suggestions for unresolved type after "new" could be ordered better [quick fix]
(Build I20030107, GTK, Sun JDK 1.4.1-b21, Gentoo Linux 2.4.19) I often use statements like this: Map map = new HashMap(); If java.util.Map has been imported, but java.util.HashMap hasn't then there will be quick fix suggestions for 'HashMap'. The suggestions are: Change to 'Map' Import 'java.util.HashMap' ... I suggest that a better order would reverse the top two suggestions. ie: Import 'java.util.HashMap' Change to 'Map' ... I know there is an algorithm for determining the order of suggestions. When a suggestion is made to fix an unresolved type after a "new" statement, classes which can be instantiated should be shown higher than interfaces and abstract classes. Interfaces and abstract classes only make sense if an anonymous class is being created and this is much less common.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/UnresolvedElementsSubProcessor.java
}
		int kind= SimilarElementsRequestor.ALL_TYPES;
		
		ASTNode parent= selectedNode.getParent();
		switch (parent.getNodeType()) {
			case ASTNode.TYPE_DECLARATION:
				TypeDeclaration typeDeclaration=(TypeDeclaration) parent;
				if (typeDeclaration.superInterfaces().contains(selectedNode)) {					
					kind= SimilarElementsRequestor.INTERFACES;
				} else if (selectedNode.equals(typeDeclaration.getSuperclass())) {
					kind= SimilarElementsRequestor.CLASSES;
				}
				break;
			case ASTNode.METHOD_DECLARATION:
				MethodDeclaration methodDeclaration= (MethodDeclaration) parent;
				if (methodDeclaration.thrownExceptions().contains(selectedNode)) {
					kind= SimilarElementsRequestor.CLASSES;
				} else if (selectedNode.equals(methodDeclaration.getReturnType())) {
					kind= SimilarElementsRequestor.REF_TYPES | SimilarElementsRequestor.VOIDTYPE;
				}
				break;
			case ASTNode.INSTANCEOF_EXPRESSION:
				kind= SimilarElementsRequestor.REF_TYPES;
				break;
			case ASTNode.THROW_STATEMENT:
			case ASTNode.CLASS_INSTANCE_CREATION:
				kind= SimilarElementsRequestor.CLASSES;
				break;
			case ASTNode.SINGLE_VARIABLE_DECLARATION:
				int superParent= parent.getParent().getNodeType();