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
private MethodDeclaration getStub(ASTRewrite rewrite, ASTNode targetTypeDecl) throws CoreException {
		AST ast= targetTypeDecl.getAST();
		MethodDeclaration decl= ast.newMethodDeclaration();
		
		decl.setConstructor(isConstructor());
		decl.setModifiers(evaluateModifiers(targetTypeDecl));
		decl.setName(ast.newSimpleName(getMethodName()));
		
		List arguments= fArguments;
		List params= decl.parameters();
		
		int nArguments= arguments.size();
		ArrayList takenNames= new ArrayList(nArguments);
		IVariableBinding[] declaredFields= fSenderBinding.getDeclaredFields();
		for (int i= 0; i < declaredFields.length; i++) { 
			takenNames.add(declaredFields[i].getName());
		}
		
		for (int i= 0; i < arguments.size(); i++) {
			Expression elem= (Expression) arguments.get(i);
			SingleVariableDeclaration param= ast.newSingleVariableDeclaration();
			
			String argTypeKey= "arg_type_" + i; 
			Type type= evaluateParameterTypes(ast, elem, argTypeKey);
			param.setType(type);
			
			String argNameKey= "arg_name_" + i; 
			String name= evaluateParameterNames(takenNames, elem, type, argNameKey);
			param.setName(ast.newSimpleName(name));