static final HashMap> callMC_3_cache = new HashMap; static callMC_3_Q callMC_3_quick; sclass callMC_3_Q { S name; Method method; } // varargs assignment fixer for a single string array argument static Object callMC_3(S method, S[] arg) { ret callMC_3(method, new O[] {arg}); } static O callMC_3(S method, O... args) ctex { callMC_3_Q q = callMC_3_quick; if (q != null && q.name == method) ret q.method.invoke(null, args); L m = callMC_3_cache.get(method); if (m == null) { if (callMC_3_cache.isEmpty()) { callMC_3_makeCache(); m = callMC_3_cache.get(method); } if (m == null) fail("Method named " + method + " not found in main"); } int n = m.size(); if (n == 1) { Method me = m.get(0); if (q == null || q.name != method) { q = new callMC_3_Q; q.name = method; q.method = me; callMC_3_quick = q; } ret me.invoke(null, args); } for i to n: { Method 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_3_makeCache() { callMC_3_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_3_cache, m.getName(), m); } c = c.getSuperclass(); } }