Skip to content

api: remove unused equals/hashCode from TemplateOVFPropertyResponse - #14049

Open
nagaboinaramgopal wants to merge 1 commit into
apache:4.20from
nagaboinaramgopal:fix/ovf-property-hashcode-npe
Open

api: remove unused equals/hashCode from TemplateOVFPropertyResponse#14049
nagaboinaramgopal wants to merge 1 commit into
apache:4.20from
nagaboinaramgopal:fix/ovf-property-hashcode-npe

Conversation

@nagaboinaramgopal

Copy link
Copy Markdown

equals() tolerates a null key but hashCode() dereferenced it directly, so hashing an instance whose key was never set threw NullPointerException. These responses define equals/hashCode precisely so they can be collected in hash-based sets, making a null key a reachable state. Return 0 for a null key to match the null-safe equals().

Tested: new unit test TemplateOVFPropertyResponseTest (fails before, passes after)

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.34%. Comparing base (2cd8c5e) to head (fa7e114).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #14049      +/-   ##
============================================
- Coverage     16.34%   16.34%   -0.01%     
  Complexity    13574    13574              
============================================
  Files          5669     5669              
  Lines        501368   501360       -8     
  Branches      60903    60902       -1     
============================================
- Hits          81964    81960       -4     
+ Misses       410219   410212       -7     
- Partials       9185     9188       +3     
Flag Coverage Δ
uitests 4.14% <ø> (ø)
unittests 17.20% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

TemplateOVFPropertyResponse is not referenced anywhere outside its own class: nothing keys it in a set or map or compares instances, so its equals()/hashCode() pair has no callers. hashCode() also dereferenced key without a null guard. Remove both methods rather than harden dead code, which also drops the NPE path.
@nagaboinaramgopal
nagaboinaramgopal force-pushed the fix/ovf-property-hashcode-npe branch from 7801830 to fa7e114 Compare September 5, 2026 11:08
@nagaboinaramgopal nagaboinaramgopal changed the title api: null-safe hashCode in TemplateOVFPropertyResponse api: remove unused equals/hashCode from TemplateOVFPropertyResponse Sep 5, 2026
@DaanHoogland DaanHoogland added this to the 4.20.4 milestone Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants