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
ASTRewrite rewrite= new ASTRewrite(astRoot);
		assertTrue("Errors in AST", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
		AST ast= astRoot.getAST();
		{ 
			TypeDeclaration type= findTypeDeclaration(astRoot, "E");
			
			
			TypeDeclaration modifiedNode= ast.newTypeDeclaration();
			modifiedNode.setInterface(type.isInterface());  
			modifiedNode.setModifiers(Modifier.PUBLIC | Modifier.FINAL);
			rewrite.markAsModified(type, modifiedNode);				
		
			List superInterfaces= type.superInterfaces();
			assertTrue("Has super interfaces", !superInterfaces.isEmpty());
			
			SimpleName newSuperinterface= ast.newSimpleName("Cloneable");
			superInterfaces.add(0, newSuperinterface);
			rewrite.markAsInserted(newSuperinterface);
			
			List members= type.bodyDeclarations();
			assertTrue("Has declarations", !members.isEmpty());
			
			assertTrue("Cannot find inner class", members.get(0) instanceof TypeDeclaration);
			TypeDeclaration innerType= (TypeDeclaration) members.get(0);
/*		bug 22161
			SimpleName newSuperclass= ast.newSimpleName("Exception");
			innerType.setSuperclass(newSuperclass);
			rewrite.markAsInserted(newSuperclass);
*/
			FieldDeclaration newField= createNewField(ast, "fCount");