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

20
LINES

< > BotCompany Repo | #1030720 // unstructureClassFinderAllowingCertainClasses_preferUtils

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

Libraryless. Click here for Pure Java version (2735L/16K).

1  
sO unstructureClassFinderAllowingCertainClasses_preferUtils(bool failOnUnknownClass default true, S... allowedClasses) {
2  
  new Set<S> allowedClassesSet;
3  
  fOr (S name : allowedClasses) {
4  
    allowedClassesSet.add("main$" + name);
5  
    allowedClassesSet.add("loadableUtils.utils$" + name);
6  
  }
7  
  ret func(S name) {
8  
    if (!allowedClassesSet.contains(name))
9  
      if (failOnUnknownClass)
10  
        fail("Class not allowed to unstructure: " + name);
11  
      else
12  
        null;
13  
    if (name.startsWith("main$")) {
14  
      S name2 = "loadableUtils.utils$" + substring(name, 5);
15  
      Class c = classForNameOpt(name2);
16  
      if (c != null) ret c;
17  
    }
18  
    ret classForNameOpt(name);
19  
  };
20  
}

Author comment

Began life as a copy of #1024784

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030720
Snippet name: unstructureClassFinderAllowingCertainClasses_preferUtils
Eternal ID of this version: #1030720/4
Text MD5: 6b4b5b6e121190e8d4cba96e4d13c82e
Transpilation MD5: cf4ba035bb1684aa8d291524fd862e47
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-16 17:25:55
Source code size: 697 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 166 / 241
Version history: 3 change(s)
Referenced in: [show references]