Changeset 18600 in josm


Ignore:
Timestamp:
2022-11-21T17:10:39+01:00 (2 years ago)
Author:
taylor.smock
Message:

Fix #22515: Shortcuts for search string icons on toolbar made with Search tool are not working

This happens due to the hashCode implementation in Enum (final int hashCode), as
it uses the default Object#hashCode implementation. This is stable inside the same
JVM instance, but will usually not be the same after a JVM restart.

Since the hashCode is used to find the preference value, it must be stable across
JVM restarts. To fix this problem, we just use the code char from the mode.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/search/SearchSetting.java

    r18208 r18600  
    8787    @Override
    8888    public int hashCode() {
    89         return Objects.hash(text, mode, caseSensitive, regexSearch, mapCSSSearch, allElements);
     89        return Objects.hash(text, mode != null ? mode.getCode() : null, caseSensitive, regexSearch, mapCSSSearch, allElements);
    9090    }
    9191
Note: See TracChangeset for help on using the changeset viewer.