A tool designed to inspect Java class hierarchies using the Java Reflection API. This project scans type systems to identify and rank classes based on structural metrics such as field counts, method signatures, and inheritance depth.
- Type Inspection: Traverses class hierarchies to calculate declared and inherited members.
- Module System Awareness: Loads and filters types from the Java 21 boot layer, specifically targeting
java.*andjdk.*packages. - Metric-Based Ranking: Ranks the "Top N" classes based on fields, unique method signatures, and subtype/supertype counts.
- Hierarchy Traversal: Analyzes fields and methods while respecting access modifiers, such as filtering private members from superclasses.
- Uniqueness Checking: Uses
Java Setsto manage same-named methods or fields resulting from overloading, overriding, or shadowing. - Filtering: Skips special entries like
package-info,module-info, andMETA-INFto focus on functional classes. - Flexible Data Input: Supports scanning the entire JDK or analyzing targeted libraries via input files.
Analyze the top 10 classes within the standard Java libraries:
java Main 10
Analyze specific classes from an input file and save results to an output file:
java -cp .;libraries\commons-lang3-3.17.0.jar Main resources\input.txt resources\output.txt 10
The API documentation, generated via Javadoc, is available here: Javadoc Page
The project is structured for command-line execution. Ensure you are in the root directory before running these commands.
1. Compile
javac -d bin -cp "libraries/*" ClassScanner.java Main.java
2. Run (JDK Mode)
java -cp "bin;libraries/*" Main 10
3. Run (Target File Mode)
java -cp "bin;libraries/*" Main resources/input.txt resources/output.txt 10
This project is licensed under the MIT License.