MCPcopy Create free account
hub / github.com/gomatcha/matcha / foreignCall

Method foreignCall

cmd/Tracker.java:50–82  ·  view source on GitHub ↗
(long v, String method, long args)

Source from the content-addressed store, hash-verified

48 return track(bridge.get(key));
49 }
50 public synchronized long foreignCall(long v, String method, long args) {
51 Object[] va = (Object[])this.get(args);
52 int len = 0;
53 if (va != null) {
54 len = va.length;
55 }
56 Object[] vb = new Object[len];
57 Class[] vc = new Class[len];
58 for (int i = 0; i < len; i++) {
59 Object e = va[i];
60 vb[i] = e;
61 vc[i] = e.getClass();
62 }
63
64 long test = 0;
65 try {
66 Object a = this.get(v);
67 // Log.v("Bridge", String.format("foreignCall, %s, %s", a.getClass().getName(), Arrays.toString(vc)));
68 Method m = a.getClass().getMethod(method, vc);
69 Object rlt = m.invoke(a, vb);
70 test = track(rlt);
71 } catch (NoSuchMethodException e) {
72 Log.v("Bridge", String.format("foreignCall, %d, %s, %d, %s", v, method, args, e.getCause()));
73 throw new RuntimeException(e);
74 } catch (IllegalAccessException e) {
75 Log.v("Bridge", String.format("foreignCall, %d, %s, %d, %s", v, method, args, e.getCause()));
76 throw new RuntimeException(e);
77 } catch (InvocationTargetException e) {
78 Log.v("Bridge", String.format("foreignCall, %d, %s, %d, %s", v, method, args, e.getCause()));
79 throw new RuntimeException(e);
80 }
81 return test;
82 }
83 public synchronized long foreignBool(boolean v) {
84 return track(v);
85 }

Callers

nothing calls this directly

Calls 2

getMethod · 0.95
trackMethod · 0.95

Tested by

no test coverage detected