Java 8 introduced String Deduplication that can be enabled by launching JVM with -XX:+UseStringDeduplication option allowing to save some memory by referencing
At javaperf consulting we have developed an automate which automatically performs corrections in your source code. In fact there is no longer any duplication of strings. The correction rule applies the recommendations of SonarQube and calculates the variable names so that they remain readable in the code. The automate also takes into account the other variables already used to avoid name collisions.