1 | please include function getOpt_cached. |
2 | |
3 | static Field findField2(O o, S field) { |
4 | Class c = o.getClass(); |
5 | HashMap<S, Field> map; |
6 | synchronized(getOpt_cache) { |
7 | map = getOpt_cache.get(c); |
8 | if (map == null) |
9 | map = getOpt_makeCache(c); |
10 | } |
11 | |
12 | if (map == getOpt_special) { |
13 | if (o instanceof Class) |
14 | ret findField2_findStaticField((Class) o, field); |
15 | } |
16 | |
17 | ret map.get(field); |
18 | } |
19 | |
20 | static Field findField2_findStaticField(Class<?> c, String field) { |
21 | Class _c = c; |
22 | do { |
23 | for (Field f : _c.getDeclaredFields()) |
24 | if (f.getName().equals(field) && (f.getModifiers() & java.lang.reflect.Modifier.STATIC) != 0) |
25 | return f; |
26 | _c = _c.getSuperclass(); |
27 | } while (_c != null); |
28 | ret null; |
29 | } |
Began life as a copy of #1002772
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005305 |
Snippet name: | findField2 - goes to superclasses - uses getOpt's cache now for non-static fields |
Eternal ID of this version: | #1005305/5 |
Text MD5: | b54c316abc3da883413c1e6d096e5ff6 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-22 15:59:54 |
Source code size: | 749 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 587 / 613 |
Version history: | 4 change(s) |
Referenced in: | [show references] |