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]

Transpiled version (2227L) is out of date.

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   

Travelled to 9 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

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