Why do I need jsr305 to use guava in scala?

前端 未结 3 1254
情书的邮戳
情书的邮戳 2021-01-03 22:59

I have the following scala file:

object SGuavaTryout {
  com.google.common.cache.CacheBuilder.newBuilder()
}

I compile with guava-11.0.2.ja

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-03 23:10

    That's because of the way the Scala compiler is designed, it requires all the types exposed by a class to be available at compile time, whereas the Java compiler effectively doesn't care.

提交回复
热议问题