ASTNode placeHolder= rewrite.createCopyPlaceholder(left.getIndex()); rewrite.markAsReplaced(right.getIndex(), placeHolder);
ASTNode placeHolder= rewrite.createCopyTarget(left.getIndex()); rewrite.markAsReplaced(right.getIndex(), placeHolder, null);
	public void testArrayAccess() 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("    int[] o= new int[] { 1, 2, 3 };\n");				buf.append("    public void foo() {\n");		buf.append("        o[3 /* comment*/ - 1]= this.o[3 - 1];\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();				assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);		TypeDeclaration type= findTypeDeclaration(astRoot, "E");		MethodDeclaration methodDecl= findMethodDeclaration(type, "foo");		Block block= methodDecl.getBody();		List statements= block.statements();		assertTrue("Number of statements not 1", statements.size() == 1);		{	// replace left hand side index, replace right hand side index by left side index			ExpressionStatement stmt= (ExpressionStatement) statements.get(0);			Assignment assignment= (Assignment) stmt.getExpression();						ArrayAccess left= (ArrayAccess) assignment.getLeftHandSide();			ArrayAccess right= (ArrayAccess) assignment.getRightHandSide();						NumberLiteral name= ast.newNumberLiteral("1");			rewrite.markAsReplaced(left.getIndex(), name);						ASTNode placeHolder= rewrite.createCopyPlaceholder(left.getIndex());			rewrite.markAsReplaced(right.getIndex(), placeHolder);						SimpleName newName= ast.newSimpleName("o");			rewrite.markAsReplaced(right.getArray(), newName);		}						String preview= evaluateRewrite(cu, rewrite);				buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("public class E {\n");		buf.append("    int[] o= new int[] { 1, 2, 3 };\n");				buf.append("    public void foo() {\n");		buf.append("        o[1]= o[3 /* comment*/ - 1];\n");		buf.append("    }\n");		buf.append("}\n");						assertEqualString(preview, buf.toString());	}