It would be useful to have a tool that can traverse the maven transitive dependency tree, find anything that the project depends on directly and include it as a direct dependency.
Category Archives: Refactoring
Refactoring Ideas: Replace static method with same named static method
Want to produce the same kind of import in the affected classes (static, normal or fully qualified):
public static String repeat(final int count, final char character) { return org.apache.commons.lang3.StringUtils.repeat(character, count); } |
Refactoring Ideas: inline method with flag parameter
Check all calls to see if the value of the flag can be analysed, if so inline everywhere (otherwise tell the developer where it is ambiguous):
public static String pad(final String string, final int length, final char character, final boolean before) { if(before) { return leftPad(string, length, character); } else { return rightPad(string, length, character); } } |
Refactoring Ideas: Remove unused
Starting at some given point, like an API entry point, remove that entry point as well as all code that is now unused! This would be very useful when removing parts of an API to ensure that all code which is only present as a way to implement that API is also removed.
Refactoring Ideas: Replace static method
Replace all calls to one static method with calls to another static method (can be done by replacing the implementation then doing an “inline”, but it could be one command). For example, this would be useful when replacing one utility library (bespoke) with another (commons-lang).
Refactoring Ideas: Move static methods with only one use to the using class
If a static method has only one use, then it can be moved the class where it is being used and made private.