mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 00:21:35 +00:00
Includes changes to decompiled text Old syntax is used in builtins and project code for now
26 lines
862 B
Kotlin
26 lines
862 B
Kotlin
class O {
|
|
default object {
|
|
// Currently we consider <clinit> in class O as the enclosing method of this lambda,
|
|
// so we write outer class = O and enclosing method = null
|
|
val f = {}
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
val javaClass = O.f.javaClass
|
|
|
|
val enclosingMethod = javaClass.getEnclosingMethod()
|
|
if (enclosingMethod != null) return "method: $enclosingMethod"
|
|
|
|
val enclosingConstructor = javaClass.getEnclosingConstructor()
|
|
if (enclosingConstructor != null) return "constructor: $enclosingConstructor"
|
|
|
|
val enclosingClass = javaClass.getEnclosingClass()
|
|
if (enclosingClass?.getName() != "O") return "enclosing class: $enclosingClass"
|
|
|
|
val declaringClass = javaClass.getDeclaringClass()
|
|
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
|
|
|
|
return "OK"
|
|
}
|