static final HashMap<S, L<Method>> callMC_cache = new HashMap; // varargs assignment fixer for a single string array argument static Object callMC_cached(S method, S[] arg) { ret callMC(method, new O[] {arg}); } static O callMC_cached(S method, O... args) ctex { L<Method> m = callMC_cache.get(method); if (m == null) { if (callMC_cache.isEmpty()) { callMC_makeCache(); m = callMC_cache.get(method); } if (m == null) fail("Method named " + method + " not found in main"); } int n = m.size(); 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_makeCache() { callMC_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_cache, m.getName(), m); } c = c.getSuperclass(); } }
Began life as a copy of #1000630
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): cfunsshuasjs, mqqgnosmbjvj, tvejysmllsmz
No comments. add comment
Snippet ID: | #1007832 |
Snippet name: | callMC_cached [OLD] |
Eternal ID of this version: | #1007832/8 |
Text MD5: | 0604b162105848aafc288151c86087f1 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | Yes |
Created/modified: | 2017-04-11 14:11:19 |
Source code size: | 1116 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 425 / 432 |
Version history: | 7 change(s) |
Referenced in: | -