public class Test {
private static final String HELLO = "Hello, ";
private static final String WORLD = "World";
private static final String HELLO_WORLD = HELLO + WORLD;
public static void main(String[] args) {
System.out.println(HELLO_WORLD);
}
}
Command:grit apply unused_private_fields
Output:
public class Test {
private static final String HELLO_WORLD = HELLO + WORLD;
public static void main(String[] args) {
System.out.println(HELLO_WORLD);
}
}
https://github.com/getgrit/stdlib/blob/main/.grit/patterns/java/unused_private_fields.md
Code:
Command:
grit apply unused_private_fields
Output:
Same applies to non-static fields