decl.setReturnType2(imports.addImport(binding.getReturnType(), ast));
decl.setReturnType2(newImports.addImport(binding.getReturnType(), ast, context));
	public static MethodDeclaration createImplementationStub(ICompilationUnit unit, ASTRewrite rewrite, ImportRewrite imports, AST ast, IMethodBinding binding, String type, CodeGenerationSettings settings, boolean deferred) throws CoreException {		MethodDeclaration decl= ast.newMethodDeclaration();		decl.modifiers().addAll(getImplementationModifiers(ast, binding, deferred));		decl.setName(ast.newSimpleName(binding.getName()));		decl.setConstructor(false);		ITypeBinding[] typeParams= binding.getTypeParameters();		List typeParameters= decl.typeParameters();		for (int i= 0; i < typeParams.length; i++) {			ITypeBinding curr= typeParams[i];			TypeParameter newTypeParam= ast.newTypeParameter();			newTypeParam.setName(ast.newSimpleName(curr.getName()));			ITypeBinding[] typeBounds= curr.getTypeBounds();			if (typeBounds.length != 1 || !"java.lang.Object".equals(typeBounds[0].getQualifiedName())) {//$NON-NLS-1$				List newTypeBounds= newTypeParam.typeBounds();				for (int k= 0; k < typeBounds.length; k++) {					newTypeBounds.add(imports.addImport(typeBounds[k], ast));				}			}			typeParameters.add(newTypeParam);		}		decl.setReturnType2(imports.addImport(binding.getReturnType(), ast));		List parameters= createParameters(unit, imports, ast, binding, decl);		List thrownExceptions= decl.thrownExceptions();		ITypeBinding[] excTypes= binding.getExceptionTypes();		for (int i= 0; i < excTypes.length; i++) {			String excTypeName= imports.addImport(excTypes[i]);			thrownExceptions.add(ASTNodeFactory.newName(ast, excTypeName));		}		String delimiter= StubUtility.getLineDelimiterUsed(unit);		if (!deferred) {			Block body= ast.newBlock();			decl.setBody(body);			String bodyStatement= ""; //$NON-NLS-1$			ITypeBinding declaringType= binding.getDeclaringClass();			if (Modifier.isAbstract(binding.getModifiers()) || declaringType.isAnnotation() || declaringType.isInterface()) {				Expression expression= ASTNodeFactory.newDefaultExpression(ast, decl.getReturnType2(), decl.getExtraDimensions());				if (expression != null) {					ReturnStatement returnStatement= ast.newReturnStatement();					returnStatement.setExpression(expression);					bodyStatement= ASTNodes.asFormattedString(returnStatement, 0, delimiter);				}			} else {				SuperMethodInvocation invocation= ast.newSuperMethodInvocation();				invocation.setName(ast.newSimpleName(binding.getName()));				SingleVariableDeclaration varDecl= null;				for (Iterator iterator= parameters.iterator(); iterator.hasNext();) {					varDecl= (SingleVariableDeclaration) iterator.next();					invocation.arguments().add(ast.newSimpleName(varDecl.getName().getIdentifier()));				}				Expression expression= invocation;				Type returnType= decl.getReturnType2();				if (returnType != null && (returnType instanceof PrimitiveType) && ((PrimitiveType) returnType).getPrimitiveTypeCode().equals(PrimitiveType.VOID)) {					bodyStatement= ASTNodes.asFormattedString(ast.newExpressionStatement(expression), 0, delimiter);				} else {					ReturnStatement returnStatement= ast.newReturnStatement();					returnStatement.setExpression(expression);					bodyStatement= ASTNodes.asFormattedString(returnStatement, 0, delimiter);				}			}			String placeHolder= CodeGeneration.getMethodBodyContent(unit, type, binding.getName(), false, bodyStatement, delimiter);			if (placeHolder != null) {				ASTNode todoNode= rewrite.createStringPlaceholder(placeHolder, ASTNode.RETURN_STATEMENT);				body.statements().add(todoNode);			}		}		if (settings.createComments) {			String string= CodeGeneration.getMethodComment(unit, type, decl, binding, delimiter);			if (string != null) {				Javadoc javadoc= (Javadoc) rewrite.createStringPlaceholder(string, ASTNode.JAVADOC);				decl.setJavadoc(javadoc);			}		}		if (settings.overrideAnnotation && JavaModelUtil.is50OrHigher(unit.getJavaProject())) {			addOverrideAnnotation(rewrite, decl, binding);		}		return decl;	}