diff -r 9e2f52d0aec3 -r d1538d4de057 src/Pure/GUI/gui_thread.scala --- a/src/Pure/GUI/gui_thread.scala Mon Apr 06 21:18:16 2020 +0200 +++ b/src/Pure/GUI/gui_thread.scala Mon Apr 06 21:22:42 2020 +0200 @@ -16,13 +16,13 @@ def assert[A](body: => A): A = { - Predef.assert(SwingUtilities.isEventDispatchThread()) + Predef.assert(SwingUtilities.isEventDispatchThread) body } def require[A](body: => A): A = { - Predef.require(SwingUtilities.isEventDispatchThread()) + Predef.require(SwingUtilities.isEventDispatchThread) body } @@ -31,23 +31,23 @@ def now[A](body: => A): A = { - if (SwingUtilities.isEventDispatchThread()) body + if (SwingUtilities.isEventDispatchThread) body else { - lazy val result = { assert { Exn.capture(body) } } - SwingUtilities.invokeAndWait(new Runnable { def run = result }) + lazy val result = assert { Exn.capture(body) } + SwingUtilities.invokeAndWait(() => result) Exn.release(result) } } def later(body: => Unit) { - if (SwingUtilities.isEventDispatchThread()) body - else SwingUtilities.invokeLater(new Runnable { def run = body }) + if (SwingUtilities.isEventDispatchThread) body + else SwingUtilities.invokeLater(() => body) } def future[A](body: => A): Future[A] = { - if (SwingUtilities.isEventDispatchThread()) Future.value(body) + if (SwingUtilities.isEventDispatchThread) Future.value(body) else { val promise = Future.promise[A] later { promise.fulfill_result(Exn.capture(body)) }