A tool to apply program transformations on Java (*.java) methods for generating semantic-preserving transformed programs.
- openjdk 1.8.0_222
- javaparser 3.24.4
- Create Jar file with Maven:
$ mvn clean compile assembly:single
# Output: target/jar/JavaTransformer.jar
- Create Jar file with Ant:
$ mvn dependency:copy-dependencies
$ ant jar
# Output: build/jar/JavaTransformer.jar
- Given input and output path, execute jar:
Note:
# input_path = Input directory to the original programs. # output_path = Output directory to the transformed programs. $ java -jar JavaTransformer.jar "input_path" "output_path"
The scope of transformation is at the method level, so each (*.java) file should contain only a single method.
To modify the scope, first check getParseUnit for CompilationUnit.
Or, convert java files into single method-only files using JavaMethodExtractor before applying transformation.
- BooleanExchange
- LogStatement
- LoopExchange
- PermuteStatement
- ReorderCondition
- SwitchToIf
- TryCatch
- UnusedStatement
- VariableRenaming
- Testing Neural Program Analyzers [Paper] [GitHub]
- On the generalizability of Neural Program Models with respect to semantic-preserving program transformations [Paper] [GitHub]
- JavaParser: https://github.com/javaparser/javaparser