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

12
LINES

< > BotCompany Repo | #1034784 // invokeConstructorWithWidening

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

Transpiled version (5279L) is out of date.

1  
sO invokeConstructorWithWidening(Constructor m, O... args) ctex {
2  
  try {
3  
    Class<?>[] types = m.getParameterTypes();
4  
    int n = types.length;
5  
    O[] args2 = new[n];
6  
    for i to n:
7  
      args2[i] = convertPrimitiveIfNecessary(args[i], types[i]);
8  
    ret m.newInstance(args2);
9  
  } catch (IllegalArgumentException e) {
10  
    throw new IllegalArgumentException(e.getMessage() + " - was calling: " + m + ", args: " + joinWithSpace(classNames(args)));
11  
  }
12  
}

Author comment

Began life as a copy of #1034748

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034784
Snippet name: invokeConstructorWithWidening
Eternal ID of this version: #1034784/6
Text MD5: f0ac4540118132e8a41935f53c48a4e9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-29 19:40:37
Source code size: 466 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 192 / 299
Version history: 5 change(s)
Referenced in: [show references]