--- old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/TTY.java 2017-03-20 17:37:53.000000000 -0700 +++ new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/TTY.java 2017-03-20 17:37:53.000000000 -0700 @@ -42,7 +42,7 @@ /** * Support for thread-local suppression of {@link TTY}. */ - public static class Filter { + public static class Filter implements AutoCloseable { private LogStream previous; private final Thread thread = Thread.currentThread(); @@ -88,6 +88,16 @@ } /** + * Creates an object that will overwrite {@link TTY} for the current thread with a custom + * log stream. To revert the overwritten state to how it was before this call, the + * {@link #remove()} method must be called on this filter object. + */ + public Filter(LogStream newStream) { + previous = out(); + log.set(newStream); + } + + /** * Reverts the suppression state of {@link TTY} to how it was before this object was * constructed. */ @@ -97,6 +107,11 @@ log.set(previous); } } + + @Override + public void close() { + remove(); + } } /**