Bug 38892 ASTRewrite should support copying nodes more than once.
M1 Try is result currently in an exception: org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: assertion failed; Node used as more than one copy source at java.lang.Throwable.<init>(Throwable.java) at java.lang.Throwable.<init>(Throwable.java) at org.eclipse.jdt.internal.corext.Assert$AssertionFailedException.<init> (Assert.java:55) at org.eclipse.jdt.internal.corext.Assert.isTrue(Assert.java:136) at org.eclipse.jdt.internal.corext.dom.ASTRewrite.createCopy (ASTRewrite.java:289)
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/astrewrite/ASTRewritingTypeDeclTest.java
TypeDeclaration type= findTypeDeclaration(astRoot, "E");
		MethodDeclaration methodDecl= findMethodDeclaration(type, "foo");
		List arguments= methodDecl.parameters();
		{ 
			SingleVariableDeclaration decl= (SingleVariableDeclaration) arguments.get(0);
			
			SingleVariableDeclaration modifierNode= ast.newSingleVariableDeclaration();
			modifierNode.setModifiers(Modifier.FINAL);
			modifierNode.setExtraDimensions(1);
			
			rewrite.markAsModified(decl, modifierNode);
			
			ArrayType newVarType= ast.newArrayType(ast.newPrimitiveType(PrimitiveType.FLOAT), 2);
			rewrite.markAsReplaced(decl.getType(), newVarType);
			
			Name newName= ast.newSimpleName("count");
			rewrite.markAsReplaced(decl.getName(), newName);
		}
		{ 
			SingleVariableDeclaration decl= (SingleVariableDeclaration) arguments.get(1);
			
			SingleVariableDeclaration modifierNode= ast.newSingleVariableDeclaration();
			modifierNode.setModifiers(0);
			modifierNode.setExtraDimensions(decl.getExtraDimensions()); 
			
			rewrite.markAsModified(decl, modifierNode);
			
			Type newVarType= ast.newPrimitiveType(PrimitiveType.FLOAT);
			rewrite.markAsReplaced(decl.getType(), newVarType);
		}