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).

1  
static Method findMethod_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 Lowest<Method> best;
6  
    if (methods != null) for (Method m : methods) {
7  
      continue unless isStaticMethod(m);
8  
      int score = methodApplicabilityScore_onTypes(m, argTypes);
9  
      print ifdef preciseCall_debug("Method score: " + m + " " + score);
10  
      if (score < Int.MAX_VALUE)
11  
        best.put(m, score);
12  
    }
13  
    ret best!;
14  
  }
15  
  
16  
  if (o == null) null;
17  
  _MethodCache cache = callOpt_getCache(o.getClass());
18  
  L<Method> methods = cache.cache.get(method);
19  
  new Lowest<Method> best;
20  
  if (methods != null) for (Method m : methods) {
21  
    int score = methodApplicabilityScore_onTypes(m, argTypes);
22  
    if (score < Int.MAX_VALUE)
23  
      best.put(m, score);
24  
  }
25  
  ret best!;
26  
}

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: 426 / 451
Version history: 5 change(s)
Referenced in: [show references]