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

31
LINES

< > BotCompany Repo | #1023103 // defaultDefaultClassFinder

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

Libraryless. Click here for Pure Java version (5183L/28K).

static O defaultDefaultClassFinder() {
  ret new F1<S, Class>() {
    public Class get(S name) {
      // Fix some buggy concepts files out there
      name = replacePrefix("main$main$", "main$", name);
      
      Class c = get2(name);
      ifdef defaultDefaultClassFinder_debug
        printVars_str("ddcf", +name, +c);
      endifdef
      ret c;
    }
      
    Class get2(S name) {
      // special invocation to find main class irrelevant of name
      if (eq(name, "<main>")) ret mc();
      
      try object Class c = findClass_fullName(name);
      
      if (startsWithAny(name, "loadableUtils.utils$", "main$", mcDollar()))
        for (S pkg : ll("loadableUtils.utils$", mcDollar())) {
          S newName = pkg + afterDollar(name);
          ifdef defaultDefaultClassFinder_debug
            print("ddcf looking for ", newName);
          endifdef
          try object Class c = findClass_fullName(newName);
        }
      null;
    }
  };
}

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cfunsshuasjs, ekrmjmnbrukm, elmgxqgtpvxh, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, uhjabitqdyqv, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1023103
Snippet name: defaultDefaultClassFinder
Eternal ID of this version: #1023103/21
Text MD5: 2daafc1b3273c476ba6602c79a421dae
Transpilation MD5: 925a27a64abc36b3e06f50682d338d63
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-10 01:05:59
Source code size: 989 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 386 / 3770
Version history: 20 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030949 - Transpiler output of #1031393
#1030968 - mcAndUtils