static final HashMap> callMC_2_cache = new HashMap; static S callMC_2_key; static Method callMC_2_value; // varargs assignment fixer for a single string array argument static Object callMC_2(S method, S[] arg) { ret callMC_2(method, new O[] {arg}); } static O callMC_2(S method, O... args) ctex { Method me; synchronized(callMC_2_cache) { me = method == callMC_2_key ? callMC_2_value : null; } if (me != null) ret callMC_2_value.invoke(null, args); L m = callMC_2_cache.get(method); if (m == null) { if (callMC_2_cache.isEmpty()) { callMC_2_makeCache(); m = callMC_2_cache.get(method); } if (m == null) fail("Method named " + method + " not found in main"); } int n = m.size(); if (n == 1) { me = m.get(0); synchronized(callMC_2_cache) { callMC_2_key = method; callMC_2_value = me; } ret me.invoke(null, args); } for i to n: { me = m.get(i); if (call_checkArgs(me, args, false)) ret me.invoke(null, args); } fail("No method called " + method + " with matching arguments found in main"); } static synchronized void callMC_2_makeCache() { callMC_2_cache.clear(); Class _c = (Class) mc(), c = _c; while (c != null) { for (Method m : c.getDeclaredMethods()) if ((m.getModifiers() & Modifier.STATIC) != 0) { m.setAccessible(true); multiMapPut(callMC_2_cache, m.getName(), m); } c = c.getSuperclass(); } }