Bug 51076 Quick fix misses and presents wrong name for target field class
Observe this example: public class Test { class Foo { void foo() { x = 4; } } void foo() { bar(new Runnable() { public void run() { x = 5; } }); } void bar(Runnable runner) { } } Quick-fix markers are activated for "x = 4" and "x = 5". For "x = 4", there is no suggestion to add a field to 'Test'. For "x = 5", there is a suggestion to add a field to ''. This should be 'Test'
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/UnresolvedElementsSubProcessor.java
Expression expression= access.getExpression();
				if (expression != null) {
					binding= expression.resolveTypeBinding();
					if (binding != null) {
						node= access.getName();
					}
				}
				break;
			case ASTNode.SUPER_FIELD_ACCESS:
				binding= declaringTypeBinding.getSuperclass();
				node= ((SuperFieldAccess) selectedNode).getName();
				break;
			default:	
		}
		
		if (node == null) {
			return;
		}		
		
		if (typeKind != 0) {
			int relevance= Character.isUpperCase(ASTResolving.getSimpleName(node).charAt(0)) ? 3 : 0;
			addSimilarTypeProposals(typeKind, cu, node, relevance + 1, proposals);
			addNewTypeProposals(cu, node, SimilarElementsRequestor.REF_TYPES, relevance, proposals);
		}
		
		if (!suggestVariableProposals) {
			return;
		}
		
		SimpleName simpleName= node.isSimpleName() ? (SimpleName) node : ((QualifiedName) node).getName();