Libraryless. Click here for Pure Java version (11166L/68K).
// TODO: unload src libs when not used anymore, // especially: old versions static Map<File, hotwire_srcLibsMap_Cached> hotwire_srcLibsMap = syncMap(); srecord hotwire_srcLibsMap_Cached(ClassLoader classLoader, S jname) {} sbool hotwire_verboseLinking; static JavaXClassLoader hotwire_makeClassLoader_stickyAndSrcLibs(L<File> files) { new L<File> files2; new Map<S, ClassLoader> parents; // key = package/class name for (File f : files) { S libID = DiskSnippetCache_fileToLibID(f); if (libID != null && isStickyLibrary(libID)) { if (addLibrary(libID)) print("Retaining sticky library " + libID); } else if (f != first(files) && isMarkedAsSrcLib(libID = isFile(f) ? loadTextFileFromZip(f, "progID") : null)) { hotwire_srcLibsMap_Cached cached = hotwire_srcLibsMap.get(f); if (cached == null) { print("Hotwiring src lib " + libID + " / " + f); S jname = dropSuffix(".java", getJavaSrcNameOfSrcLib(libID)); assertNempty(libID, jname); Class cc = hotwireSpecialMainClass(libID, jname.replace("/", "."); setCreatorTo(cc, mc()); cached = hotwire_srcLibsMap_Cached(cc.getClassLoader(), jname); hotwire_srcLibsMap.put(f, cached); } S pkg = beforeSlash(cached.jname); if (hotwire_verboseLinking) print("Linking src lib " + libID + " as " + pkg); parents.put(pkg, cached.classLoader); } else files2.add(f); } JavaXClassLoaderWithParents cl = new(null, files2, myClassLoader()); // progID is set later putAll(cl.parentMap, parents); ret cl; }
Began life as a copy of #1016216
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020749 |
Snippet name: | hotwire_makeClassLoader_stickyAndSrcLibs |
Eternal ID of this version: | #1020749/11 |
Text MD5: | d2caf73eec8c3b7435a6c99d735fffd3 |
Transpilation MD5: | b4959c1469644b2895d1fc61e8711c15 |
Author: | stefan |
Category: | javax / class loading |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-23 23:43:47 |
Source code size: | 1623 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 319 / 432 |
Version history: | 10 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1025287 - hotwire_makeClassLoader_stickyAndSrcLibs (backup) |