mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 08:31:30 +00:00
Otherwise some tools break (e.g. CheckMethodAdapter in ASM, used in generic signature writer) because they expect class names to be Java identifiers. Some tests fixed, some will be fixed in future commits
18 lines
737 B
Kotlin
18 lines
737 B
Kotlin
val l: Any = {}
|
|
|
|
fun box(): String {
|
|
val enclosingClass = l.javaClass.getEnclosingClass()!!.getName()
|
|
if (!enclosingClass.startsWith("_DefaultPackage") || !enclosingClass.contains("lambdaInPackage")) return "enclosing class: $enclosingClass"
|
|
|
|
val enclosingConstructor = l.javaClass.getEnclosingConstructor()
|
|
if (enclosingConstructor != null) return "enclosing constructor found: $enclosingConstructor"
|
|
|
|
val enclosingMethod = l.javaClass.getEnclosingMethod()
|
|
if (enclosingMethod != null) return "enclosing method found: $enclosingMethod"
|
|
|
|
val declaringClass = l.javaClass.getDeclaringClass()
|
|
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
|
|
|
|
return "OK"
|
|
}
|