package introspect;

import clojure.lang.IFn;
import net.bytebuddy.implementation.bind.annotation.*;

import java.lang.reflect.Method;
import java.util.concurrent.Callable;

public class Interceptor {

  public static IFn callback;

  public static void log(String a, Object[] obj) {
    System.out.println("HEREEEE");
    System.out.println(obj);

  }
  // @RuntimeType
  public static void intercept(// @SuperCall Callable method,
                                 @Origin Method originalMethod
//                                 @This Object proxy,
//                                 @AllArguments Object[] allArguments
                                ) // throws Throwable
  {
//    Object returnValue = null;
//    try {
//      System.out.println("CALLING");
//      returnValue = method.call();
//    } catch (Throwable throwable) {
//      callback.invoke(proxy, allArguments, throwable);
//      throwable.printStackTrace();
//      throw throwable;
//    }
//
//    // System.out.printf("___%s, returnValue: %s___\n",proxy, returnValue);
//    callback.invoke(proxy, originalMethod, allArguments, returnValue);
//    return returnValue;
    System.out.println("HERE WE GO");
    System.out.println(originalMethod);
  }

  public static void setCallback(IFn fn) {
    callback = fn;
  }

}

@@ -43,1183 +43,566 @@
 Fn;%0A
-import net.bytebuddy.implementation.bind.annotation.*;%0A%0Aimport java.lang.reflect.Method;%0Aimport java.util.concurrent.Callable;%0A%0Apublic class Interceptor %7B%0A%0A  public static IFn callback;%0A%0A  public static void log(String a, Object%5B%5D obj) %7B%0A    System.out.println(%22HEREEEE%22);%0A    System.out.println(obj);%0A%0A  %7D%0A  // @RuntimeType%0A  public static void intercept(// @SuperCall Callable method,%0A                                 @Origin Method originalMethod%0A//                                 @This Object proxy,%0A//                                 @AllArguments Object%5B%5D allArguments%0A                                ) // throws Throwable%0A  %7B%0A//    Object returnValue = null;%0A//    try %7B%0A//      System.out.println(%22CALLING%22);%0A//      returnValue = method.call();%0A//    %7D catch (Throwable throwable) %7B%0A//      callback.invoke(proxy, allArguments, throwable);%0A//      throwable.printStackTrace(
+%0Aimport java.util.Arrays;%0A%0Apublic class Interceptor %7B%0A%0A  public static IFn callback;%0A%0A  public static void in(Object%5B%5D arguments, String className, String methodName) %7B%0A    System.out.println(%22Enter method: '%22 + className + %22 %22 + methodName + %22' in:%22 + Arrays.toString(arguments));%0A    // callback.invoke(methodName, arguments);%0A  %7D%0A%0A  public static void out(Object argument, String className, String methodName) %7B%0A    System.out.println(%22Leave method: '%22 + className + %22 %22 + methodName + %22' in:%22 + argument
 );%0A
-//
       
-throw throwable;%0A//    %7D%0A//%0A//    // System.out.printf(%22___%25s, returnValue: %25s___%5Cn%22,proxy, returnValue);%0A//    callback.invoke(proxy, originalMethod, allArguments, returnValue);%0A//    return returnValue;%0A    System.out.println(%22HERE WE GO%22);%0A    System.out.println(originalMethod
+  // callback.invoke(methodName, arguments
 );%0A 

Fix interceptor