I'm trying to use schedule extension function of the java.util.Timer and IDEA 13 forces me to use parameter list that doesn't seem to be in accordance with documentation, i.e. it forces me to use closure as the first parameter. See the message in attachment.
e.g.
fun runSchedule() {
// create a daemon thread
val timer = Timer(“schedule”, true)
// schedule a single event
timer.schedule(1000) {
println(“hello world!”)
}
// schedule at a fixed rate
timer.scheduleAtFixedRate(1000, 1000) {
println(“hello world!”)
}
}
This is what docs says:
fun Timer.schedule(time: Date, action: (TimerTask) -> Unit): TimerTask
fun Timer.schedule(time: Date, period: Long, action: (TimerTask) -> Unit): TimerTask
fun Timer.schedule(delay: Long, action: (TimerTask) -> Unit): TimerTask
fun Timer.schedule(delay: Long, period: Long, action: (TimerTask) -> Unit): TimerTaskWhat’s goin’ on? Note that I’m quite new to Kotlin.
http://docs.oracle.com/javase/6/docs/api/java/util/TimerTask.html?is-external=true
message.png (2.93 KB)