Background
Follow-up to #14469 (SpotBugs check enforcement). This addresses the HE_EQUALS_USE_HASHCODE pattern — classes that define equals() but rely on Object.hashCode(), violating the Java equals/hashCode contract. This can cause incorrect behavior when used in HashMap/HashSet.
Affected locations (3 occurrences under threshold=High)
| # |
Module |
File |
Line |
Description |
| 1 |
config |
ConfigAdvanceInfo.java |
L133-140 |
equals() based on multiple config metadata fields |
| 2 |
config |
ConfigInfoBase.java |
L175-213 |
equals() based on dataId, group, content, md5 |
| 3 |
config |
ConfigInfoChanged.java |
L64-88 |
equals() based on dataId, group |
Fix
Add hashCode() implementation using Objects.hash(...) based on the same fields used in equals() for each class.
After fixing, remove the HE_EQUALS_USE_HASHCODE exclusion from style/spotbugs-exclude.xml.
Background
Follow-up to #14469 (SpotBugs check enforcement). This addresses the
HE_EQUALS_USE_HASHCODEpattern — classes that defineequals()but rely onObject.hashCode(), violating the Javaequals/hashCodecontract. This can cause incorrect behavior when used inHashMap/HashSet.Affected locations (3 occurrences under threshold=High)
ConfigAdvanceInfo.javaConfigInfoBase.javaConfigInfoChanged.javaFix
Add
hashCode()implementation usingObjects.hash(...)based on the same fields used inequals()for each class.After fixing, remove the
HE_EQUALS_USE_HASHCODEexclusion fromstyle/spotbugs-exclude.xml.