https://github.com/henryhchchc/mokapot
A library for analyzing and manipulating JVM bytecode
https://github.com/henryhchchc/mokapot
ir java jvm rust ssa static-analysis
Last synced: about 1 year ago
JSON representation
A library for analyzing and manipulating JVM bytecode
- Host: GitHub
- URL: https://github.com/henryhchchc/mokapot
- Owner: henryhchchc
- License: mit
- Created: 2023-07-17T06:05:14.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-05-14T13:15:22.000Z (about 1 year ago)
- Last Synced: 2025-05-14T14:41:29.803Z (about 1 year ago)
- Topics: ir, java, jvm, rust, ssa, static-analysis
- Language: Rust
- Homepage: https://aka.henryhc.net/mokapot
- Size: 1.3 MB
- Stars: 14
- Watchers: 3
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: docs/CODE_OF_CONDUCT.md
- Security: docs/SECURITY.md
Awesome Lists containing this project
README
# MokaPot
[](https://github.com/henryhchchc/mokapot)
[](https://github.com/henryhchchc/mokapot/actions/workflows/ci.yml)
[](https://app.codecov.io/gh/henryhchchc/mokapot/)
[](https://crates.io/crates/mokapot)
[](https://docs.rs/mokapot)
[](docs/CODE_OF_CONDUCT.md)
MokaPot is a library for analyzing and manipulating JVM bytecode. It is written in Rust for performance and safety.
> [!WARNING]
> **API Stability:** This project is in an early development stage and breaking changes can happen before v1.0.0.
> Using this project for production is currently NOT RECOMMENDED.
## Documentation
The documentation of the released version is available at [docs.rs](https://docs.rs/mokapot).
The documentation of the latest commit is available at [github.io](https://henryhchchc.github.io/mokapot/mokapot/)
## Usage
### Adding the dependency
Run the following command in the root directory of your project.
```sh
cargo add mokapot
```
Alternatively, to follow the latest commit version, run the following command instead.
Before building your project, run `cargo update` to fetch the latest commit.
```sh
cargo add --git https://github.com/henryhchchc/mokapot.git mokapot
```
### Parsing a class
```rust
use mokapot::jvm::class::Class;
fn parse_class() -> Result> {
let reader = todo!("Some reader for the byte code");
let class = Class::from_reader(&mut reader)?;
Ok(class)
}
```
### MokaIR
MokaIR is an intermediate representation of JVM bytecode in [mokapot](https://github.com/henryhchchc/mokapot).
To learn more, please refer to [docs/MokaIR.md](docs/MokaIR.md)
## Building
Make sure you have the following tools installed:
- The latest stable version of Rust
- The latest release version of JDK
Compile the project and run the tests with the following command.
```bash
cargo build --all-features
cargo test --all-features
```
## Contributing
Cool. Contributions are welcomed. See the [contribution guide](docs/CONTRIBUTING.md) for more information.