javax.time在Kotlin

我试过下面的代码在Kotlin中使用javax.time:

import javax.time.calendar.LocalDate fun main(args: Array<String>){ println("Today is ${LocalDate.now()}"); } 

并得到编译错误:

 C:\kotlin-hello-world>kotlinc hello.kt -include-runtime -d hello.jar hello.kt:1:14: error: unresolved reference: time import javax.time.calendar.LocalDate ^ 

而谷歌搜索显示Kotlin javax.time不能使用和人们推荐使用ThreeTenBP与ThreeTenABP如果Android。 我的用例是使用Kotlin在服务器端使用javax.time类。

但是当我尝试使用TreeTenBP时,我不得不导入org.threeten.bp.LocalDate而不是javax.time.calendar.LocalDate因为TreeTen *不是JSR-310的实现,而是后端。

除了那些backport库,还有什么办法可以在Kotlin中使用javax.time? 如果是这样,如何配置这样的环境或者如何编写这样的代码?

javax.time是一个死包。

在Java SE 8中使用java.timeorg.threeten.bp作为backport。