Libraryless. Click here for Pure Java version (7538L/42K).
1 | // TODO: better error message when neither field nor method found |
2 | |
3 | sO preciseGetOrCallMethod(O object, S name) { |
4 | if (object == null) null; |
5 | |
6 | // could optimize more for sure |
7 | if (canCallWithVarargs(object, name)) |
8 | ret call(object, name); |
9 | |
10 | // TODO: better error message when neither field nor method found |
11 | ret _get(object, name); |
12 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035088 |
Snippet name: | preciseGetOrCallMethod |
Eternal ID of this version: | #1035088/3 |
Text MD5: | e508bdc362d52de4edadc29804047423 |
Transpilation MD5: | 06293548edaa20c640bd73299187fa09 |
Author: | stefan |
Category: | javax / reflection |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-29 20:56:47 |
Source code size: | 357 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 144 / 208 |
Version history: | 2 change(s) |
Referenced in: | [show references] |