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

31
LINES

< > BotCompany Repo | #1026818 // canCallWithVarargs

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

Libraryless. Click here for Pure Java version (2162L/14K).

1  
sbool canCallWithVarargs(O o, S method, O... args) {
2  
  if (o == null) false;
3  
  
4  
  if (o instanceof Class) {
5  
    Class c = (Class) o;
6  
    _MethodCache cache = callOpt_getCache(c);
7  
    
8  
    if (cache.findStaticMethod(method, args) != null) true;
9  
10  
    // try varargs
11  
    L<Method> methods = cache.cache.get(method);
12  
    if (methods != null) methodSearch: for (Method m : methods) {
13  
      continue unless m.isVarArgs() && isStaticMethod(m);
14  
      if (massageArgsForVarArgsCall(m, args) != null) true;
15  
    }
16  
  } else {
17  
    Class c = o.getClass();
18  
    _MethodCache cache = callOpt_getCache(c);
19  
20  
    if (cache.findMethod(method, args) != null) true;
21  
      
22  
    // try varargs
23  
    L<Method> methods = cache.cache.get(method);
24  
    if (methods != null) methodSearch: for (Method m : methods) {
25  
      continue unless m.isVarArgs();
26  
      if (massageArgsForVarArgsCall(m, args) != null) true;
27  
    }
28  
  }
29  
  
30  
  false;
31  
}

Author comment

Began life as a copy of #1022095

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: #1026818
Snippet name: canCallWithVarargs
Eternal ID of this version: #1026818/3
Text MD5: 8d9be5d790a4833f2a5451b57e8d22e4
Transpilation MD5: 4dbed4fb095a4b669ffbdf871793d885
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-23 22:50:20
Source code size: 934 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 171 / 224
Version history: 2 change(s)
Referenced in: [show references]