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

25
LINES

< > BotCompany Repo | #1025164 // thisDollarOneFields - actually this$1 or this$0

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

Libraryless. Click here for Pure Java version (2784L/16K).

1  
scope thisDollarOneFields.
2  
3  
static Map<Class, Field[]> #cache = newDangerousWeakHashMap();
4  
5  
static Field[] thisDollarOneFields(Class c) {
6  
  synchronized(cache) {
7  
    Field[] l = cache.get(c);
8  
    if (l == null)
9  
      cache.put(c, l = thisDollarOneFields_uncached(c));
10  
    ret l;
11  
  }
12  
}
13  
14  
static Field[] thisDollarOneFields_uncached(Class c) {
15  
  new L<Field> fields;
16  
  do {
17  
    for (Field f : c.getDeclaredFields())
18  
      if (f.getName().startsWith("this$"))
19  
        fields.add(makeAccessible(f));
20  
    c = c.getSuperclass();
21  
  } while (c != null);
22  
  ret toArray(new Field[l(fields)], fields);
23  
}
24  
25  
end scope

Author comment

Began life as a copy of #1005599

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025164
Snippet name: thisDollarOneFields - actually this$1 or this$0
Eternal ID of this version: #1025164/8
Text MD5: 38c85834f19d85eeb6097cdaea20e6be
Transpilation MD5: 32b474f0d91f0552352f42420cde5e0e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-24 21:33:15
Source code size: 626 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 174 / 278
Version history: 7 change(s)
Referenced in: [show references]