Semantic Aware Program Reducer for Java
This project implements a program reduction tool that can:
- Remove declarations (classes, methods, fields, variables)
- Replace code elements with constants/null values
- Break inheritance relationships
python3 -m main --source-file <file.java> --script <test_script.sh> --mode <remove|replace>remove: Only removes code elementsreplace: Replaces elements with constants, then removesremovereplace: Combined replace-then-remove approach
python3 -m main --source-file iter_1/Main.java --script iter_1/run.sh --mode removesetup.sh: Initializes fresh test environment, copies source filescleanup.sh: Removes temporary files and resets workspaceevaluator.py: Runs batch evaluation across multiple test casescomparator.py: Compares reduction results between different modes
# Ensure test cases are in generator_modified/ or similar directory
# Each iter_X/ folder should contain Main.java and run.shpython3 evaluator.py# Parse timing data
python3 extract_times.py <path_to_log_file>
# Compare modes
python3 comparator.pyevaluation_results_YYYYMMDD_HHMMSS/
├── remove_mode_evaluation.log
├── replace_mode_evaluation.log
├── removereplace_mode_evaluation.log
├── remove_mode_results/
├── replace_mode_results/
└── removereplace_mode_results/
The tool has been evaluated using 3 different test suites, with all 3 modes tested per suite:
- JDK23 errors: Compilation error test cases from JDK 23
- JDK11 errors: Compilation error test cases from JDK 11
- JDK8 crashes: Compiler crash test cases from JDK 8
Comparative evaluation results against the Perses reducer can be found in the perses-results/ folder.








