- SonarQube™ - Community Edition - Version 9.0 (build 45539) - [LGPL v3]
Any simple java class containing the two inner classes below is flagged as having duplicate code blocks. Please note that one class is Property Names and one is Property Values. The member names of the two classes are identical however the assigned values are entirely different. Clearly, there is ZERO duplication here, just a common sense parallel naming scheme. Obviously this is a nonsense example inspired by actual code.
* Property names.
*/
@SuppressWarnings("unused")
public static class PropertyNames {
private static final String FIRST = "first";
private static final String SECOND = "second";
private static final String THIRD = "third";
private static final String FOURTH = "fourth";
private static final String FIFTH = "fifth";
private static final String SIXTH = "sixth";
private static final String SEVENTH = "seventh";
private static final String EIGHTH = "eighth";
private static final String NINETH = "nineth";
private static final String TENTH = "tenth";
private PropertyNames() {
// Prevent construction.
}
}
/**
* Property values.
*/
@SuppressWarnings("unused")
public static class PropertyValues {
private static final String FIRST = "one";
private static final String SECOND = "two";
private static final String THIRD = "three";
private static final String FOURTH = "four";
private static final String FIFTH = "five";
private static final String SIXTH = "six";
private static final String SEVENTH = "seven";
private static final String EIGHTH = "eight";
private static final String NINETH = "nine";
private static final String TENTH = "ten";
private PropertyValues() {
// Prevent construction.
}
}