Programming
IntelliJ: Suppress duplicate code warnings
by admin on Feb.07, 2019, under Programming
IntelliJ IDEA has a feature do detect duplicate code through static code analysis. Once a piece of duplicate code was detected it will be highlighted as shown below:
The idea is to ask the programmer to refactor the code accordingly since having bugs in duplicate code automatically means having duplicate bugs. We may however ignore these hints by adding the @SuppressWarnings annotation to our class:
@SuppressWarnings("Duplicates") public class HelloWorld { ... }
Even though it’s possible, one should prefer to refactor the code instead.