Skip to content

[Cocoa] Replace deprecated macOS Alert Style and Event Modifier Flag constants#3453

Merged
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:replace-deprecated-alert-style-event-modifier-constants
Jul 21, 2026
Merged

[Cocoa] Replace deprecated macOS Alert Style and Event Modifier Flag constants#3453
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:replace-deprecated-alert-style-event-modifier-constants

Conversation

@HeikoKlare

Copy link
Copy Markdown
Contributor

The macOS AppKit framework deprecated the old-style NSAlert alert style constants in macOS 10.12 (Sierra) in favour of the NSAlertStyle enum, and the old-style NSEvent modifier flag constants in macOS 10.12 in favour of the NSEventModifierFlags option set type. This change replaces all seven deprecated constants throughout the SWT macOS/Cocoa implementation with their modern equivalents, eliminating compiler deprecation warnings and improving forward compatibility with future macOS SDK versions.

Replaced constants (values are unchanged):

Deprecated constant Replacement
NSWarningAlertStyle NSAlertStyleWarning (0)
NSInformationalAlertStyle NSAlertStyleInformational (1)
NSCriticalAlertStyle NSAlertStyleCritical (2)
NSShiftKeyMask NSEventModifierFlagShift (131072)
NSControlKeyMask NSEventModifierFlagControl (262144)
NSCommandKeyMask NSEventModifierFlagCommand (1048576)
NSHelpKeyMask NSEventModifierFlagHelp (4194304)

The new entries in AppKitFull.bridgesupport were taken from a bridgesupport file generated against the macOS 26 SDK with a minimum deployment target of macOS 11, and the corresponding update to OS.java was generated using the MacGenerator tool.

Contributes to #3214

The macOS AppKit framework deprecated the old-style NSAlert alert style
constants in macOS 10.12 (Sierra) in favour of the NSAlertStyle enum,
and the old-style NSEvent modifier flag constants in macOS 10.12 in
favour of the NSEventModifierFlags option set type. This change
replaces all seven deprecated constants throughout the SWT macOS/Cocoa
implementation with their modern equivalents, eliminating compiler
deprecation warnings and improving forward compatibility with future
macOS SDK versions.

Replaced constants (values are unchanged):
  NSWarningAlertStyle       -> NSAlertStyleWarning         (0)
  NSInformationalAlertStyle -> NSAlertStyleInformational   (1)
  NSCriticalAlertStyle      -> NSAlertStyleCritical        (2)
  NSShiftKeyMask            -> NSEventModifierFlagShift    (131072)
  NSControlKeyMask          -> NSEventModifierFlagControl  (262144)
  NSCommandKeyMask          -> NSEventModifierFlagCommand  (1048576)
  NSHelpKeyMask             -> NSEventModifierFlagHelp     (4194304)

Contributes to
eclipse-platform#3214
@github-actions

Copy link
Copy Markdown
Contributor

Test Results (macos)

   64 files  ±0     64 suites  ±0   5m 54s ⏱️ - 2m 38s
4 584 tests ±0  4 335 ✅ ±0  249 💤 ±0  0 ❌ ±0 
2 226 runs  ±0  2 160 ✅ ±0   66 💤 ±0  0 ❌ ±0 

Results for commit 6bef4a3. ± Comparison against base commit c76abe1.

@HeikoKlare
HeikoKlare marked this pull request as ready for review July 20, 2026 19:01
@HeikoKlare HeikoKlare changed the title Replace deprecated macOS Alert Style and Event Modifier Flag constants [Cocoa] Replace deprecated macOS Alert Style and Event Modifier Flag constants Jul 20, 2026
@HeikoKlare
HeikoKlare merged commit 2047c61 into eclipse-platform:master Jul 21, 2026
19 checks passed
@HeikoKlare
HeikoKlare deleted the replace-deprecated-alert-style-event-modifier-constants branch July 21, 2026 12:17
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.

1 participant