Libraryless. Click here for Pure Java version (9399L/52K).
sO newPreciseCall_sentinel(O o, S method, O methodNotFoundSentinel, O... args) ctex { if (o == null) null; bool staticCall = o instanceof Class; Class c = staticCall ? (Class) o : o.getClass(); O target = staticCall ? null : o; _MethodCache cache = callOpt_getCache(c); L<Method> methods = cache.cache.get(method); Method best = null; int bestScore = Int.MAX_VALUE; bool widening; if (methods != null) for (Method m : methods) { if (staticCall && !isStaticMethod(m)) continue; int score = methodApplicabilityScore_withPrimitiveWidening(m, args); if (score == 0) ret invokeMethod(m, target, args); if (abs(score) < bestScore) { best = m; bestScore = abs(score); widening = score < 0; } } if (best != null) if (widening) ret invokeMethodWithWidening(best, target, args); else ret invokeMethod(best, target, args); ret callWithVarargs_sentinel(o, method, methodNotFoundSentinel, args); // TODO: make this precise too }
Began life as a copy of #1034745
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035534 |
Snippet name: | newPreciseCall_sentinel - newPreciseCall + return function result or a sentinel if method not found |
Eternal ID of this version: | #1035534/4 |
Text MD5: | 74df7224500ee467193ce78994f2b5a3 |
Transpilation MD5: | a3811f71baf9d119db021e458014d417 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-06-04 09:16:59 |
Source code size: | 1062 bytes / 34 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 129 / 185 |
Version history: | 3 change(s) |
Referenced in: | [show references] |