Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java	(revision 35856)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java	(revision 35970)
@@ -1,4 +1,6 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.plugins.utilsplugin2.search;
+
+import java.util.Objects;
 
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -7,17 +9,18 @@
 
 /**
+ * Matches objects with properties in a certain range.
  * TODO: remove this copied class and make it public in JOSM core
  */
-public abstract class RangeMatch extends SearchCompiler.Match {
+abstract class RangeMatch extends SearchCompiler.Match {
 
     private final long min;
     private final long max;
 
-    public RangeMatch(long min, long max) {
+    RangeMatch(long min, long max) {
         this.min = Math.min(min, max);
         this.max = Math.max(min, max);
     }
 
-    public RangeMatch(PushbackTokenizer.Range range) {
+    RangeMatch(PushbackTokenizer.Range range) {
         this(range.getStart(), range.getEnd());
     }
@@ -38,14 +41,10 @@
     @Override
     public String toString() {
-        return getString() + "=" + min + "-" + max;
+        return getString() + '=' + min + '-' + max;
     }
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + (int) (max ^ (max >>> 32));
-        result = prime * result + (int) (min ^ (min >>> 32));
-        return result;
+        return Objects.hash(max, min);
     }
 
@@ -57,9 +56,6 @@
             return false;
         RangeMatch other = (RangeMatch) obj;
-        if (max != other.max)
-            return false;
-        if (min != other.min)
-            return false;
-        return true;
+        return max == other.max
+                && min == other.min;
     }
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java	(revision 35856)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java	(revision 35970)
@@ -2,6 +2,9 @@
 package org.openstreetmap.josm.plugins.utilsplugin2.search;
 
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 
 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
@@ -16,5 +19,6 @@
 public class UtilsSimpleMatchFactory implements SimpleMatchFactory {
 
-    private static Collection<String> keywords = Arrays.asList("usedinways", "usedinrelations", "parents", "children");
+    private static final Collection<String> keywords =
+            Collections.unmodifiableCollection(Arrays.asList("usedinways", "usedinrelations", "parents", "children"));
 
     @Override
@@ -26,17 +30,19 @@
     public SearchCompiler.Match get(String keyword, boolean caseSensitive, boolean regexSearch, PushbackTokenizer tokenizer)
             throws SearchParseError {
-        if ("usedinways".equals(keyword)) {
+        if (tokenizer == null) {
+            throw new SearchParseError("<html>" + tr("Expecting {0} after {1}", "<code>:</code>", "<i>" + keyword + "</i>") + "</html>");
+        }
+        switch (keyword) {
+        case "usedinways":
             return new UsedInWaysMatch(tokenizer);
-        } else
-            if ("usedinrelations".equals(keyword)) {
-                return new UsedInRelationsMatch(tokenizer);
-            } else
-                if ("parents".equals(keyword)) {
-                    return new ParentsMatch(tokenizer);
-                } else
-                    if ("children".equals(keyword)) {
-                        return new ChildrenMatch(tokenizer);
-                    } else
-                        return null;
+        case "usedinrelations":
+            return new UsedInRelationsMatch(tokenizer);
+        case "parents":
+            return new ParentsMatch(tokenizer);
+        case "children":
+            return new ChildrenMatch(tokenizer);
+        default:
+            throw new IllegalStateException("Not expecting keyword " + keyword);
+        }
     }
 }
