Libraryless. Click here for Pure Java version (10349L/58K).
// takes ~70 ms to set up, do it only once if possible sclass ClassNameResolver { settable File byteCodePath = byteCodePathForClass(getClass()); LS importedPackages = itemPlusList("java.lang", endingWith_dropSuffix(standardImports(), ".*")); simplyCached Set<S> allFullyQualifiedClassNames() { new Set<S> set; assertNotNull(byteCodePath); set.addAll(classNamesInJarOrDir(byteCodePath)); printVars ClassNameResolver(+byteCodePath, classesFound := l(set)); set.addAll(classNamesInLoadedJigsawModules()); ret set; } selfType init() { allFullyQualifiedClassNames(); this; } S findClass(S name) { for (S pkg : importedPackages) { S fullName = pkg + "." + name; if (allFullyQualifiedClassNames().contains(fullName)) ret fullName; } null; } void printMe { printVars("ClassNameResolver", +byteCodePath); print(+importedPackages); } }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034226 |
Snippet name: | ClassNameResolver |
Eternal ID of this version: | #1034226/11 |
Text MD5: | c161cf6053a9819e3162ae8d6bc88bdd |
Transpilation MD5: | d4cd33f85540feb3745d4697459139cc |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-29 07:44:16 |
Source code size: | 951 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 181 / 327 |
Version history: | 10 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) |