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

sclass LASClassLoader extends InMemoryClassLoader is ILASClassLoader {
  new Map<S, Class> definedClasses;
  Lock lock = lock();
  
  *(ClassLoader parent) { super(parent); }
  *(Class parent) { super(parent.getClassLoader()); }
  
  public Class<?> defineLASClass(S name, IF0<byte[]> generateClass) {
    lock lock;
    
    try {
      ret loadClass(name);
    } catch (ClassNotFoundException e) {
      print("Generating class " + name);
      ret defineAClass(name, generateClass!);
    }
  }
}

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: 153 / 239
Version history: 2 change(s)
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)
#1035319 - ILASClassLoader
#1035329 - LASMultiClassLoader