Bug 39473 [quick fix] "Create method" quickfix offers to create duplicate method in enclosing type
200306250800 1. have a class, e.g. public class MyAction implements IEditorActionDelegate { public void run(IAction action) {} void myMethod() { Runnable r= new Runnable() { public void run() { Action a; <HERE> run(a); } } } } 2. correctly, an error is displayed at <LINE> 3. Quickfix offers to create a local method matching the parameter, which is fine, but also: - Change method run(IAction) to run(IAction) which is idempotent - Create method run(IAction) in MyAction The latter inserts a method run(Action) in the enclosing type which will be marked as a duplicate. -> Enhancement and fix request: add quickfix "change to call to enclosing type" should produce the following code at <LINE> MyAction.this.run(a);
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/UnresolvedElementsSubProcessor.java
int diffIndex= indexOfDiff[i];
					Expression arg= (Expression) arguments.get(diffIndex);
					String name= arg instanceof SimpleName ? ((SimpleName) arg).getIdentifier() : null;					
					changeDesc[diffIndex]= new EditDescription(argTypes[diffIndex], name);
				}
				String[] args=  new String[] { getMethodSignature(methodBinding, !targetCU.equals(cu)), getMethodSignature(methodBinding.getName(), arguments) };
				String label;
				if (methodBinding.isConstructor()) {
					label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.changeparamsignature.constr.description", args); 
				} else {
					label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.changeparamsignature.description", args); 
				}
				Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
				ChangeMethodSignatureProposal proposal= new ChangeMethodSignatureProposal(label, targetCU, nameNode, methodBinding, changeDesc, 7, image);
				proposals.add(proposal);
			}
		}
	}	
	
	private static ITypeBinding[] getArgumentTypes(List arguments) {
		ITypeBinding[] res= new ITypeBinding[arguments.size()];
		for (int i= 0; i < res.length; i++) {
			Expression expression= (Expression) arguments.get(i);
 			ITypeBinding curr= expression.resolveTypeBinding();
			if (curr == null) {
				return null;
			}
			curr= Bindings.normalizeTypeBinding(curr);
			if (curr == null) {
				curr= expression.getAST().resolveWellKnownType("java.lang.Object");