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 || typeBounds[0] != ast.resolveWellKnownType("java.lang.Object")) { List newTypeBounds= newTypeParam.typeBounds(); for (int k= 0; k < typeBounds.length; k++) { newTypeBounds.add(imports.addImport(typeBounds[k], ast)); } } typeParameters.add(newTypeParam); }
	private MethodDeclaration createNewMethodDeclaration(AST ast, IMethodBinding binding, ASTRewrite rewrite, String typeName, CodeGenerationSettings commentSettings) throws CoreException {		ImportRewrite imports= getImportRewrite();				MethodDeclaration decl= ast.newMethodDeclaration();		decl.modifiers().addAll(ASTNodeFactory.newModifiers(ast, binding.getModifiers() & ~Modifier.ABSTRACT));		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++) {			//typeParameters.add(imports.addImport(typeParams[i], ast));		//}						decl.setReturnType2(imports.addImport(binding.getReturnType(), ast));				List parameters= decl.parameters();		ITypeBinding[] params= binding.getParameterTypes();		String[] paramNames= getArgumentNames(binding);		for (int i= 0; i < params.length; i++) {			SingleVariableDeclaration var= ast.newSingleVariableDeclaration();			var.setType(imports.addImport(params[i], ast));			var.setName(ast.newSimpleName(paramNames[i]));			parameters.add(var);		}						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));		}				Block body= ast.newBlock();		decl.setBody(body);			String bodyStatement= ""; //$NON-NLS-1$		Expression expression= ASTNodeFactory.newDefaultExpression(ast, decl.getReturnType2(), decl.getExtraDimensions());		if (expression != null) {			ReturnStatement returnStatement= ast.newReturnStatement();			returnStatement.setExpression(expression);			bodyStatement= ASTNodes.asFormattedString(returnStatement, 0, String.valueOf('\n'));		}		String placeHolder= CodeGeneration.getMethodBodyContent(getCompilationUnit(), typeName, binding.getName(), false, bodyStatement, String.valueOf('\n')); 			if (placeHolder != null) {			ASTNode todoNode= rewrite.createStringPlaceholder(placeHolder, ASTNode.RETURN_STATEMENT);			body.statements().add(todoNode);		}				if (commentSettings != null) {			String string= CodeGeneration.getMethodComment(getCompilationUnit(), typeName, decl, binding, String.valueOf('\n'));			if (string != null) {				Javadoc javadoc= (Javadoc) rewrite.createStringPlaceholder(string, ASTNode.JAVADOC);				decl.setJavadoc(javadoc);			}		}		return decl;	}