> Issue only exists in the Headless platform. Consider this test code:
> 
> 
> KeyCombination combination = KeyCombination.valueOf("shortcut+,");
> 
> KeyEvent event = new KeyEvent(KeyEvent.KEY_PRESSED, "s", "S", KeyCode.S, 
> false, true, false, false);
> boolean match = combination.match(event);
> 
> 
> What happens is that the KeyCombination is an instance of 
> `KeyCharacterCombination`.
> 
> `KeyCharacterCombination` is special, because in its `match` function, it 
> will call: 
> `Toolkit.getToolkit().getKeyCodeForChar(getCharacter(), code));`
> which will be delegated to the `HeadlessApplication`, which will throw an 
> `UnsupportedOperationException`.
> 
> Most of the time, the `KeyCombination` is not an instance of 
> `KeyCharacterCombination`, so this exception can only be reproduced with more 
> special combinations like in the example with the comma.
> 
> I used the implementation we also use in `Monocle`. Rechecked with the US 
> keyboard layout.
> 
> ---
> 
> Trivia: JabRef found this issue when changing their tests from Monocle to 
> Headless: [GHA 
> run](https://github.com/JabRef/jabref/actions/runs/34032443925/job/101484543433?pr=16850)
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Marius Hanl has updated the pull request incrementally with one additional 
commit since the last revision:

  XOR either macOS or any other OS should match

-------------

Changes:
  - all: https://git.openjdk.org/jfx/pull/2297/files
  - new: https://git.openjdk.org/jfx/pull/2297/files/eb7f0064..91e26724

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=2297&range=01
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=2297&range=00-01

  Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jfx/pull/2297.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2297/head:pull/2297

PR: https://git.openjdk.org/jfx/pull/2297

Reply via email to