Skip to content

[Bug] Fix HE_EQUALS_USE_HASHCODE: add missing hashCode() to Config model classes #14547

Description

@cxhello

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategory issues or prs related to bug.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions