Ignore:
Timestamp:
2024-06-20T15:55:07+02:00 (9 months ago)
Author:
taylor.smock
Message:

See #17858: Update code for newer Java features

Also add a note that toUnmodifiableList does not like nulls.

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHook.java

    r19105 r19120  
    248248    /**
    249249     * Returns extended modifier key used as the appropriate accelerator key for menu shortcuts.
    250      * It is advised everywhere to use {@link Toolkit#getMenuShortcutKeyMask()} to get the cross-platform modifier, but:
     250     * It was advised everywhere to use {@link Toolkit#getMenuShortcutKeyMask()} to get the cross-platform modifier, but:
    251251     * <ul>
    252252     * <li>it returns KeyEvent.CTRL_MASK instead of KeyEvent.CTRL_DOWN_MASK. We used the extended
     
    258258     */
    259259    default int getMenuShortcutKeyMaskEx() {
    260         // To remove when switching to Java 10+, and use Toolkit.getMenuShortcutKeyMaskEx instead
     260        if (!GraphicsEnvironment.isHeadless()) {
     261            return Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx();
     262        }
    261263        return InputEvent.CTRL_DOWN_MASK;
    262264    }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r19103 r19120  
    104104        return !("true".equals(getSystemProperty("apple.laf.useScreenMenuBar"))
    105105                && ("Aqua".equals(laf) || laf.contains("Mac")));
    106     }
    107 
    108     @Override
    109     public int getMenuShortcutKeyMaskEx() {
    110         return InputEvent.META_DOWN_MASK;
    111106    }
    112107
  • trunk/src/org/openstreetmap/josm/tools/StreamUtils.java

    r17333 r19120  
    6868     */
    6969    public static <T> Collector<T, ?, List<T>> toUnmodifiableList() {
    70         // Java 10: use java.util.stream.Collectors.toUnmodifiableList
     70        // Java 10: use java.util.stream.Collectors.toUnmodifiableList (note: does not like null checks OR null entries)
    7171        return Collectors.collectingAndThen(Collectors.toList(), Utils::toUnmodifiableList);
    7272    }
Note: See TracChangeset for help on using the changeset viewer.