[Cocoa] Remove code only relevant for macOS < 11.0#3195
Draft
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
Draft
[Cocoa] Remove code only relevant for macOS < 11.0#3195HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
Conversation
Following the bump of the minimum supported macOS version to 11.0 (see eclipse-platform#3185), this removes all code paths that were only needed for older macOS versions. The search was performed by scanning all Java files in the cocoa-specific directories for OS.VERSION comparisons and isBigSurOrLater() calls, then removing branches that are now always-false (< some version < 11.0) or inlining branches that are now always-true (>= some version <= 11.0).
Contributor
Contributor
|
Nice one. Good to see that Claude is useful to you and our Eclipse project to improve the code base. |
HannesWell
reviewed
Apr 4, 2026
Member
HannesWell
left a comment
There was a problem hiding this comment.
That's a nice clean-up.
After a quick-search it seems like the removal affects all version checks and now API introduced in macOS 11 or later is used.
Comment on lines
+946
to
+947
| if (OS.VERSION < OS.VERSION (11, 0, 0)) { | ||
| System.out.println ("***WARNING: SWT requires macOS version 11.0 or greater"); //$NON-NLS-1$ |
Member
There was a problem hiding this comment.
I think this should be included into
since this change becomes strictly necessary with that change.
I've updated that PR already and slightly adjusted the error message to the nowadays typing of the os name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR removes code from the macOS/Cocoa-specific SWT classes that was only needed for macOS versions older than 11.0 (Big Sur).
Important
This PR must not be merged before #3185, which bumps the minimum supported macOS version for SWT to 11.0 and is the prerequisite for this cleanup.
Motivation
Once the minimum supported macOS version is raised to 11.0, all conditional code paths guarded by version checks like
OS.VERSION < OS.VERSION(10, x, 0)orOS.isBigSurOrLater()become either dead code (always-false branches) or unconditional code (always-true branches). This PR cleans up all such cases to simplify the codebase.How the Changes Were Found
The cocoa-specific Java source directories were scanned for:
OS.VERSIONcomparisons (e.g.,OS.VERSION < OS.VERSION(10, 13, 0),OS.VERSION >= OS.VERSION(10, 14, 0))OS.isBigSurOrLater()callsFor each occurrence, the logic was evaluated assuming macOS >= 11.0 is always true:
if (OS.VERSION < OS.VERSION(10, x, 0))for any x ≤ 16) — the entire conditional block was removed.if (OS.VERSION >= OS.VERSION(10, x, 0))for any x ≤ 16, orif (OS.isBigSurOrLater())) — the condition was removed and the body was kept unconditionally.Cascading removals were also applied: after simplifying call sites, methods and constants that became unused (e.g.,
OS.isBigSurOrLater(),kAlertNoteIcon,kAlertCautionIcon,SHADOWED_IBEAM_SOURCE) were deleted as well.Changes per File
Control.javaprint(); kept only the modern rendering pathFileDialog.javaoverwritefield is now alwaystrue; removed 10.11 version check aroundsetAccessoryViewDisclosed; simplifiedsetOverwrite()to always settrueSpinner.javafindCursor()override that only existed to work around a nearly-invisible I-Beam cursor on dark backgrounds before macOS 10.14Text.javaCombo.javaCursor.javaSHADOWED_IBEAM_SOURCEpixel data constant and the pre-10.14 I-Beam cursor workaround;SWT.CURSOR_IBEAMnow always usesNSCursor.IBeamCursor()Tree.java>= 10.11guards on header offset code (now always applied); removed>= 10.15guard onscrollRowToVisiblefix; removedisBigSurOrLaterguards onsetStyleand highlight renderingTable.javaTree.javaShell.java>= 10.12guard on automatic window tabbing disable; removedisBigSurOrLaterguard oncancelRootMenuTracking; changedelse if (>= 10.11)to unconditionalelsefor child window z-order workaroundDisplay.java>= 10.14conditionals); removed>= 10.14early returns insetAppAppearance/setWindowsAppearance; removed!isBigSurOrLaterguard on layer backing; simplified icon loading to always use modernNSImageName*APIsOS.javaif (>= 10.14)guards inisAppDarkAppearance()andisSystemDarkAppearance(); removed now-unusedisBigSurOrLater()method; removed unusedkAlertNoteIconandkAlertCautionIconconstantsTextLayout.java>= 10.11guard onsel_attachmentmethod registrationMessageBox.javaisBigSurOrLaterconditionals; always uses modernNSImageNameInfo/NSImageNameCautionList.javaisBigSurOrLaterguard onNSTableViewStylePlainstyle settingTabItem.javaselectedControlTextColor(was a ternary onisBigSurOrLater)TreeItem.javaTEXT_GAPfor text width calculation (was guarded byisBigSurOrLater)Notes
OS.VERSIONfield andOS.VERSION(major, minor, bugfix)helper remain, as they may still be useful for future version-specific code.🤖 Generated with Claude Code