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

25
LINES

< > BotCompany Repo | #1036431 // findMethods_withPrimitiveWidening_onTypes - even better method resolution

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

Libraryless. Click here for Pure Java version (10142L/56K).

1  
static L<Method> findMethods_withPrimitiveWidening_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_withPrimitiveWidening_onTypes(m, argTypes);
9  
      if (score < Int.MAX_VALUE)
10  
        scores.put(m, score);
11  
    }
12  
    ret keysSortedByValue(scores);
13  
  }
14  
  
15  
  if (o == null) null;
16  
  _MethodCache cache = callOpt_getCache(o.getClass());
17  
  L<Method> methods = cache.cache.get(method);
18  
  new Map<Method, Int> best;
19  
  if (methods != null) for (Method m : methods) {
20  
    int score = methodApplicabilityScore_withPrimitiveWidening_onTypes(m, argTypes);
21  
    if (score < Int.MAX_VALUE)
22  
      best.put(m, score);
23  
  }
24  
  ret keysSortedByValue(best);
25  
}

Author comment

Began life as a copy of #1028400

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036431
Snippet name: findMethods_withPrimitiveWidening_onTypes - even better method resolution
Eternal ID of this version: #1036431/1
Text MD5: 64ffd644ac023f121dc7b1b7a76dc58e
Transpilation MD5: 5b16c4c79b6ebcfc97c294133e7bdccf
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-11 23:10:30
Source code size: 949 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 60 / 86
Referenced in: [show references]