Uses 3273K of libraries. Click here for Pure Java version (17365L/122K).
1 | !7 |
2 | |
3 | lib 1400352 // ByteBuddy |
4 | |
5 | import net.bytebuddy.*; |
6 | import net.bytebuddy.dynamic.*; |
7 | |
8 | module TestByteBuddy > DynPrintLog { |
9 | start-thread { |
10 | S className = "main$NewClass1"; |
11 | DynamicType.Unloaded maker = new ByteBuddy() |
12 | .subclass(Concept) |
13 | .name(className) |
14 | .make(); |
15 | byte[] classData = cast _get binaryRepresentation(maker); |
16 | |
17 | //ClassLoader cl = module().getClass().getClassLoader(); |
18 | File jar = programFile("dynamic.jar"); |
19 | createZipFileWithSingleBinaryFile(jar, className + ".class", classData); |
20 | addLibraryToCurrentProgram(jar); |
21 | Class<? extends Concept> c = classForName(className); |
22 | print(c); |
23 | Concept cc = nu(c); |
24 | print("Got concept: " + cc); |
25 | } |
26 | } |
Began life as a copy of #1027593
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027594 |
Snippet name: | Add new class from ByteBuddy to module's class loader Spike [WORKS, astonishingly] |
Eternal ID of this version: | #1027594/8 |
Text MD5: | eb3b0cc24b525ec4ddc3b688a2fbcf1d |
Transpilation MD5: | e83aa65d3f468e9c845e5fafa5e996f3 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-25 14:23:51 |
Source code size: | 733 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 206 / 367 |
Version history: | 7 change(s) |
Referenced in: | [show references] |