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
if (!suggestVariablePropasals) {
			return;
		}
		
		SimpleName simpleName= node.isSimpleName() ? (SimpleName) node : ((QualifiedName) node).getName();
		addSimilarVariableProposals(cu, astRoot, simpleName, proposals);
		
		ICompilationUnit targetCU= ASTResolving.findCompilationUnitForBinding(cu, astRoot, binding);
		ITypeBinding senderBinding= binding != null ? binding : declaringTypeBinding;
		if (senderBinding.isFromSource() && targetCU != null && JavaModelUtil.isEditable(targetCU)) {
			String label;
			Image image;
			if (binding == null) {
				label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createfield.description", simpleName.getIdentifier()); 
				image= JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PRIVATE);
			} else {
				label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createfield.other.description", new Object[] { simpleName.getIdentifier(), binding.getName() } ); 
				image= JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PUBLIC);
			}
			proposals.add(new NewVariableCompletionProposal(label, targetCU, NewVariableCompletionProposal.FIELD, simpleName, senderBinding, 6, image));
			if (binding == null && senderBinding.isAnonymous()) {
				ASTNode anonymDecl= astRoot.findDeclaringNode(senderBinding);
				if (anonymDecl != null) {
					senderBinding= Bindings.getBindingOfParentType(anonymDecl.getParent());
					if (!senderBinding.isAnonymous()) {
						label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createfield.other.description", new Object[] { simpleName.getIdentifier(), senderBinding.getName() } ); 
						image= JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PUBLIC);
						proposals.add(new NewVariableCompletionProposal(label, targetCU, NewVariableCompletionProposal.FIELD, simpleName, senderBinding, 6, image));
					}