Bug 40342 quickfix from anonymous class creates wrong visibility method
------------------B.java-------------- package b; public class B { } -------------------------------------- ------------------A.java-------------- package a; import b.B; public class A { void method() { I i = new I() { public void method() { B.quickFixMethod(); //<-- use quickfix here } }; } } interface I { void method(); } ----------------------------------------- if you use quickfix to create the missing method quickfix produces: protected static void quickFixMethod() which is not visible from A.java it should be public!
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/NewMethodCompletionProposal.java
}
			MethodDeclaration newStub= getStub(rewrite, newTypeDecl);
			
			if (isConstructor()) {
				members.add(findConstructorInsertIndex(members), newStub);
			} else if (!fIsInDifferentCU) {
				members.add(findMethodInsertIndex(members, fNode.getStartPosition()), newStub);
			} else {
				members.add(newStub);
			}
			rewrite.markAsInserted(newStub);
			if (!fIsInDifferentCU) {
				Name invocationName= getInvocationName();
				if (invocationName != null) {
					markAsLinked(rewrite, invocationName, true, KEY_NAME);
				}				
			}
			markAsLinked(rewrite, newStub.getName(), false, KEY_NAME);  
			if (!newStub.isConstructor()) {
				markAsLinked(rewrite, newStub.getReturnType(), false, KEY_TYPE);  
			}			
			
			return rewrite;
		}
		return null;
	}
	
	private boolean isConstructor() {
		return fNode.getNodeType() != ASTNode.METHOD_INVOCATION && fNode.getNodeType() != ASTNode.SUPER_METHOD_INVOCATION;
	}