Index: applications/editors/josm/plugins/utilsplugin2/build.xml
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/build.xml	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/build.xml	(revision 32725)
@@ -5,5 +5,5 @@
     <property name="commit.message" value="[josm_utilsplugin2]: select boundary by double-click; multitagger table highlights"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="10580"/>
+    <property name="plugin.main.version" value="10658"/>
 
     <property name="plugin.author" value="Kalle Lampila, Upliner, Zverik, akks, joshdoe and others"/>
Index: applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/Bag.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/Bag.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/Bag.java	(revision 32725)
@@ -14,9 +14,9 @@
 
 /**
- *  The <tt>Bag</tt> class represents a bag (or multiset) of 
- *  generic items. It supports insertion and iterating over the 
+ *  The <tt>Bag</tt> class represents a bag (or multiset) of
+ *  generic items. It supports insertion and iterating over the
  *  items in arbitrary order.
  *  <p>
- *  The <em>add</em>, <em>isEmpty</em>, and <em>size</em>  operation 
+ *  The <em>add</em>, <em>isEmpty</em>, and <em>size</em>  operation
  *  take constant time. Iteration takes time proportional to the number of items.
  *  <p>
@@ -34,5 +34,5 @@
     }
 
-   /**
+    /**
      * Create an empty stack.
      */
@@ -43,5 +43,5 @@
     }
 
-   /**
+    /**
      * Is the BAG empty?
      */
@@ -50,5 +50,5 @@
     }
 
-   /**
+    /**
      * Return the number of items in the bag.
      */
@@ -57,5 +57,5 @@
     }
 
-   /**
+    /**
      * Add the item to the bag.
      */
@@ -90,12 +90,12 @@
 
         return true;
-    } 
+    }
 
-
-   /**
+    /**
      * Return an iterator that iterates over the items in the bag.
      */
+    @Override
     public Iterator<Item> iterator()  {
-        return new ListIterator();  
+        return new ListIterator();
     }
 
@@ -104,14 +104,16 @@
         private Node current = first;
 
+        @Override
         public boolean hasNext()  { return current != null;                     }
+        @Override
         public void remove()      { throw new UnsupportedOperationException();  }
 
+        @Override
         public Item next() {
             if (!hasNext()) throw new NoSuchElementException();
             Item item = current.item;
-            current = current.next; 
+            current = current.next;
             return item;
         }
     }
-
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/DirectedEdge.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/DirectedEdge.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/DirectedEdge.java	(revision 32725)
@@ -17,10 +17,10 @@
  */
 
-public class DirectedEdge { 
+public class DirectedEdge {
     private final int v;
     private final int w;
     private final double weight;
 
-   /**
+    /**
      * Create a directed edge from v to w with given weight.
      */
@@ -31,5 +31,5 @@
     }
 
-   /**
+    /**
      * Return the vertex where this edge begins.
      */
@@ -38,5 +38,5 @@
     }
 
-   /**
+    /**
      * Return the vertex where this edge ends.
      */
@@ -45,22 +45,15 @@
     }
 
-   /**
+    /**
      * Return the weight of this edge.
      */
     public double weight() { return weight; }
 
-   /**
+    /**
      * Return a string representation of this edge.
      */
+    @Override
     public String toString() {
         return v + "->" + w + " " + String.format("%5.2f", weight);
     }
-
-   /**
-     * Test client.
-     */
-//    public static void main(String[] args) {
-//        DirectedEdge e = new DirectedEdge(12, 23, 3.14);
-//        StdOut.println(e);
-//    }
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/EdgeWeightedDigraph.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/EdgeWeightedDigraph.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/EdgeWeightedDigraph.java	(revision 32725)
@@ -25,5 +25,5 @@
     private int E;
     private Bag<DirectedEdge>[] adj;
-    
+
     /**
      * Create an empty edge-weighted digraph with V vertices.
@@ -34,10 +34,10 @@
         this.V = V;
         this.E = 0;
-        adj = (Bag<DirectedEdge>[]) new Bag[V];
+        adj = new Bag[V];
         for (int v = 0; v < V; v++)
             adj[v] = new Bag<>();
     }
 
-   /**
+    /**
      * Create a edge-weighted digraph with V vertices and E edges.
      */
@@ -57,16 +57,16 @@
      * Create an edge-weighted digraph from input stream.
      */
-//    public EdgeWeightedDigraph(In in) {
-//        this(in.readInt());
-//        int E = in.readInt();
-//        for (int i = 0; i < E; i++) {
-//            int v = in.readInt();
-//            int w = in.readInt();
-//            double weight = in.readDouble();
-//            addEdge(new DirectedEdge(v, w, weight));
-//        }
-//    }
+    //    public EdgeWeightedDigraph(In in) {
+    //        this(in.readInt());
+    //        int E = in.readInt();
+    //        for (int i = 0; i < E; i++) {
+    //            int v = in.readInt();
+    //            int w = in.readInt();
+    //            double weight = in.readDouble();
+    //            addEdge(new DirectedEdge(v, w, weight));
+    //        }
+    //    }
 
-   /**
+    /**
      * Copy constructor.
      */
@@ -86,5 +86,5 @@
     }
 
-   /**
+    /**
      * Return the number of vertices in this digraph.
      */
@@ -93,5 +93,5 @@
     }
 
-   /**
+    /**
      * Return the number of edges in this digraph.
      */
@@ -100,5 +100,5 @@
     }
 
-   /**
+    /**
      * Add the edge e to this digraph.
      */
@@ -109,5 +109,5 @@
     }
 
-   /**
+    /**
      * Return the edges leaving vertex v as an Iterable.
      * To iterate over the edges leaving vertex v, use foreach notation:
@@ -118,5 +118,5 @@
     }
 
-   /**
+    /**
      * Return all edges in this graph as an Iterable.
      * To iterate over the edges, use foreach notation:
@@ -131,7 +131,7 @@
         }
         return list;
-    } 
+    }
 
-   /**
+    /**
      * Return number of edges leaving v.
      */
@@ -140,7 +140,8 @@
     }
 
-   /**
+    /**
      * Return a string representation of this graph.
      */
+    @Override
     public String toString() {
         String NEWLINE = System.getProperty("line.separator");
Index: applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/IndexMinPQ.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/IndexMinPQ.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/IndexMinPQ.java	(revision 32725)
@@ -51,25 +51,25 @@
 
     // return the index associated with a minimal key
-    public int minIndex() { 
+    public int minIndex() {
         if (N == 0) throw new NoSuchElementException("Priority queue underflow");
-        return pq[1];        
+        return pq[1];
     }
 
     // return a minimal key
-    public Key minKey() { 
+    public Key minKey() {
         if (N == 0) throw new NoSuchElementException("Priority queue underflow");
-        return keys[pq[1]];        
+        return keys[pq[1]];
     }
 
     // delete a minimal key and returns its associated index
-    public int delMin() { 
+    public int delMin() {
         if (N == 0) throw new NoSuchElementException("Priority queue underflow");
-        int min = pq[1];        
-        exch(1, N--); 
+        int min = pq[1];
+        exch(1, N--);
         sink(1);
         qp[min] = -1;            // delete
         keys[pq[N+1]] = null;    // to help with garbage collection
         pq[N+1] = -1;            // not needed
-        return min; 
+        return min;
     }
 
@@ -121,7 +121,7 @@
 
 
-   /**************************************************************
-    * General helper functions
-    **************************************************************/
+    /**************************************************************
+     * General helper functions
+     **************************************************************/
     private boolean greater(int i, int j) {
         return keys[pq[i]].compareTo(keys[pq[j]]) > 0;
@@ -134,7 +134,7 @@
 
 
-   /**************************************************************
-    * Heap helper functions
-    **************************************************************/
+    /**************************************************************
+     * Heap helper functions
+     **************************************************************/
     private void swim(int k)  {
         while (k > 1 && greater(k/2, k)) {
@@ -155,9 +155,9 @@
 
 
-   /***********************************************************************
-    * Iterators
-    **********************************************************************/
+    /***********************************************************************
+     * Iterators
+     **********************************************************************/
 
-   /**
+    /**
      * Return an iterator that iterates over all of the elements on the
      * priority queue in ascending order.
@@ -165,4 +165,5 @@
      * The iterator doesn't implement <tt>remove()</tt> since it's optional.
      */
+    @Override
     public Iterator<Integer> iterator() { return new HeapIterator(); }
 
@@ -179,7 +180,10 @@
         }
 
+        @Override
         public boolean hasNext()  { return !copy.isEmpty();                     }
+        @Override
         public void remove()      { throw new UnsupportedOperationException();  }
 
+        @Override
         public Integer next() {
             if (!hasNext()) throw new NoSuchElementException();
Index: applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/Stack.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/Stack.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/Stack.java	(revision 32725)
@@ -8,6 +8,6 @@
  *  A generic stack, implemented using a linked list. Each stack
  *  element is of type Item.
- *  
- *  % more tobe.txt 
+ *
+ *  % more tobe.txt
  *  to be or not to - be - - that - - - is
  *
@@ -42,5 +42,5 @@
     }
 
-   /**
+    /**
      * Create an empty stack.
      */
@@ -51,5 +51,5 @@
     }
 
-   /**
+    /**
      * Is the stack empty?
      */
@@ -58,5 +58,5 @@
     }
 
-   /**
+    /**
      * Return the number of items in the stack.
      */
@@ -65,5 +65,5 @@
     }
 
-   /**
+    /**
      * Add the item to the stack.
      */
@@ -77,5 +77,5 @@
     }
 
-   /**
+    /**
      * Delete and return the item most recently added to the stack.
      * Throw an exception if no such item exists because the stack is empty.
@@ -91,5 +91,5 @@
 
 
-   /**
+    /**
      * Return the item most recently added to the stack.
      * Throw an exception if no such item exists because the stack is empty.
@@ -100,7 +100,8 @@
     }
 
-   /**
+    /**
      * Return string representation.
      */
+    @Override
     public String toString() {
         StringBuilder s = new StringBuilder();
@@ -109,5 +110,5 @@
         return s.toString();
     }
-       
+
 
     // check internal invariants
@@ -132,10 +133,11 @@
 
         return true;
-    } 
+    }
 
 
-   /**
+    /**
      * Return an iterator to the stack that iterates through the items in LIFO order.
      */
+    @Override
     public Iterator<Item> iterator()  { return new ListIterator();  }
 
@@ -143,11 +145,14 @@
     private class ListIterator implements Iterator<Item> {
         private Node current = first;
+        @Override
         public boolean hasNext()  { return current != null;                     }
+        @Override
         public void remove()      { throw new UnsupportedOperationException();  }
 
+        @Override
         public Item next() {
             if (!hasNext()) throw new NoSuchElementException();
             Item item = current.item;
-            current = current.next; 
+            current = current.next;
             return item;
         }
@@ -155,16 +160,16 @@
 
 
-   /**
+    /**
      * A test client.
      */
-//    public static void main(String[] args) {
-//        Stack<String> s = new Stack<String>();
-//        while (!StdIn.isEmpty()) {
-//            String item = StdIn.readString();
-//            if (!item.equals("-")) s.push(item);
-//            else if (!s.isEmpty()) StdOut.print(s.pop() + " ");
-//        }
-//        StdOut.println("(" + s.size() + " left on stack)");
-//    }
+    //    public static void main(String[] args) {
+    //        Stack<String> s = new Stack<String>();
+    //        while (!StdIn.isEmpty()) {
+    //            String item = StdIn.readString();
+    //            if (!item.equals("-")) s.push(item);
+    //            else if (!s.isEmpty()) StdOut.print(s.pop() + " ");
+    //        }
+    //        StdOut.println("(" + s.size() + " left on stack)");
+    //    }
 }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java	(revision 32725)
@@ -18,4 +18,5 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Tag;
+import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -62,5 +63,6 @@
             }
         }
-        if (!values.isEmpty()) Utils.copyToClipboard(Utils.join("\n", values));
+        if (!values.isEmpty())
+            ClipboardUtils.copyString(Utils.join("\n", values));
     }
 
@@ -83,5 +85,5 @@
                     tr("Information"),
                     JOptionPane.INFORMATION_MESSAGE
-            );
+                    );
             return true;
         }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java	(revision 32725)
@@ -4,8 +4,11 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.awt.datatransfer.UnsupportedFlavorException;
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -21,4 +24,6 @@
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
+import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
 import org.openstreetmap.josm.tools.Shortcut;
 
@@ -44,5 +49,11 @@
 
         Map<Relation, String> relations = new HashMap<>();
-        for (PrimitiveData pdata : Main.pasteBuffer.getDirectlyAdded()) {
+        Collection<PrimitiveData> data = Collections.emptySet();
+        try {
+            data = ((PrimitiveTransferData) ClipboardUtils.getClipboard().getData(PrimitiveTransferData.DATA_FLAVOR)).getDirectlyAdded();
+        } catch (UnsupportedFlavorException | IOException ex) {
+            Main.warn(ex);
+        }
+        for (PrimitiveData pdata : data) {
             OsmPrimitive p = getLayerManager().getEditDataSet().getPrimitiveById(pdata.getUniqueId(), pdata.getType());
             if (p != null) {
@@ -98,5 +109,6 @@
     @Override
     protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
-        setEnabled(selection != null && !selection.isEmpty() && !Main.pasteBuffer.isEmpty());
+        setEnabled(selection != null && !selection.isEmpty()
+                && ClipboardUtils.getClipboard().isDataFlavorAvailable(PrimitiveTransferData.DATA_FLAVOR));
     }
 }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java	(revision 32725)
@@ -13,4 +13,5 @@
 import java.util.Map;
 import java.util.Set;
+import java.util.function.Predicate;
 
 import org.openstreetmap.josm.Main;
@@ -20,7 +21,6 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.tools.Predicate;
 import org.openstreetmap.josm.tools.Shortcut;
-import org.openstreetmap.josm.tools.Utils;
+import org.openstreetmap.josm.tools.SubclassFilteredCollection;
 
 /**
@@ -31,10 +31,5 @@
 public class TagBufferAction extends JosmAction {
     private static final String TITLE = tr("Copy tags from previous selection");
-    private static final Predicate<OsmPrimitive> IS_TAGGED_PREDICATE = new Predicate<OsmPrimitive>() {
-        @Override
-        public boolean evaluate(OsmPrimitive object) {
-            return object.isTagged();
-        }
-    };
+    private static final Predicate<OsmPrimitive> IS_TAGGED_PREDICATE = object -> object.isTagged();
     private Map<String, String> tags = new HashMap<>();
     private Map<String, String> currentTags = new HashMap<>();
@@ -117,5 +112,5 @@
     private void rememberSelectionTags() {
         // Fix #8350 - only care about tagged objects
-        final Collection<OsmPrimitive> selectedTaggedObjects = Utils.filter(
+        final Collection<OsmPrimitive> selectedTaggedObjects = SubclassFilteredCollection.filter(
                 getLayerManager().getEditDataSet().getSelected(), IS_TAGGED_PREDICATE);
         if (!selectedTaggedObjects.isEmpty()) {
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/command/ChangeRelationMemberCommand.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/command/ChangeRelationMemberCommand.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/command/ChangeRelationMemberCommand.java	(revision 32725)
@@ -6,4 +6,5 @@
 import java.util.Collection;
 import java.util.LinkedList;
+import java.util.Objects;
 
 import org.openstreetmap.josm.command.Command;
@@ -36,5 +37,5 @@
         LinkedList<RelationMember> newrms = new LinkedList<>();
         for (RelationMember rm : relation.getMembers()) {
-            if (rm.getMember() == oldP) {
+            if (Objects.equals(rm.getMember(), oldP)) {
                 newrms.add(new RelationMember(rm.getRole(), newP));
             } else {
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java	(revision 32725)
@@ -11,4 +11,5 @@
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
@@ -178,10 +179,10 @@
                     // We look for the first anchor node. The next should be directly to the left or right.
                     // Exception when the way is closed
-                    if (n == anchorNodes[a]) {
+                    if (Objects.equals(n, anchorNodes[a])) {
                         bi = i;
                         Node otherAnchor = anchorNodes[a + 1];
-                        if (i > 0 && tw.getNode(i - 1) == otherAnchor) {
+                        if (i > 0 && Objects.equals(tw.getNode(i - 1), otherAnchor)) {
                             ei = i - 1;
-                        } else if (i < (tw.getNodesCount() - 1) && tw.getNode(i + 1) == otherAnchor) {
+                        } else if (i < (tw.getNodesCount() - 1) && Objects.equals(tw.getNode(i + 1), otherAnchor)) {
                             ei = i + 1;
                         } else {
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java	(revision 32725)
@@ -4,7 +4,8 @@
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
@@ -70,19 +71,12 @@
     public static List<String> loadURLList() {
         ArrayList<String> items = new ArrayList<>();
-        BufferedReader fr = null;
-        try {
-            File f = new File(UtilsPlugin2.getInstance().getPluginDir(), "customurl.txt");
-            fr = new BufferedReader(new FileReader(f));
+        File f = new File(UtilsPlugin2.getInstance().getPluginDir(), "customurl.txt");
+        try (BufferedReader fr = Files.newBufferedReader(f.toPath(), StandardCharsets.UTF_8)) {
             String s;
-            while ((s = fr.readLine()) != null) items.add(s);
+            while ((s = fr.readLine()) != null) {
+                items.add(s);
+            }
         } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (fr != null)
-                    fr.close();
-            } catch (Exception e) {
-                Main.warn(e);
-            }
+            Main.error(e);
         }
         return items;
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java	(revision 32725)
@@ -68,13 +68,11 @@
         }
 
-        if (type == "nodes") {
+        if ("nodes".equals(type)) {
             //we dont need to do anything, we already have all the nodes
-        }
-        if (type == "way") {
+        } else if ("way".equals(type)) {
             Way wnew = new Way();
             wnew.setNodes(nodes);
             cmds.add(new AddCommand(wnew));
-        }
-        if (type == "area") {
+        } else if ("area".equals(type)) {
             nodes.add(nodes.get(0)); // this is needed to close the way.
             Way wnew = new Way();
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java	(revision 32725)
@@ -22,5 +22,5 @@
     @Override
     protected Long getNumber(OsmPrimitive osm) {
-        return new Long(osm.getReferrers().size());
+        return Long.valueOf(osm.getReferrers().size());
     }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInRelationsMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInRelationsMatch.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInRelationsMatch.java	(revision 32725)
@@ -25,5 +25,5 @@
     }
 
-    private class RelationCounter implements Visitor {
+    private static class RelationCounter implements Visitor {
         int count;
         @Override
@@ -54,5 +54,5 @@
         counter.count = 0;
         osm.visitReferrers(counter);
-        return new Long(counter.count);
+        return Long.valueOf(counter.count);
     }
 
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInWaysMatch.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInWaysMatch.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInWaysMatch.java	(revision 32725)
@@ -25,5 +25,5 @@
     }
 
-    private class WayCounter implements Visitor {
+    private static class WayCounter implements Visitor {
         int count;
         @Override
@@ -54,5 +54,5 @@
             counter.count = 0;
             osm.visitReferrers(counter);
-            return new Long(counter.count);
+            return Long.valueOf(counter.count);
         } else return null;
     }
Index: applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java
===================================================================
--- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java	(revision 32699)
+++ applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java	(revision 32725)
@@ -9,4 +9,5 @@
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
@@ -107,5 +108,5 @@
         int count = 0;
         for (Way anyway: ways) {
-            if (anyway == w) continue;
+            if (Objects.equals(anyway, w)) continue;
             if (newWays.contains(anyway) || excludeWays.contains(anyway)) continue;
 
@@ -130,5 +131,5 @@
         int count = 0;
         for (Way anyway: ways) {
-            if (anyway == w) continue;
+            if (Objects.equals(anyway, w)) continue;
             if (newWays.contains(anyway)) continue;
             List<Pair<Node, Node>> nodePairs2 = anyway.getNodePairs(false);
@@ -291,5 +292,5 @@
 
             for (OsmPrimitive ref : curNode.getReferrers()) {
-                if (ref instanceof Way && ref != w && ref.isSelectable()) {
+                if (ref instanceof Way && !Objects.equals(ref, w) && ref.isSelectable()) {
                     //
                     Way w2 = (Way) ref;
@@ -298,9 +299,9 @@
                     if (w2.getNodesCount() < 2 || w2.isClosed()) continue;
 
-                    if (curNode == w2.firstNode()) {
+                    if (Objects.equals(curNode, w2.firstNode())) {
                         nextNode = w2.getNode(1);
                         preLast = w2.getNode(w2.getNodesCount()-2);
                         endNode = w2.lastNode(); // forward direction
-                    } else if (curNode == w2.lastNode()) {
+                    } else if (Objects.equals(curNode, w2.lastNode())) {
                         nextNode = w2.getNode(w2.getNodesCount()-2);
                         preLast = w2.getNode(1);
@@ -321,7 +322,7 @@
                 }
             }
-            if (firstWay == nextWay) {
+            if (Objects.equals(firstWay, nextWay)) {
                 //we came to starting way, but not not the right end
-                if (otherEnd == firstWay.firstNode()) return false;
+                if (Objects.equals(otherEnd, firstWay.firstNode())) return false;
                 newWays.addAll(newestWays);
                 return true; // correct loop found
