ASTParser p= ASTParser.newParser(AST.JLS3); p.setSource(newCuSource.toCharArray()); p.setUnitName(fCu.getElementName()); p.setProject(fCu.getJavaProject()); p.setCompilerOptions(RefactoringASTParser.getCompilerOptions(fCu)); CompilationUnit newCUNode= (CompilationUnit) p.createAST(null);
CompilationUnit newCUNode= new RefactoringASTParser(AST.JLS3).parse(newCuSource, fCu, true, null);
	public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {		pm.beginTask(RefactoringCoreMessages.ExtractConstantRefactoring_checking_preconditions, 4); 				/* Note: some checks are performed on change of input widget		 * values. (e.g. see ExtractConstantRefactoring.checkConstantNameOnChange())		 */ 				//TODO: possibly add more checking for name conflicts that might		//      lead to a change in behaviour				try {			RefactoringStatus result= new RefactoringStatus();						createConstantDeclaration();			fChange= fCuRewrite.createChange();			pm.worked(1);						TextEdit[] replaceEdits= createReplaceExpressionWithConstantEdits();			for (int i= 0; i < replaceEdits.length; i++) {				TextChangeCompatibility.addTextEdit(fChange, RefactoringCoreMessages.ExtractConstantRefactoring_replace, replaceEdits[i]); 			}			pm.worked(1);						String newCuSource= fChange.getPreviewContent(new NullProgressMonitor());			ASTParser p= ASTParser.newParser(AST.JLS3);			p.setSource(newCuSource.toCharArray());			p.setUnitName(fCu.getElementName());			p.setProject(fCu.getJavaProject());			p.setCompilerOptions(RefactoringASTParser.getCompilerOptions(fCu));			CompilationUnit newCUNode= (CompilationUnit) p.createAST(null);			IProblem[] newProblems= RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCuRewrite.getRoot());			for (int i= 0; i < newProblems.length; i++) {				IProblem problem= newProblems[i];				if (problem.isError())					result.addEntry(JavaRefactorings.createStatusEntry(problem, newCuSource));			}						fConstantTypeCache= null;			fCuRewrite.clearASTAndImportRewrites();			return result;		} finally {			pm.done();		}	}