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

44
LINES

< > BotCompany Repo | #1035084 // ResolvableLASClass (is an implementation of Type)

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

Transpiled version (31176L) is out of date.

1  
persistable sclass ResolvableLASClass is IResolvableClass {
2  
  transient ILASClassLoader lasClassLoader;
3  
  LASClassDef classDef;
4  
5  
  *(ILASClassLoader *lasClassLoader, LASClassDef *classDef) {}
6  
  
7  
  public S resolveToClassName() {
8  
    ret classDef.finalClassName();
9  
  }
10  
  
11  
  Class resolvedClass() {
12  
    ret classDef.resolvedClass;
13  
  }
14  
  
15  
  public Class get aka resolveToClass() {
16  
    if (resolvedClass() == null) {
17  
      if (lasClassLoader == null)
18  
        fail("Need LASClassLoader to define " + classDef.userGivenName);
19  
      Class resolvedClass = lasClassLoader.defineLASClass(classDef.finalClassName(),
20  
        -> classDef.toBytes());
21  
        
22  
      // set resolvedClass & init static fields
23  
      classDef.init(resolvedClass);
24  
    }
25  
    
26  
    ret resolvedClass();
27  
  }
28  
  
29  
  // This function is very defensive (doesn't resolve anything)
30  
  toString {
31  
    if (resolvedClass() != null)
32  
      ret className(resolvedClass());
33  
    
34  
    try object userGivenName();
35  
    
36  
    if (classDef.classHash_cache != null)
37  
      ret classDef.finalClassNameWithoutPrefix();
38  
      
39  
    ret or2(userGivenName(), "script-defined class")
40  
      + " [unresolved]";
41  
  }
42  
  
43  
  S userGivenName() { ret classDef.userGivenName; }
44  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1035084
Snippet name: ResolvableLASClass (is an implementation of Type)
Eternal ID of this version: #1035084/18
Text MD5: 1c9ef75a9316f28ae5d4190fe7a48c92
Author: stefan
Category: javax / left arrow script
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-04-29 23:53:25
Source code size: 1243 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 216 / 364
Version history: 17 change(s)
Referenced in: [show references]