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

14
LINES

< > BotCompany Repo | #1034748 // invokeMethodWithWidening

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

Libraryless. Click here for Pure Java version (5267L/29K).

sO invokeMethodWithWidening(Method m, O o, O... args) ctex {
  try {
    Class<?>[] types = m.getParameterTypes();
    int n = types.length;
    O[] args2 = new[n];
    for i to n:
      args2[i] = convertPrimitiveIfNecessary(args[i], types[i]);
    ret m.invoke(o, args2);
  } catch (InvocationTargetException e) {
    throw rethrow(getExceptionCause(e));
  } catch (IllegalArgumentException e) {
    throw new IllegalArgumentException(e.getMessage() + " - was calling: " + m + ", args: " + joinWithSpace(classNames(args)));
  }
}

Author comment

Began life as a copy of #1013187

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034748
Snippet name: invokeMethodWithWidening
Eternal ID of this version: #1034748/2
Text MD5: aac0d0212b131b7d17daf3f4cf1a960d
Transpilation MD5: c6e5841b1efb89d2fce6879647931406
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-08 02:55:06
Source code size: 544 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 69 / 113
Version history: 1 change(s)
Referenced in: [show references]