Support mapping between Java and Kotlin reflection objects

This commit is contained in:
Alexander Udalov
2014-06-20 19:22:02 +04:00
parent c575ad9fb0
commit 704de8992e
33 changed files with 434 additions and 93 deletions
@@ -0,0 +1,17 @@
val l: Any = {}
fun box(): String {
val enclosingClass = l.javaClass.getEnclosingClass()
if (!enclosingClass!!.getName().startsWith("_DefaultPackage-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"
}