rewrite.markAsReplaced(stmt.getTypeDeclaration(), newDeclaration);
rewrite.markAsReplaced(stmt.getTypeDeclaration(), newDeclaration, null);
	public void testTypeDeclarationStatement() throws Exception {		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);		StringBuffer buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("public class E {\n");		buf.append("    public void foo() {\n");		buf.append("        class A {\n");		buf.append("        }\n");		buf.append("    }\n");		buf.append("}\n");			ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);				CompilationUnit astRoot= createAST(cu);		NewASTRewrite rewrite= new NewASTRewrite(astRoot.getAST());				AST ast= astRoot.getAST();				TypeDeclaration type= findTypeDeclaration(astRoot, "E");		MethodDeclaration methodDecl= findMethodDeclaration(type, "foo");		Block block= methodDecl.getBody();		assertTrue("Parse errors", (block.getFlags() & ASTNode.MALFORMED) == 0);				List statements= block.statements();		assertTrue("Number of statements not 1", statements.size() == 1);		{ // replace expression			TypeDeclarationStatement stmt= (TypeDeclarationStatement) statements.get(0);						TypeDeclaration newDeclaration= ast.newTypeDeclaration();			newDeclaration.setName(ast.newSimpleName("X"));			newDeclaration.setInterface(true);							rewrite.markAsReplaced(stmt.getTypeDeclaration(), newDeclaration);		}						String preview= evaluateRewrite(cu, rewrite);				buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("public class E {\n");		buf.append("    public void foo() {\n");		buf.append("        interface X {\n");		buf.append("        }\n");		buf.append("    }\n");		buf.append("}\n");			assertEqualString(preview, buf.toString());	}