What is JacoDB?
JacoDB is the Java Compilation Database for fast and efficient JVM bytecode analysis.
For any kind of program analysis, you need to know the program structure. Whether you develop an IDE-internal static analyzer, a CI solution, or a custom checker to scan Java/Kotlin code for errors and vulnerabilities, you need to get info about classes, methods, fields, parameters. Most of the tools build AST from the source code, but what if you have no source code? What if building AST is not enough for finding an error? Or if you deal with multilingual project?
JacoDB meets all these cases. With JacoDB library, you analyze JVM bytecode represented as a list of three-address instructions. You can get class hierarchies and call graphs, investigate annotations, methods, fields, and their usages — either stored in memory or persisted.
Features
Benefit from high performance and Java/Kotlin API, and get use of more JacoDB features.
Create extensions
JacoDB has an extensible API — create a custom plugin to process bytecode, store data, or intervene into the program flow.
Persist and reuse
You can store information about classes, hierarchies, annotations, methods, fields, and parameters in an SQLite database and reuse it for fast start-ups, or you can perform in-memory operations with your data.
Reduce memory consumption
Due to balance between the lazy and eager initialization types, JacoDB shows high performance while consuming less resources.
Rely on immutability
Each object returned by JacoDB is immutable — like an independent snapshot of classes, which cannot be modified since it is created.
Make use of concurrency
Due to immutability, JacoDB is thread-safe and provides you with an asynchronous API. If one sends a request to JacoDB while loading JAR-files from another thread, JacoDB represents only a consistent state of the JAR-files being loaded. It is the completely loaded JAR-file that appears in JacoDB output.
Choose JVM runtime
You can bind your plugin processes to a specific Java runtime version (since Java 1.8), so there are no version conflicts.
Get started
Add this to dependencies
in build.gradle.kts
(for Gradle) or pom.xml
(for Maven):
implementation(group = "org.jacodb", name = "jacodb-api", version = jacodbVersion) implementation(group = "org.jacodb", name = "jacodb-core", version = jacodbVersion) implementation(group = "org.jacodb", name = "jacodb-analysis", version = jacodbVersion)
Docs, examples, and more
Learn more on JacoDB to make use of it in your project and feel free to contribute.
Find detailed documentation
- Learn JacoDB basics.
- Store and query additional information based on bytecode with classpath and database features.
- Get use of raw bytecode instructions and control flow graphs.
- Perform static dataflow analysis.
- Learn how to migrate from Soot.
- Search through the full API reference.
Get inspired with real examples
- Find the story about using JacoDB for a symbolic execution based project.
- Learn how to benefit from JacoDB when creating a type solver.
- Know how to implement approximations for program analysis algorithms.
Learn more about the project
- Find more on maintainers and contributing.
- Get information on JacoDB benchmarking.
- Test JacoDB API.