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
ASTNode expr= (ASTNode) arguments.get(index);
		if (expr.getLength() > 18) {
			return def;
		}
		try {
			String str= cu.getBuffer().getText(expr.getStartPosition(), expr.getLength());
			for (int i= 0; i < str.length(); i++) {
				if (Strings.isLineDelimiterChar(str.charAt(i))) {
					return def;
				}
			}
			ASTMatcher matcher= new ASTMatcher();
			for (int i= 0; i < arguments.size(); i++) {
				if (i != index && matcher.safeSubtreeMatch(expr, arguments.get(i))) {
					return def;
				}
			}
			return '\'' + str + '\'';
			
		} catch (JavaModelException e) {
			JavaPlugin.log(e);
		}
		return def;
	}
	private static void doMoreArguments(IInvocationContext context, IProblemLocation problem, ASTNode invocationNode, List arguments, ITypeBinding[] argTypes, IMethodBinding methodBinding, Collection proposals) throws CoreException {
		ITypeBinding[] paramTypes= methodBinding.getParameterTypes();
		int k= 0, nSkipped= 0;
		int diff= argTypes.length - paramTypes.length;
		int[] indexSkipped= new int[diff];
		for (int i= 0; i < argTypes.length; i++) {