Uses 3273K of libraries. Click here for Pure Java version (17365L/122K).
!7 lib 1400352 // ByteBuddy import net.bytebuddy.*; import net.bytebuddy.dynamic.*; module TestByteBuddy > DynPrintLog { start-thread { S className = "main$NewClass1"; DynamicType.Unloaded maker = new ByteBuddy() .subclass(Concept) .name(className) .make(); byte[] classData = cast _get binaryRepresentation(maker); //ClassLoader cl = module().getClass().getClassLoader(); File jar = programFile("dynamic.jar"); createZipFileWithSingleBinaryFile(jar, className + ".class", classData); addLibraryToCurrentProgram(jar); Class<? extends Concept> c = classForName(className); print(c); Concept cc = nu(c); print("Got concept: " + cc); } }
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: | 502 / 680 |
| Version history: | 7 change(s) |
| Referenced in: | #1027598 - byteBuddy_newSubClass_bytes |