JarStatsVisualizer is a tool for analyzing Java bytecode using OPAL. It generates metrics, charts, and CSV reports to provide insights into your JAR files.
- Class Analysis: Explore inheritance depth, direct subclasses, and implemented interfaces.
- Method Analysis: Analyze method invocation counts, identify code smells (e.g., long methods, large classes), and more.
- Instruction Analysis: Understand the distribution of top instructions.
- Field Analysis: Evaluate field access modifiers, compare static vs. instance fields, and examine field types.
-
Class Metrics
- Class Distribution: Comparison of interfaces, classes, and abstract classes.
- Inheritance Depth: Measures the depth of class hierarchies.
- Interface Implementations: Aggregates commonly implemented interfaces by class.
- Code Smells: Identifies "long classes" for potential refactoring.
-
Method Metrics
- Code Smells: Detects "long methods" that may require simplification.
- Method Invocations: Distribution of invocation types across all instruction types.
- Methods by Access Modifiers: Analyzes different method types using OPAL.
- Static vs. Instance Methods Distribution: Compares the usage of static and instance methods.
-
Field Analysis
- Total count of static vs. instance fields.
- Field access modifiers.
- Field types, and other attributes.
When the project is executed, Report.scala collects these metrics and generates CSV files and charts.
Examples of the generated files can be found in the output/ folder. The results shown are based on analyzing the WhatsApp.apk, converted to a JAR file.
-
Clone the Repository
Clone the repository and navigate to the project directory. -
Run the Docker Container
Userun.shto build and execute the Docker container. Follow these steps:- Update the path to the JAR file and the output folder in
run.sh. - Run the script. It will automatically build the Docker image, execute the container, and save the results to the specified output folder.
./run.sh
- Update the path to the JAR file and the output folder in
-
Metrics Computation
- Modify or add new logic in the analysis pipeline to customize metrics.
-
Reports & Visualizations
- Adjust or enhance report generation and visualization styles to fit your needs.
