Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1020934 // findMethod_precise_onTypes - better method resolution

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5226L/29K).

static Method findMethod_precise_onTypes(O o, S method, Class... argTypes) ctex {
  if (o cast Class) {
    _MethodCache cache = callOpt_getCache(o);
    L<Method> methods = cache.cache.get(method);
    new Lowest<Method> best;
    if (methods != null) for (Method m : methods) {
      continue unless isStaticMethod(m);
      int score = methodApplicabilityScore_onTypes(m, argTypes);
      print ifdef preciseCall_debug("Method score: " + m + " " + score);
      if (score < Int.MAX_VALUE)
        best.put(m, score);
    }
    ret best!;
  }
  
  if (o == null) null;
  _MethodCache cache = callOpt_getCache(o.getClass());
  L<Method> methods = cache.cache.get(method);
  new Lowest<Method> best;
  if (methods != null) for (Method m : methods) {
    int score = methodApplicabilityScore_onTypes(m, argTypes);
    if (score < Int.MAX_VALUE)
      best.put(m, score);
  }
  ret best!;
}

Author comment

Began life as a copy of #1020645

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020934
Snippet name: findMethod_precise_onTypes - better method resolution
Eternal ID of this version: #1020934/6
Text MD5: c3d4328fd069afcf5d83674b33aa7bd8
Transpilation MD5: 2b11558d1f97a374a5317aab07c423dc
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-01 20:32:21
Source code size: 915 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 294 / 333
Version history: 5 change(s)
Referenced in: [show references]