Assert.assertFalse(stmts.isEmpty());
return (Statement) stmts.get(stmts.size()-1);
}
public static CompilationUnit parseCode(String qualifiedCompUnitName, String code) throws CoreException {
ASTParser parser = ASTParser.newParser(AST.JLS3);
CompilationUnit node;
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("CrystalTest");
project.open(null /* IProgressMonitor */);
IJavaProject javaProject = JavaCore.create(project);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setProject(javaProject);
parser.setSource(code.toCharArray());
parser.setUnitName("/CrystalTest/" + qualifiedCompUnitName);
parser.setResolveBindings(true);
node = (CompilationUnit) parser.createAST(null);
Message[] msgs = node.getMessages();
if(msgs.length > 0) {
StringBuffer errs = new StringBuffer();
errs.append("Compiler problems for ");