Java Bytecode Descriptor Parser for Rust
Introduction
Effortlessly parse and manipulate Java bytecode descriptors in Rust.
This crate provides a lightweight, efficient, and easy-to-use solution for working with Java class, field, and method descriptors.
To use it, add the following lines to your Cargo.toml file:
[]
= "0.2.0"
Why Use This Crate?
✅ Parse Java Method Signatures – Extract return types, parameters, and more from JVM bytecode descriptors. ✅ Ultra-Lightweight – Zero dependencies and minimal runtime overhead. ✅ Rust & Java Interoperability – Perfect for Rust tools interacting with Java class files. ✅ Beyond Classfiles – Useful for RPC, static analysis, IDE plugins, serialization, and more! ✅ Optimized for Performance – Designed to handle large-scale descriptor processing efficiently.
For more details about Java bytecode descriptors, check out the relevant sections in the Java Virtual Machine Specification (JVMS):
- Field Descriptors: Section 4.3.2
- Method Descriptors: Section 4.3.3
Usage
Dealing with Type Descriptors
let parsed: TypeDescriptor = "[[Ljava/lang/String;".parse.unwrap;
println!; // Array(Object("java/lang/String"), 2)
println!; // [[Ljava/lang/String;
Dealing with Method Descriptors
let parsed: MethodDescriptor = "(FIB)S".parse.unwrap;
println!; // MethodDescriptor { parameter_types: [Float, Integer, Byte], return_type: Short }
println!; // (FIB)S
Use Cases
- Java Classfile Parsing – Helper for parsing
.classfiles and analyze type and method signatures. - Interoperability – Bridge Rust and Java, ensuring type correctness in JNI/FFI calls.
- Code Generation – Generate Java bindings, stubs, and DSLs with validated signatures.
- Static Analysis – Build security tools that detect unsafe Java method patterns.
- IDE Plugins & Developer Tools – Provide type hints and method signature insights.
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License – see the LICENSE file for details.