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

18
LINES

< > BotCompany Repo | #1035083 // LASClassLoader - class loader for classes defined in left-arrow scripts

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

Libraryless. Click here for Pure Java version (8095L/45K).

1  
sclass LASClassLoader extends InMemoryClassLoader is ILASClassLoader {
2  
  new Map<S, Class> definedClasses;
3  
  Lock lock = lock();
4  
  
5  
  *(ClassLoader parent) { super(parent); }
6  
  *(Class parent) { super(parent.getClassLoader()); }
7  
  
8  
  public Class<?> defineLASClass(S name, IF0<byte[]> generateClass) {
9  
    lock lock;
10  
    
11  
    try {
12  
      ret loadClass(name);
13  
    } catch (ClassNotFoundException e) {
14  
      print("Generating class " + name);
15  
      ret defineAClass(name, generateClass!);
16  
    }
17  
  }
18  
}

Author comment

Began life as a copy of #1034296

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035083
Snippet name: LASClassLoader - class loader for classes defined in left-arrow scripts
Eternal ID of this version: #1035083/3
Text MD5: 709e411d09f62b76b7dbf72c38ef512d
Transpilation MD5: 4509874d9dee6cc28d58907564a83f1b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 01:10:48
Source code size: 515 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 152 / 239
Version history: 2 change(s)
Referenced in: [show references]