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

static L<Method> findMethods_withPrimitiveWidening_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 Map<Method, Int> scores;
    if (methods != null) for (Method m : methods) {
      continue unless isStaticMethod(m);
      int score = methodApplicabilityScore_withPrimitiveWidening_onTypes(m, argTypes);
      if (score < Int.MAX_VALUE)
        scores.put(m, score);
    }
    ret keysSortedByValue(scores);
  }
  
  if (o == null) null;
  _MethodCache cache = callOpt_getCache(o.getClass());
  L<Method> methods = cache.cache.get(method);
  new Map<Method, Int> best;
  if (methods != null) for (Method m : methods) {
    int score = methodApplicabilityScore_withPrimitiveWidening_onTypes(m, argTypes);
    if (score < Int.MAX_VALUE)
      best.put(m, score);
  }
  ret keysSortedByValue(best);
}

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: 125 / 173
Referenced in: [show references]