https://github.com/kylepls/jrefactor
API for writing custom refactoring tools such as obfuscators, optimizers, and formatters.
https://github.com/kylepls/jrefactor
antlr4 java java8 parser refactoring
Last synced: 9 months ago
JSON representation
API for writing custom refactoring tools such as obfuscators, optimizers, and formatters.
- Host: GitHub
- URL: https://github.com/kylepls/jrefactor
- Owner: kylepls
- Created: 2017-12-31T06:23:48.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T23:00:47.000Z (over 5 years ago)
- Last Synced: 2025-01-07T11:10:57.299Z (about 1 year ago)
- Topics: antlr4, java, java8, parser, refactoring
- Language: Java
- Homepage:
- Size: 783 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### JRefactor
An over-the-top API for writing refactoring utilities for Java code.
---
##### Usage Examples
###### Literal Simplification
[LiteralOptimizer.java](https://github.com/kylepls/JRefactor/blob/master/refactor/src/test/java/in/kyle/jrefactor/refactor/LiteralOptimizer.java)
```Java
//Subject:
private static final String string = "Hello" + " World" + 1 + (1 + 1 + 1 + 1) + ((" Two"));
//Pass 1:
private static final String string = "Hello" + " World" + 1 + (1 + 1 + 1 + 1) + ((" Two"));
//Pass 2:
private static final String string = "Hello World1" + (3 + 1) + " Two";
//Pass 3:
private static final String string = "Hello World1" + (4) + " Two";
//Pass 4:
private static final String string = "Hello World14" + " Two";
//Pass 5:
private static final String string = "Hello World14 Two";
//Pass 6:
private static final String string = "Hello World14 Two";
//Pass 7:
private static final String string = "Hello World14 Two";
```