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

17
LINES

< > BotCompany Repo | #1011519 // unsafe_allFieldOffsets - now renames "overloaded" fields

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

Libraryless. Click here for Pure Java version (2577L/17K).

1  
static Map<S, Long> unsafe_allFieldOffsets(O o){
2  
  Class src = _getClass(o);
3  
  
4  
  new Map<S, Long> map;
5  
  while (src != null && src != O.class) {
6  
    for (Field f : src.getDeclaredFields()) {
7  
      if ((f.getModifiers() & Modifier.STATIC) == 0) {
8  
        long offset = cast call(theUnsafe_gen(), 'objectFieldOffset, f);
9  
        S name = f.getName();
10  
        if (map.containsKey(name)) name = lightlyShortClassName(src) + "." + name;
11  
        map.put(name, offset);
12  
      }
13  
    }
14  
    src = src.getSuperclass();
15  
  }
16  
  ret orderMapByValue(map);
17  
}

Author comment

Began life as a copy of #1011517

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011519
Snippet name: unsafe_allFieldOffsets - now renames "overloaded" fields
Eternal ID of this version: #1011519/8
Text MD5: 3266c87dc045fe4db63d64278aef2ad5
Transpilation MD5: 359b466c995e5ecf0a81d971f136b7df
Author: stefan
Category: javax / unsafe
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-09 23:28:37
Source code size: 558 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 396 / 474
Version history: 7 change(s)
Referenced in: [show references]