summaryrefslogtreecommitdiff
path: root/stubs/src/kotlin/proxy/KotlinProxyLog.java
diff options
context:
space:
mode:
Diffstat (limited to 'stubs/src/kotlin/proxy/KotlinProxyLog.java')
-rw-r--r--stubs/src/kotlin/proxy/KotlinProxyLog.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/stubs/src/kotlin/proxy/KotlinProxyLog.java b/stubs/src/kotlin/proxy/KotlinProxyLog.java
index 3afdb38..af5db37 100644
--- a/stubs/src/kotlin/proxy/KotlinProxyLog.java
+++ b/stubs/src/kotlin/proxy/KotlinProxyLog.java
@@ -53,20 +53,28 @@ public final class KotlinProxyLog {
/**
* Return value for stub methods with a reference return type (other than
* String). Asks {@link KotlinProxyOverrides#invoke} first — per-method
- * custom implementations, passed the full argument list — and falls back
- * to materializing a real no-arg instance of the declared return type.
- * The generated body checkcasts the result to the declared type.
+ * custom implementations, passed the full argument list and the receiver
+ * (the stub instance the method was called on, null for statics) — and
+ * falls back to materializing a real no-arg instance of the declared
+ * return type. The generated body checkcasts the result to the declared
+ * type.
*
- * The generated bytecode pushes the args array FIRST (member, owner and
- * return type last) so its stack stays shallow (peak 4) — keep this
- * parameter order in sync with RETURN_VALUE_DESC in gen_class.py.
+ * The generated bytecode pushes the args array FIRST (member, owner,
+ * return type and receiver last) so its stack stays shallow (peak 5) —
+ * keep this parameter order in sync with RETURN_VALUE_DESC in
+ * gen_class.py.
*/
public static Object returnValue(Object[] args, String member,
- String ownerDotName, String returnDotName) {
+ String ownerDotName, String returnDotName,
+ Object instance) {
Object v = KotlinProxyOverrides.invoke(member, ownerDotName,
- returnDotName, args);
+ returnDotName, args, instance);
if (v != KotlinProxyOverrides.NO_VALUE) {
log("OVERRIDE " + ownerDotName + "." + member
+ + (instance != null
+ ? " inst=0x"
+ + Integer.toHexString(System.identityHashCode(instance))
+ : "")
+ " -> " + dump(v));
return v;
}