我javac从这里下载了源代码,我发现它本身是用java语言编写的.但是,我原以为它是用c/c ++编写的.
无论如何,如果没有java编译器,这个用java编写的java编译器源代码怎么编译?
/** A marker indicating that a `java.lang.Runnable` provided to `scala.concurrent.ExecutionContext`
* wraps a callback provided to `Future.onComplete`.
* All callbacks provided to a `Future` end up going through `onComplete`, so this allows an
* `ExecutionContext` to special-case callbacks that were executed by `Future` if desired.
*/
trait OnCompleteRunnable {
self: Runnable =>
}
Run Code Online (Sandbox Code Playgroud)
当我在scala中检查Future的源代码时,我无法理解为什么self:Runnable => above compiles.我知道symbol =>可以在方法参数中用作名字调用,也可以用来定义函数.上面的代码似乎定义了一个函数,但它让我很困惑.