8358468: Enhance code consistency: java.desktop/macos #25607
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the last (!!) remaining platform-specific part of the java.desktop module: macos.
The unix/windows were previously addressed in: #24170 , #24941 and #25439.
Note: Unlike on other platforms, the initial change for macOS caused the "BadSerializationTest" to fail. This test relies on internal details of the Aqua Look & Feel that were previously exposed via serialized data (and already fails on other platforms). Adding the final modifier to the class changes its serialVersionUID, which triggered the failure even on macOS.
To avoid this issue, I have reverted the changes to those internal classes for now, see ff7e64b
To download the diff file and filter only the modified lines you can use the following script:
====================================================
The
java.desktop
module currently lacks proper use of the@Override
annotation for methods and thefinal
modifier for classes. While similar changes were previously made in the JavaSound, java.desktop/windows (and some of the classes on demand), these changes are not as critical now due to the new jdk "encapsulation", but they are still useful for improving code consistency.The public API was not affected so there is no need to worry about a CSR
Note: I will submit additional patches in this area later because:
@Override
andfinal
were modified to keep the diff clear - header dates were not updated (that could be covered by one patch similar to this)@Override
for anonymous classesAny feedback or suggestions are welcome!
Here is a link to a simple diff file, it might be more convenient for reviewing the changes.
The build was successful, and I ran all the open jtreg tests without issues. But it's possible that some closed tests may be affected by these changes. It would be good to verify this by mach5 to ensure everything works as expected.
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25607/head:pull/25607
$ git checkout pull/25607
Update a local copy of the PR:
$ git checkout pull/25607
$ git pull https://git.openjdk.org/jdk.git pull/25607/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25607
View PR using the GUI difftool:
$ git pr show -t 25607
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25607.diff
Using Webrev
Link to Webrev Comment