Skip to content

Commit 3f57db5

Browse files
nicolasstuckibiboudis
authored andcommitted
Cleanup calls to Object proxy methods
1 parent 0cf9d10 commit 3f57db5

File tree

1 file changed

+5
-4
lines changed
  • tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm

1 file changed

+5
-4
lines changed

tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ class Interpreter[R <: Reflection & Singleton](reflect0: R) extends TreeInterpre
2020
val parentSymbols = sym.tree.parents.tail.map(_.asInstanceOf[TypeTree].symbol).head
2121
import java.lang.reflect._
2222
val handler: InvocationHandler = new InvocationHandler() {
23-
val instance = new Object
2423

2524
def invoke(proxy: Object, method: Method, args: scala.Array[Object]): Object = {
2625
if (LOG) {
27-
val proxyString = if (method.getName == "toString") method.invoke(instance) else proxy.toString
26+
val proxyString = if (method.getName == "toString") method.invoke(this) else proxy.toString
2827
println(s"%> proxy call `$method` on `$proxyString` with args=${if (args == null) Nil else args.toList}")
2928
}
3029

@@ -42,8 +41,10 @@ class Interpreter[R <: Reflection & Singleton](reflect0: R) extends TreeInterpre
4241
eval(symbol.tree.rhs.get)(env1).asInstanceOf[Object]
4342
}
4443
}
45-
else
46-
method.invoke(instance, args: _*)
44+
else {
45+
assert(method.getClass == classOf[Object])
46+
method.invoke(this, args: _*)
47+
}
4748
}
4849

4950
}

0 commit comments

Comments
 (0)