Bug 15726 moves field comments from one field to another [quick fix]
20020508 public class A { int field; //field comment A(int fred){ _fred= fred; } } you are offered to create field _fred but then it steals the comment: int field; private int _fred; //field comment
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/astrewrite/ASTRewritingStatementsTest.java
assertTrue("Number of statements not 1", statements.size() == 1);			
			
			ThrowStatement statement= (ThrowStatement) statements.get(0);
			
			ClassInstanceCreation creation= ast.newClassInstanceCreation();
			creation.setName(ast.newSimpleName("NullPointerException"));
			creation.arguments().add(ast.newSimpleName("x"));
			
			rewrite.markAsReplaced(statement.getExpression(), creation);
		}
		
		{ 
			MethodDeclaration methodDecl= findMethodDeclaration(type, "goo");
			Block block= methodDecl.getBody();
			List statements= block.statements();
			assertTrue("Number of statements not 1", statements.size() == 1);			
			
			ThrowStatement statement= (ThrowStatement) statements.get(0);			
			
			ClassInstanceCreation creation= (ClassInstanceCreation) statement.getExpression();
			
			ASTNode newArgument= ast.newSimpleName("x");
			rewrite.markAsReplaced((ASTNode) creation.arguments().get(0), newArgument);
		}				
				
		ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal("", cu, rewrite, 10, null);
		proposal.getCompilationUnitChange().setSave(true);
		
		proposal.apply(null);