Skip to content

Conversation

@akoch-yatta
Copy link
Contributor

This PR removes the obsolete equals and hashCode methods for Region. For the upcoming changes for win32 the current implementation cannot be used anymore because all handles will be created on demand. As the current implementation is equal in their behavior to the base behavior for these methods inherited from Object they will be removed.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2025

Test Results

   506 files  ±0     506 suites  ±0   7m 55s ⏱️ -43s
 4 339 tests ±0   4 325 ✅ ±0   14 💤 ±0  0 ❌ ±0 
16 595 runs  ±0  16 486 ✅ ±0  109 💤 ±0  0 ❌ ±0 

Results for commit 8d677bd. ± Comparison against base commit f03d8f0.

♻️ This comment has been updated with latest results.

@akoch-yatta akoch-yatta force-pushed the remove-unused-equals-hashcode-in-region branch 3 times, most recently from 3887356 to a5e8853 Compare March 6, 2025 16:59
@HeikoKlare
Copy link
Contributor

@laeubi we have question regarding API tooling, which you may know best about 🙂

This PR removes hashCode/equals implementations as the actual implementation are completely useless. When simply removing them, the build fails because of API errors:

Caused by: org.eclipse.tycho.core.exceptions.VersionBumpRequiredException: There are API errors:
[2196](https://github.com/eclipse-platform/eclipse.platform.swt/actions/runs/13703850988/job/38324210490?pr=1880#step:7:2197)
The method org.eclipse.swt.graphics.Region.equals(Object) has been removed
[2197](https://github.com/eclipse-platform/eclipse.platform.swt/actions/runs/13703850988/job/38324210490?pr=1880#step:7:2198)
The method org.eclipse.swt.graphics.Region.hashCode() has been removed
[2198](https://github.com/eclipse-platform/eclipse.platform.swt/actions/runs/13703850988/job/38324210490?pr=1880#step:7:2199)
META-INF/MANIFEST.MF:1 The major version should be incremented in version 3.130.0, since API breakage occurred since version 3.129.0

When adding API filters (since there is no breaking API change as the methods are provided via Object already), the API tools validation complains about unused filter:

NORMAL:
The API problem filter for: 'The method org.eclipse.swt.graphics.Region.hashCode() has been removed' is no longer used

The complain about the unused filter also shows up in the IDE.

I guess this is some cornercase as implementations of methods already provided via Object are removed, such that they are of course still part of public API but not present in any explicit class of the inheritance hierarchy.

Do you know something about this situation or what we could do about it (either here at consumer side or in API tools itself)?

@laeubi
Copy link
Contributor

laeubi commented Mar 7, 2025

@HeikoKlare I don't know why API tool exactly complains, but of course equals/hashcode can be part of the API contract (e.g. as in Set/List/Map/ ...).

I probably would here just keep the methods and call super...

@HeikoKlare
Copy link
Contributor

Thank you for the feedback! Yeah, then keeping the methods and just calling super is probably the best option (@akoch-yatta fyi)

@akoch-yatta akoch-yatta force-pushed the remove-unused-equals-hashcode-in-region branch from a5e8853 to 7f09e14 Compare March 7, 2025 08:53
@HeikoKlare HeikoKlare force-pushed the remove-unused-equals-hashcode-in-region branch from 7f09e14 to 8d677bd Compare March 7, 2025 10:33
This commit adapt the obsolete equals and hashCode methods for Region to
use the super implementation instead. For the upcoming changes for win32
the current implementation cannot be used anymore because all handles
will be created on demand. As the current implementation is equal in
their behavior to the base behavior for these methods is inherited from
Object.
@HeikoKlare HeikoKlare merged commit 523a5d4 into eclipse-platform:master Mar 7, 2025
14 checks passed
@HeikoKlare HeikoKlare deleted the remove-unused-equals-hashcode-in-region branch March 7, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants