io.codemodder.codemods.DefineConstantForLiteralCodemod.description.md Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core-codemods Show documentation
Show all versions of core-codemods Show documentation
Codemods for fixing common errors across many Java projects
This change defines a constant for duplicated literal expression values, simplifying the refactoring process and mitigating the risk of overlooking any values during updates.
Our changes look something like this:
```diff
+ private static final String EXCEPTION_AT = "Exception at";
- LOG.error("Exception at", ex)
+ builder.add(EXCEPTION_AT)
- LOG.error("Exception at", ex)
+ builder.add(EXCEPTION_AT)
- LOG.error("Exception at", ex)
+ builder.add(EXCEPTION_AT)
```