Skip to content

Enforce composable target diagnostics for menu applier boundaries#2777

Merged
Ivan Matkov (MatkovIvan) merged 4 commits into
jb-mainfrom
ivan.matkov/menu-applier-marker
Feb 18, 2026
Merged

Enforce composable target diagnostics for menu applier boundaries#2777
Ivan Matkov (MatkovIvan) merged 4 commits into
jb-mainfrom
ivan.matkov/menu-applier-marker

Conversation

@MatkovIvan

@MatkovIvan Ivan Matkov (MatkovIvan) commented Feb 17, 2026

Copy link
Copy Markdown
Collaborator

CMP-7106 Use separate ComposableTargetMarker for desktop menu API
Invalid API mixing such as putting UI composables into menu DSL (or vice versa) can fail at runtime due to applier mismatch. This change improves compile-time detection and reduces runtime-only failures.

  • Added desktop-specific marker annotations: MenuComposable
  • Marked menu APIs with MenuComposable where menu applier is expected
  • Kept applier-creating entrypoints open where appropriate with @ComposableOpenTarget(-1).
  • Refactored menu bar composition internals: replaced list adapter usage with direct JMenuBar applier (SwingApplier-based path)

Testing

Window(onCloseRequest = ::exitApplication) {
    MenuBar {
        Text("Label 1")
    }
}
Tray(icon) {
    Text("Label 2")
}

Now produces

Calling a UI Composable composable function where a Menu Composable composable was expected

Release Notes

Features - Desktop

  • New compile-time warnings for invalid ui/menu composable mixing that previously failed only at runtime.

@MatkovIvan Ivan Matkov (MatkovIvan) merged commit d9414c7 into jb-main Feb 18, 2026
30 of 31 checks passed
@MatkovIvan Ivan Matkov (MatkovIvan) deleted the ivan.matkov/menu-applier-marker branch February 18, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants