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

23
LINES

< > BotCompany Repo | #1018167 // preciseCallOpt - better method resolution. Could optimize method lookup

JavaX fragment (include)

sbool preciseCall_debug;

static O preciseCallOpt(Object o, String method, Object... args) ctex {
  if (o instanceof Class) {
    _MethodCache cache = callOpt_getCache(o);
    L<Method> methods = cache.cache.get(method);
    //L<Method> methods = findMethodsNamed2(o, method, true);
    new Lowest<Method> best;
    if (methods != null) for (Method m : methods) {
      int score = methodApplicabilityScore(m, args);
      if (score < Int.MAX_VALUE) {
        if (preciseCall_debug)
          print("Method score: " + m + " " + score);
        best.put(m, score);
      }
    }
    Method m = best.get();
    if (m == null) null;
    ret invokeMethod(m, null, args);
  } else {
    throw todo();
  }
}

Author comment

Began life as a copy of #1007856

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018167
Snippet name: preciseCallOpt - better method resolution. Could optimize method lookup
Eternal ID of this version: #1018167/3
Text MD5: c9e79e387c8f896d42289f6ba78901be
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-30 12:16:04
Source code size: 725 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 255 / 300
Version history: 2 change(s)
Referenced in: [show references]