archive archive plugin · 0.2.0
Inside a JAR, WAR, wheel or any ZIP without unpacking it; a class as its declarations, no javap.
- Opens
**/*.jar,**/*.war,**/*.ear,**/*.aar,**/*.apk,**/*.zip,**/*.whl,**/*.egg,**/*.nupkg,**/*.jmod,**/*.vsix,**/*.hpi,**/*.jpi,**/*.class- Try
ototo read lib/core.jar!org.demo.Shelf- Is lent
- The bytes of those files only, read-only: no other file, no network. What it finds is unpacked in memory, never to disk.
- Needs
- Otōto 2.11.0 or later:
ototo update - Built from
b3b7eca, and rebuildable from it
What it does
Inside JARs and other ZIP archives, without unpacking them; and a compiled Java class as its declarations, with their annotations.
It opens .jar, .war, .ear, .aar, .apk, .zip, .whl, .egg, .nupkg, .jmod, .vsix, .hpi and .jpi files, and .class files on disk. What is inside an archive is addressed by the archive, a !, and the entry:
ototo outline lib/core-1.4.2.jar: what is in it, by directory, with what its manifest says; a directory of it:ototo outline lib/core-1.4.2.jar!org/demo/io.ototo read lib/core-1.4.2.jar!org/demo/Shelf.class: a class, as its declarations. The same by its Java name (…!org.demo.Shelf) or its short name when only one class has it (…!Shelf); one member with#join.ototo read lib/core-1.4.2.jar!META-INF/MANIFEST.MF: any text entry, with:10-40or#nameas for a file.ototo read app.war!WEB-INF/lib/core.jar!Shelf: an archive in an archive, one more!.
A class comes as the Java it was compiled from, without the bodies: modifiers, type parameters, what it extends and implements, a record's components, and each field, constructor and method with its generic types, its throws, its parameters' names when the compiler kept them (-g, the default of Maven and Gradle, or -parameters) and a constant's value. It is read from the class file's own tables: no JDK, no javap, no decompiler. What the compiler made up (bridges, access$000, lambda$…, $VALUES) is left out; Kotlin's public inline functions are kept.
Annotations are shown as source writes them, above the class, the field or the method they are on, and before a parameter or a record's component: @GetMapping("/shelves/{id}"), @ConditionalOnClass({DataSource.class, EmbeddedDatabaseType.class}), @Nullable. Both kinds the class file keeps are read, those kept at run time and those kept only in the file, which javap shows only with -v. #find reads a method with its annotations; the outline lists declarations without them. Not shown: annotations on a type's use (List<@NonNull String>, and JSpecify's @Nullable, which is one), and what the compiler never wrote to the class file (@Override, Lombok's). Kotlin's own metadata is left out.
When a -sources.jar sits beside a JAR, as in Maven's and Gradle's caches, the class says where its source is, and that entry reads like any Java file, bodies included.
Nothing is written to disk and nothing is run. An entry is inflated in memory, up to 2 MB, and must match the size and checksum the archive gives for it; an archive in an archive up to 64 MB. Encrypted entries, and ones packed by a method other than deflate, are refused by name. A secrets file in an archive (a .env, a key) is neither listed nor read.
The archive must be one Otōto may read: in the repository, in a worktree or an added directory, or, for your dependencies, in a cache named by dependency_caches in Otōto's settings (dependency_caches = true for ~/.m2/repository and ~/.gradle/caches). Otōto lends this plugin the bytes of those files only.
Not here: tarballs, a search inside an archive, and bytecode (javap -c).
Download it by hand
archive.wasm (329 KB) and its signature: save them as archive.wasm and archive.wasm.sig in ~/.config/ototo/plugins. Otōto loads a plugin only when its signature is by a key in your allowed_signers; the installer puts Otōto's there.
SHA-256 of the .wasm: 359149898d44e84c198f2144117f4c22603f498c384c41a1b445eac52fa46986