@@ -17,30 +17,30 @@ class Interpreter[R <: Reflection & Singleton](reflect0: R) extends TreeInterpre
17
17
// Best effort to try to create a proxy
18
18
val sym = fn.symbol.owner
19
19
if (sym.isClassDef) {
20
- sym.tree match case tree : ClassDef =>
21
- val parentSymbols = tree.parents.tail.map(_. asInstanceOf [ TypeTree ].symbol).head
22
- import java . lang . reflect . _
23
- val handler : InvocationHandler = new InvocationHandler () {
24
-
25
- def invoke ( proxy : Object , method : Method , args : scala. Array [ Object ]) : Object = {
26
- if ( LOG ) {
27
- val proxyString = if (method.getName == " toString " ) method.invoke( this ) else proxy.toString
28
- println( s " %> proxy call ` $method ` on ` $ proxyString` with args= ${ if (args == null ) Nil else args.toList} " )
29
- }
30
-
31
- // println(method)
32
- val symbol = sym.methods.find(_.name == method.getName).get
33
-
34
- if (symbol.isDefinedInCurrentRun) {
35
- val argsList = if (args == null ) Nil else args.toList
36
- interpretCall( this , symbol, argsList). asInstanceOf [ Object ]
37
- }
38
- else {
39
- assert(method.getClass == classOf [ Object ])
40
- method.invoke( this , args : _* )
41
- }
42
- }
43
-
20
+ sym.tree match
21
+ case tree : ClassDef =>
22
+ val parentSymbols = tree.parents.tail.map(_. asInstanceOf [ TypeTree ].symbol).head
23
+ import java . lang . reflect . _
24
+ val handler : InvocationHandler = new InvocationHandler () {
25
+
26
+ def invoke ( proxy : Object , method : Method , args : scala. Array [ Object ]) : Object = {
27
+ if (LOG ) {
28
+ val proxyString = if (method.getName == " toString " ) method.invoke( this ) else proxy.toString
29
+ println( s " %> proxy call ` $method ` on ` $proxyString ` with args= ${ if (args == null ) Nil else args.toList} " )
30
+ }
31
+
32
+ // println( method)
33
+ val symbol = sym.methods.find(_.name == method.getName).get
34
+
35
+ if (symbol.isDefinedInCurrentRun) {
36
+ val argsList = if (args == null ) Nil else args.toList
37
+ interpretCall( this , symbol, argsList). asInstanceOf [ Object ]
38
+ }
39
+ else {
40
+ assert( method.getClass == classOf [ Object ] )
41
+ method.invoke( this , args : _* )
42
+ }
43
+ }
44
44
}
45
45
val proxyClass : Class [_] = Proxy .getProxyClass(getClass.getClassLoader, jvmReflection.loadClass(parentSymbols.fullName))
46
46
proxyClass.getConstructor(classOf [InvocationHandler ]).newInstance(handler);
0 commit comments