报告使用单个 abstract 方法实现 Java 接口的匿名对象文字,该方法可使用 lambda 表达式转换为调用。

示例:


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

在应用快速修复后:


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