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,16 @@
val l: Any
get() = {}
fun box(): String {
val enclosingMethod = l.javaClass.getEnclosingMethod()
if (enclosingMethod?.getName() != "getL") return "method: $enclosingMethod"
val enclosingClass = l.javaClass.getEnclosingClass()
if (!enclosingClass!!.getName().startsWith("_DefaultPackage-lambdaInPropertyGetter-")) return "enclosing class: $enclosingClass"
val declaringClass = l.javaClass.getDeclaringClass()
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
return "OK"
}