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
}
		} else if (type == ASTNode.CONSTRUCTOR_INVOCATION) {
			ITypeBinding typeBinding= Bindings.getBindingOfParentType(selectedNode);
			if (typeBinding != null && !typeBinding.isAnonymous()) {
				targetBinding= typeBinding;
				arguments= ((ConstructorInvocation) selectedNode).arguments();
				recursiveConstructor= ASTResolving.findParentMethodDeclaration(selectedNode).resolveBinding();
			}			
		}
		if (targetBinding == null) {
			return;
		}
		IMethodBinding[] methods= targetBinding.getDeclaredMethods();
		ArrayList similarElements= new ArrayList();
		for (int i= 0; i < methods.length; i++) {
			IMethodBinding curr= methods[i];
			if (curr.isConstructor() && recursiveConstructor != curr) {
				similarElements.add(curr); 
			}
		}
		
		addParameterMissmatchProposals(context, problem, similarElements, selectedNode, arguments, proposals);
		
		if (targetBinding.isFromSource()) {
			ICompilationUnit targetCU= ASTResolving.findCompilationUnitForBinding(cu, astRoot, targetBinding);
			if (targetCU != null) {
				String[] args= new String[] { getMethodSignature( targetBinding.getName(), arguments) };
				String label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createconstructor.description", args); 
				Image image= JavaPluginImages.get(JavaPluginImages.IMG_MISC_PUBLIC);
				proposals.add(new NewMethodCompletionProposal(label, targetCU, selectedNode, arguments, targetBinding, 5, image));