람다 식이 있는 호출로 변환 가능한 하나의 abstract 메서드를 포함하는 Java 인터페이스를 구현하는 익명 객체 리터럴을 보고합니다.

예:


class SomeService {
  val threadPool = Executors.newCachedThreadPool()
    
  fun foo() {
    threadPool.submit(object : Runnable {
      override fun run() {
        println("hello")
      }
    })
  }
}

빠른 수정을 적용한 후:


  fun foo() {
    threadPool.submit { println("hello") }
  }