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).

static Map<S, Long> unsafe_allFieldOffsets(O o){
  Class src = _getClass(o);
  
  new Map<S, Long> map;
  while (src != null && src != O.class) {
    for (Field f : src.getDeclaredFields()) {
      if ((f.getModifiers() & Modifier.STATIC) == 0) {
        long offset = cast call(theUnsafe_gen(), 'objectFieldOffset, f);
        S name = f.getName();
        if (map.containsKey(name)) name = lightlyShortClassName(src) + "." + name;
        map.put(name, offset);
      }
    }
    src = src.getSuperclass();
  }
  ret orderMapByValue(map);
}

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: 465 / 563
Version history: 7 change(s)
Referenced in: [show references]