Libraryless. Click here for Pure Java version (4624L/26K).
1 | // finds the byte code path root (dir or jar) |
2 | // TODO: inner classes will not be found (need to replace . with $) |
3 | static File byteCodePathForClass(Class c) {
|
4 | if (c == null) null; |
5 | ClassLoader cl = getClassLoader(c); |
6 | |
7 | // handle JavaXClassLoader |
8 | Cl<File> files = cast getOpt(cl, 'files); |
9 | if (files != null) {
|
10 | S name = c.getName().replace('.', '/') + ".class";
|
11 | for (File location : files) |
12 | if (dirOrZipContainsPath(location, name)) |
13 | ret location; |
14 | fail(name + " not found in: " + files); |
15 | } |
16 | |
17 | null; |
18 | } |
19 | |
20 | static File byteCodePathForClass(O o) {
|
21 | ret byteCodePathForClass(_getClass(o)); |
22 | } |
Began life as a copy of #1012231
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1031552 |
| Snippet name: | byteCodePathForClass - use getBytecodePathForClass instead |
| Eternal ID of this version: | #1031552/7 |
| Text MD5: | 63389302febcf02684124418b353a703 |
| Transpilation MD5: | 47f2dca5a596ededcc6b459a0767fab9 |
| Author: | stefan |
| Category: | javax / byte code |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-21 17:20:38 |
| Source code size: | 642 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1453 / 501 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |