use of com.sun.source.util.TaskEvent in project buck by facebook.
the class TaskListenerWrapperTest method testIgnoresNullListeners.
@Test
public void testIgnoresNullListeners() {
TaskListenerWrapper wrapper = new TaskListenerWrapper(null);
TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE);
wrapper.started(e);
wrapper.finished(e);
// Expect no crashes
}
use of com.sun.source.util.TaskEvent in project buck by facebook.
the class TaskListenerWrapperTest method testChainsToInnerOnFinish.
@Test
public void testChainsToInnerOnFinish() {
TaskListenerWrapper wrapper = new TaskListenerWrapper(innerListener);
TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE);
innerListener.finished(e);
EasyMock.replay(innerListener);
wrapper.finished(e);
EasyMock.verify(innerListener);
}
use of com.sun.source.util.TaskEvent in project buck by facebook.
the class TaskListenerWrapperTest method testChainsToInnerOnStart.
@Test
public void testChainsToInnerOnStart() {
TaskListenerWrapper wrapper = new TaskListenerWrapper(innerListener);
TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE);
innerListener.started(e);
EasyMock.replay(innerListener);
wrapper.started(e);
EasyMock.verify(innerListener);
}
use of com.sun.source.util.TaskEvent in project buck by facebook.
the class TracingTaskListenerTest method testTracesBeforeChainingOnFinish.
/**
* In order for TracingTaskListener to record the most accurate timings for time spent in javac,
* it needs to trace finish events before it chains to the next listener.
*/
@Test
public void testTracesBeforeChainingOnFinish() {
TaskEvent parseEvent = new TaskEvent(TaskEvent.Kind.PARSE, createMock(JavaFileObject.class));
mockControl.checkOrder(true);
mockTracer.endParse();
mockNextListener.finished(parseEvent);
mockControl.replay();
tracingTaskListener.finished(parseEvent);
mockControl.verify();
}
use of com.sun.source.util.TaskEvent in project ceylon-compiler by ceylon.
the class JavaCompiler method parse.
/** Parse contents of input stream.
* @param filename The name of the file from which input stream comes.
* @param input The input stream to be parsed.
*/
protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) {
long msec = now();
JCCompilationUnit tree = make.TopLevel(List.<JCTree.JCAnnotation>nil(), null, List.<JCTree>nil());
if (content != null) {
if (verbose) {
log.printVerbose("parsing.started", filename);
}
if (taskListener != null) {
TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename);
taskListener.started(e);
}
Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
tree = parser.parseCompilationUnit();
if (verbose) {
log.printVerbose("parsing.done", Long.toString(elapsed(msec)));
}
}
tree.sourcefile = filename;
if (content != null && taskListener != null) {
TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, tree);
taskListener.finished(e);
}
return tree;
}
Aggregations