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

24
LINES

< > BotCompany Repo | #1006909 // unstructureInRealm - unstructure in another class loader realm

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

Transpiled version (6421L) is out of date.

static O unstructureInRealm(S s, fO realm) {
  Class mc = mainClass(realm);
  S mcDollar = mc.getName() + "$";
  printVars unstructureInRealm(+mc, +mcDollar);
  
  O classFinder = callOpt(mc, "_defaultClasFinder");
  if (classFinder != null)
    print("Using realm's class finder");
  else classFinder = func(S name) {
    S rewrittenName = replacePrefix("main$", mcDollar, name);
    printVars("classFinder in realm: ", +name, +rewrittenName);
    O result = getClass_noConvertName(realm, rewrittenName);
    print("result: " + result);
    ret result;
  };
  
  // notify module that we are loading (old)
  temp tempSetTL((ThreadLocal) callOpt(mc, 'dynamicObjectIsLoading_threadLocal), true);
  
  // because this is now global anyway
  temp tempSetTL(dynamicObjectIsLoading_threadLocal(), true);
  
  ret unstructure(s, false, classFinder);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006909
Snippet name: unstructureInRealm - unstructure in another class loader realm
Eternal ID of this version: #1006909/9
Text MD5: 31821370ca225e8959bd9f29358350bd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-30 03:29:44
Source code size: 868 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 551 / 688
Version history: 8 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1020506 - safeUnstructureAllowingCertainClasses - safe-unstructure, but allowing a few main$ classes