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

1  
static O defaultDefaultClassFinder() {
2  
  ret new F1<S, Class>() {
3  
    public Class get(S name) {
4  
      // Fix some buggy concepts files out there
5  
      name = replacePrefix("main$main$", "main$", name);
6  
      
7  
      Class c = get2(name);
8  
      ifdef defaultDefaultClassFinder_debug
9  
        printVars_str("ddcf", +name, +c);
10  
      endifdef
11  
      ret c;
12  
    }
13  
      
14  
    Class get2(S name) {
15  
      // special invocation to find main class irrelevant of name
16  
      if (eq(name, "<main>")) ret mc();
17  
      
18  
      try object Class c = findClass_fullName(name);
19  
      
20  
      if (startsWithAny(name, "loadableUtils.utils$", "main$", mcDollar()))
21  
        for (S pkg : ll("loadableUtils.utils$", mcDollar())) {
22  
          S newName = pkg + afterDollar(name);
23  
          ifdef defaultDefaultClassFinder_debug
24  
            print("ddcf looking for ", newName);
25  
          endifdef
26  
          try object Class c = findClass_fullName(newName);
27  
        }
28  
      null;
29  
    }
30  
  };
31  
}

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