AnnotationConfigApplicationContext.() -> Unit

未知该Kotlin语法

AnnotationConfigApplicationContext.() -> Unit
可以是下列方法:
AnnotationConfigApplicationContext::start

研究发现:

class Test {
    open class CDPlayer {
        open fun play() {
            println("di di di")
        }
    }

    @Test fun ext() {
        object : CDPlayer() {
            override fun play() {
                println("Give you a old CD, to listen my love story...")
            }
        }.play()

        fun CDPlayer(foo: CDPlayer.() -> Unit) {
            CDPlayer().foo()
        }

        CDPlayer {
            println("ooooo")
        }
    }
}
原文地址:https://www.cnblogs.com/develon/p/14503190.html