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

28
LINES

< > BotCompany Repo | #1028400 // findMethods_precise_onTypes - better method resolution

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

Libraryless. Click here for Pure Java version (2581L/17K).

1  
static L<Method> findMethods_precise_onTypes(O o, S method, Class... argTypes) ctex {
2  
  if (o cast Class) {
3  
    _MethodCache cache = callOpt_getCache(o);
4  
    L<Method> methods = cache.cache.get(method);
5  
    new Map<Method, Int> scores;
6  
    if (methods != null) for (Method m : methods) {
7  
      continue unless isStaticMethod(m);
8  
      int score = methodApplicabilityScore_onTypes(m, argTypes);
9  
      if (score < Int.MAX_VALUE) {
10  
        /*if (preciseCall_debug)
11  
          print("Method score: " + m + " " + score);*/
12  
        scores.put(m, score);
13  
      }
14  
    }
15  
    ret keysSortedByValue(scores);
16  
  }
17  
  
18  
  if (o == null) null;
19  
  _MethodCache cache = callOpt_getCache(o.getClass());
20  
  L<Method> methods = cache.cache.get(method);
21  
  new Map<Method, Int> best;
22  
  if (methods != null) for (Method m : methods) {
23  
    int score = methodApplicabilityScore_onTypes(m, argTypes);
24  
    if (score < Int.MAX_VALUE)
25  
      best.put(m, score);
26  
  }
27  
  ret keysSortedByValue(best);
28  
}

Author comment

Began life as a copy of #1020934

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028400
Snippet name: findMethods_precise_onTypes - better method resolution
Eternal ID of this version: #1028400/1
Text MD5: 9094252303f499f70e33b61b1933d03f
Transpilation MD5: 062c8f188429c41e99ffd9c4426fc5fd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-16 01:44:40
Source code size: 992 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 200 / 299
Referenced in: [show references]