ClassTrim is a framework to recommend move method refactoring using Non-dominated Sorting Genetic Algorithm-III ( NSGA-III) to minimizing the number of classes that exceed predefined metric thresholds.
Raw experiment data doi: 10.17632/8b3fd45kp6.1
Run ClassTrim plugin on smelly-demo
- Prerequisites
- JDK 17+
- Maven 3.8+
- Configure environment
- Copy
classtrim-core/src/main/resources/config.properties.exampletoclasstrim-core/src/main/resources/config.properties. - Edit the new
config.propertiesand set values for your environment:mavenRepo: absolute path to your local Maven repositorydatasetRoot: absolute path to the datasets root folderoutputFolder: output folder for results (optional; defaultoutput)projectCacheFolder: folder for serialized project cache (optional; default.project)notifyUrl: optional webhook for notifications
-
Entry point
org.classtrim.Mainrun the move method refactoring algorithm on each project.org.classtrim.NSGAII,org.classtrim.NSGAIII, ororg.classtrim.MOEADrun it once.org.classtrim.baseline.BaselineRefactorrun baseline comparison experiment.
-
Build and test modules
- Run all modules:
mvn test - Run core only:
mvn -pl classtrim-core test - Run CLI only:
mvn -pl classtrim-cli test
- Build IntelliJ plugin
- Package plugin zip:
mvn -pl classtrim-plugin -am package - Output:
classtrim-plugin/target/classtrim-plugin-1.0-SNAPSHOT-idea-plugin.zip
This repository now includes extraction scaffolding for library-style usage:
classtrim-core/: Maven module packaging the current core code and new injectable APIs underorg.classtrim.core.*classtrim-cli/: Maven module withorg.classtrim.cli.RunNsgaiiiexample entrypoint using the extracted service APIclasstrim-plugin/: IntelliJ IDEA plugin scaffold wired to run core analysis and show notifications
New core API entrypoints:
org.classtrim.core.analyzer.ProjectAnalyzer/StandardProjectAnalyzerorg.classtrim.core.engine.RefactoringEngine/NSGAIIIRefactoringEngineorg.classtrim.core.service.ClassTrimServiceorg.classtrim.core.model.ProjectSource/BinaryPathProjectSourceorg.classtrim.core.repository.ProjectRepository(in-memory and filesystem implementations)
How I calculate metrics and some common question are in wiki.
This folder contains results from baseline tools for comparison, including:
- Runtime screenshots produced during baseline runs
- Suggested outputs generated by each baseline tool (e.g.,
*.tsvsummaries)
Typical subfolders include JDeodorant/, JMove/, HMove/ and REsolution/, each organized by project-version. These
provide reference suggestions and artifacts to compare against this project's NSGA-based refactoring outputs.
- Follow unix philosophy.
- Uses Lombok to simplify data classes (getters/setters, constructors)
- Uses Java 8
Optionalto handle nulls elegantly - Emphasizes immutability; returns unmodified collections
- Caches computed objects to improve performance
- Keeps dependencies minimal
- Automatically records experiment results and summaries (summary may be improved by using a database)
- Includes unit tests

