Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java	(revision 36102)
@@ -11,4 +11,5 @@
 import java.awt.geom.GeneralPath;
 import java.util.HashSet;
+import java.util.Objects;
 import java.util.Set;
 
@@ -41,8 +42,8 @@
 public class ChosenRelation implements ActiveLayerChangeListener, MapViewPaintable, DataSetListener {
     protected Relation chosenRelation = null;
-    private Set<ChosenRelationListener> chosenRelationListeners = new HashSet<>();
+    private final Set<ChosenRelationListener> chosenRelationListeners = new HashSet<>();
 
     public void set(Relation rel) {
-        if (rel == chosenRelation || (rel != null && chosenRelation != null && rel.equals(chosenRelation)))
+        if (Objects.equals(rel, chosenRelation))
             return; // new is the same as old
         Relation oldRel = chosenRelation;
@@ -73,5 +74,5 @@
             return false;
         else
-            return chosenRelation != null && r.equals(chosenRelation);
+            return r.equals(chosenRelation);
     }
 
@@ -150,5 +151,5 @@
         g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f * opacity));
 
-        drawRelations(g, mv, bbox, chosenRelation, new HashSet<Relation>());
+        drawRelations(g, mv, bbox, chosenRelation, new HashSet<>());
 
         g.setComposite(oldComposite);
@@ -178,5 +179,6 @@
                             }
                             g.draw(b);
-                        }   break;
+                        }
+                        break;
                     case RELATION:
                         Color oldColor = g.getColor();
@@ -195,5 +197,5 @@
     @Override
     public void relationMembersChanged(RelationMembersChangedEvent event) {
-        if (chosenRelation != null && event.getRelation().equals(chosenRelation)) {
+        if (event.getRelation().equals(chosenRelation)) {
             fireRelationChanged(chosenRelation);
         }
@@ -202,5 +204,5 @@
     @Override
     public void tagsChanged(TagsChangedEvent event) {
-        if (chosenRelation != null && event.getPrimitive().equals(chosenRelation)) {
+        if (event.getPrimitive().equals(chosenRelation)) {
             fireRelationChanged(chosenRelation);
         }
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelationComponent.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelationComponent.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelationComponent.java	(revision 36102)
@@ -61,5 +61,5 @@
 
         StringBuilder sb = new StringBuilder();
-        sb.append(type.substring(0, 1));
+        sb.append(type.charAt(0));
         if (type.equals("boundary") && rel.hasKey("admin_level")) {
             sb.append(rel.get("admin_level"));
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java	(revision 36102)
@@ -14,5 +14,4 @@
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseAdapter;
@@ -112,10 +111,10 @@
 
     private final DefaultTableModel relationsData;
-    private ChosenRelation chosenRelation;
-    private JPanel chosenRelationPanel;
-    private ChosenRelationPopupMenu popupMenu;
-    private MultipolygonSettingsPopup multiPopupMenu;
-    private RoleComboBoxModel roleBoxModel;
-    private SortAndFixAction sortAndFixAction;
+    private final ChosenRelation chosenRelation;
+    private final JPanel chosenRelationPanel;
+    private final ChosenRelationPopupMenu popupMenu;
+    private final MultipolygonSettingsPopup multiPopupMenu;
+    private final RoleComboBoxModel roleBoxModel;
+    private final SortAndFixAction sortAndFixAction;
     // actions saved for unregistering on dialog destroying
     private final EnterRoleAction enterRoleAction;
@@ -149,13 +148,10 @@
         roleBox.setModel(roleBoxModel);
         roleBox.addMouseListener(relationMouseAdapter);
-        roleBox.addItemListener(new ItemListener() {
-            @Override
-            public void itemStateChanged(ItemEvent e) {
-                if (e.getStateChange() == ItemEvent.DESELECTED) return;
-                String memberRole = roleBoxModel.getSelectedMembersRole();
-                String selectedRole = roleBoxModel.isAnotherRoleSelected() ? askForRoleName() : roleBoxModel.getSelectedRole();
-                if (memberRole != null && selectedRole != null && !memberRole.equals(selectedRole)) {
-                    applyRoleToSelection(selectedRole.trim());
-                }
+        roleBox.addItemListener(e -> {
+            if (e.getStateChange() == ItemEvent.DESELECTED) return;
+            String memberRole = roleBoxModel.getSelectedMembersRole();
+            String selectedRole = roleBoxModel.isAnotherRoleSelected() ? askForRoleName() : roleBoxModel.getSelectedRole();
+            if (memberRole != null && selectedRole != null && !memberRole.equals(selectedRole)) {
+                applyRoleToSelection(selectedRole.trim());
             }
         });
@@ -652,5 +648,5 @@
         private List<String> roles = new ArrayList<>();
         private int selectedIndex = -1;
-        private JComboBox<String> combobox;
+        private final JComboBox<String> combobox;
         private String membersRole;
         private final String EMPTY_ROLE = tr("<empty>");
@@ -709,5 +705,5 @@
 
         public String getSelectedMembersRole() {
-            return membersRole == EMPTY_ROLE ? "" : membersRole;
+            return EMPTY_ROLE.equals(membersRole) ? "" : membersRole;
         }
 
@@ -756,5 +752,5 @@
         @Override
         public void setSelectedItem(Object anItem) {
-            int newIndex = anItem == null ? -1 : roles.indexOf(anItem);
+            int newIndex = anItem instanceof String ? roles.indexOf((String) anItem) : -1;
             if (newIndex != selectedIndex) {
                 selectedIndex = newIndex;
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextPlugin.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextPlugin.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextPlugin.java	(revision 36102)
@@ -7,6 +7,8 @@
 import org.openstreetmap.josm.plugins.PluginInformation;
 
+/**
+ * The entry-point for the reltoolbox plugin
+ */
 public class RelContextPlugin extends Plugin {
-    private RelContextDialog dialog;
 
     public RelContextPlugin(PluginInformation info) {
@@ -19,5 +21,5 @@
         if (oldFrame == null && newFrame != null) {
             //            if (dialog!=null) dialog.destroy();
-            dialog = new RelContextDialog();
+            RelContextDialog dialog = new RelContextDialog();
             newFrame.addToggleDialog(dialog);
         }
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/AddRemoveMemberAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/AddRemoveMemberAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/AddRemoveMemberAction.java	(revision 36102)
@@ -35,6 +35,6 @@
  */
 public class AddRemoveMemberAction extends JosmAction implements ChosenRelationListener {
-    private ChosenRelation rel;
-    private SortAndFixAction sortAndFix;
+    private final ChosenRelation rel;
+    private final SortAndFixAction sortAndFix;
 
     public AddRemoveMemberAction(ChosenRelation rel, SortAndFixAction sortAndFix) {
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ClearChosenRelationAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ClearChosenRelationAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ClearChosenRelationAction.java	(revision 36102)
@@ -16,5 +16,5 @@
 
 public class ClearChosenRelationAction extends AbstractAction implements ChosenRelationListener {
-    private ChosenRelation rel;
+    private final ChosenRelation rel;
 
     public ClearChosenRelationAction(ChosenRelation rel) {
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java	(revision 36102)
@@ -71,16 +71,14 @@
 
     public static boolean getDefaultPropertyValue(String property) {
-        if (property.equals("boundary"))
-            return false;
-        else if (property.equals("boundaryways"))
-            return true;
-        else if (property.equals("tags"))
-            return true;
-        else if (property.equals("alltags"))
-            return false;
-        else if (property.equals("single"))
-            return true;
-        else if (property.equals("allowsplit"))
-            return false;
+        switch (property) {
+            case "boundary":
+            case "alltags":
+            case "allowsplit":
+                return false;
+            case "boundaryways":
+            case "tags":
+            case "single":
+                return true;
+        }
         throw new IllegalArgumentException(property);
     }
@@ -274,9 +272,8 @@
     }
 
-    public static final List<String> DEFAULT_LINEAR_TAGS = Arrays.asList(new String[] {"barrier", "source"});
-
-    private static final Set<String> REMOVE_FROM_BOUNDARY_TAGS = new TreeSet<>(Arrays.asList(new String[] {
-            "boundary", "boundary_type", "type", "admin_level"
-    }));
+    public static final List<String> DEFAULT_LINEAR_TAGS = Arrays.asList("barrier", "source");
+
+    private static final Set<String> REMOVE_FROM_BOUNDARY_TAGS =
+            new TreeSet<>(Arrays.asList("boundary", "boundary_type", "type", "admin_level"));
 
     /**
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java	(revision 36102)
@@ -7,5 +7,4 @@
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 import java.util.Arrays;
@@ -93,9 +92,7 @@
 
     // Thanks to TagInfo for the list
-    private static final List<String> RELATION_TYPES = Arrays.asList(new String[] {
-            "multipolygon", "boundary", "route", "site", "restriction", "associatedStreet", "public_transport",
-            "street", "collection", "address", "enforcement", "destination_sign", "route_master", "junction",
-            "waterway", "bridge", "tunnel", "surveillance"
-    });
+    private static final List<String> RELATION_TYPES = Arrays.asList("multipolygon", "boundary", "route", "site",
+            "restriction", "associatedStreet", "public_transport", "street", "collection", "address", "enforcement",
+            "destination_sign", "route_master", "junction", "waterway", "bridge", "tunnel", "surveillance");
 
     private String askForType() {
@@ -122,10 +119,7 @@
         dlg.setModalityType(ModalityType.DOCUMENT_MODAL);
 
-        keys.getEditor().addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                dlg.setVisible(false);
-                optionPane.setValue(JOptionPane.OK_OPTION);
-            }
+        keys.getEditor().addActionListener(e -> {
+            dlg.setVisible(false);
+            optionPane.setValue(JOptionPane.OK_OPTION);
         });
 
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DeleteChosenRelationAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DeleteChosenRelationAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DeleteChosenRelationAction.java	(revision 36102)
@@ -19,5 +19,5 @@
 
 public class DeleteChosenRelationAction extends AbstractAction implements ChosenRelationListener {
-    private ChosenRelation rel;
+    private final ChosenRelation rel;
 
     public DeleteChosenRelationAction(ChosenRelation rel) {
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadChosenRelationAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadChosenRelationAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadChosenRelationAction.java	(revision 36102)
@@ -28,5 +28,5 @@
  */
 public class DownloadChosenRelationAction extends AbstractAction implements ChosenRelationListener {
-    private ChosenRelation rel;
+    private final ChosenRelation rel;
 
     public DownloadChosenRelationAction(ChosenRelation rel) {
@@ -74,6 +74,5 @@
     protected void downloadIncomplete(Relation rel) {
         if (rel.isNew()) return;
-        Set<OsmPrimitive> ret = new HashSet<>();
-        ret.addAll(rel.getIncompleteMembers());
+        Set<OsmPrimitive> ret = new HashSet<>(rel.getIncompleteMembers());
         if (ret.isEmpty()) return;
         MainApplication.worker.submit(
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadParentsAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadParentsAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DownloadParentsAction.java	(revision 36102)
@@ -30,5 +30,5 @@
  */
 public class DownloadParentsAction extends AbstractAction implements ChosenRelationListener {
-    private ChosenRelation rel;
+    private final ChosenRelation rel;
 
     public DownloadParentsAction(ChosenRelation rel) {
@@ -66,6 +66,5 @@
     protected void downloadIncomplete(Relation rel) {
         if (rel.isNew()) return;
-        Set<OsmPrimitive> ret = new HashSet<>();
-        ret.addAll(rel.getIncompleteMembers());
+        Set<OsmPrimitive> ret = new HashSet<>(rel.getIncompleteMembers());
         if (ret.isEmpty()) return;
         MainApplication.worker.submit(
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/EditChosenRelationAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/EditChosenRelationAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/EditChosenRelationAction.java	(revision 36102)
@@ -22,5 +22,5 @@
  */
 public class EditChosenRelationAction extends AbstractAction implements ChosenRelationListener {
-    private ChosenRelation rel;
+    private final ChosenRelation rel;
 
     public EditChosenRelationAction(ChosenRelation rel) {
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/FindRelationAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/FindRelationAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/FindRelationAction.java	(revision 36102)
@@ -8,5 +8,4 @@
 import java.awt.Dimension;
 import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
@@ -15,5 +14,4 @@
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
@@ -87,11 +85,8 @@
         });
 
-        searchField.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                if (!relationsList.isSelectionEmpty()) {
-                    dlg.setVisible(false);
-                    optionPane.setValue(JOptionPane.OK_OPTION);
-                }
+        searchField.addActionListener(e1 -> {
+            if (!relationsList.isSelectionEmpty()) {
+                dlg.setVisible(false);
+                optionPane.setValue(JOptionPane.OK_OPTION);
             }
         });
@@ -100,10 +95,5 @@
             @Override
             public void keyTyped(KeyEvent e) {
-                SwingUtilities.invokeLater(new Runnable() {
-                    @Override
-                    public void run() {
-                        updateRelationData(relationsData, searchField.getText());
-                    }
-                });
+                SwingUtilities.invokeLater(() -> updateRelationData(relationsData, searchField.getText()));
             }
 
@@ -196,5 +186,5 @@
         }
 
-        Collections.sort(relations, DefaultNameFormatter.getInstance().getRelationComparator());
+        relations.sort(DefaultNameFormatter.getInstance().getRelationComparator());
         data.setRelations(relations);
     }
@@ -214,5 +204,5 @@
     protected static class FindRelationListModel extends AbstractListModel<Relation> {
         private final ArrayList<Relation> relations = new ArrayList<>();
-        private DefaultListSelectionModel selectionModel;
+        private final DefaultListSelectionModel selectionModel;
 
         public FindRelationListModel(DefaultListSelectionModel selectionModel) {
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/PublicTransportHelper.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/PublicTransportHelper.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/PublicTransportHelper.java	(revision 36102)
@@ -8,5 +8,5 @@
 /**
  * @author freeExec
- * @see https://wiki.openstreetmap.org/wiki/Key:public_transport
+ * @see <a href="https://wiki.openstreetmap.org/wiki/Key:public_transport">osmwiki:Key:public_transport</a>
  */
 public final class PublicTransportHelper {
@@ -49,8 +49,8 @@
             if (p.hasKey(PUBLIC_TRANSPORT)) {
                 String pt = p.get(PUBLIC_TRANSPORT);
-                if (STOP_POSITION.equals(pt)) return true;
+                return STOP_POSITION.equals(pt);
             } else if (p.hasKey(RAILWAY)) {
                 String rw = p.get(RAILWAY);
-                if (RAILWAY_HALT.equals(rw) || RAILWAY_STATION.equals(rw)) return true;
+                return RAILWAY_HALT.equals(rw) || RAILWAY_STATION.equals(rw);
             }
         }
@@ -66,12 +66,12 @@
             if (p.hasKey(PUBLIC_TRANSPORT)) {
                 String pt = p.get(PUBLIC_TRANSPORT);
-                if (PLATFORM.equals(pt)) return true;
+                return PLATFORM.equals(pt);
             } else if (p.hasKey(HIGHWAY)) {
                 String hw = p.get(HIGHWAY);
                 if (BUS_STOP.equals(hw)) return true;
-                else if (PLATFORM.equals(hw)) return true;
+                else return PLATFORM.equals(hw);
             } else if (p.hasKey(RAILWAY)) {
                 String rw = p.get(RAILWAY);
-                if (PLATFORM.equals(rw)) return true;
+                return PLATFORM.equals(rw);
             }
         }
@@ -87,11 +87,11 @@
             if (p.hasKey(PUBLIC_TRANSPORT)) {
                 String pt = p.get(PUBLIC_TRANSPORT);
-                if (PLATFORM.equals(pt)) return true;
+                return PLATFORM.equals(pt);
             } else if (p.hasKey(HIGHWAY)) {
                 String hw = p.get(HIGHWAY);
-                if (PLATFORM.equals(hw)) return true;
+                return PLATFORM.equals(hw);
             } else if (p.hasKey(RAILWAY)) {
                 String rw = p.get(RAILWAY);
-                if (PLATFORM.equals(rw)) return true;
+                return PLATFORM.equals(rw);
             }
         }
@@ -124,5 +124,5 @@
             }
         }
-        return result;
+        return null;
     }
 }
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java	(revision 36102)
@@ -10,5 +10,4 @@
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -44,8 +43,7 @@
  */
 public class ReconstructPolygonAction extends JosmAction implements ChosenRelationListener {
-    private ChosenRelation rel;
-
-    private static final List<String> IRRELEVANT_KEYS = Arrays.asList(new String[] {
-            "source", "created_by", "note"});
+    private final ChosenRelation rel;
+
+    private static final List<String> IRRELEVANT_KEYS = Arrays.asList("source", "created_by", "note");
 
     public ReconstructPolygonAction(ChosenRelation rel) {
@@ -109,5 +107,5 @@
                 // this ring has inner rings, so we leave a multipolygon in
                 // place and don't reconstruct the rings.
-                Relation n = null;
+                Relation n;
                 if (relationReused) {
                     n = new Relation();
@@ -153,9 +151,5 @@
                 }
                 List<OsmPrimitive> referrers = w.getReferrers();
-                for (Iterator<OsmPrimitive> ref1 = relations.iterator(); ref1.hasNext();) {
-                    if (!referrers.contains(ref1.next())) {
-                        ref1.remove();
-                    }
-                }
+                relations.removeIf(osmPrimitive -> !referrers.contains(osmPrimitive));
             }
             tags.putAll(r.getKeys());
@@ -169,5 +163,5 @@
                     Set<String> keys = new HashSet<>(w.keySet());
                     keys.removeAll(tags.keySet());
-                    keys.removeAll(IRRELEVANT_KEYS);
+                    IRRELEVANT_KEYS.forEach(keys::remove);
                     if (keys.isEmpty()) {
                         if (candidateWay == null) {
@@ -211,8 +205,5 @@
 
     private boolean isSuitableRelation(Relation newRelation) {
-        if (newRelation == null || !"multipolygon".equals(newRelation.get("type")) || newRelation.getMembersCount() == 0)
-            return false;
-        else
-            return true;
+        return newRelation != null && "multipolygon".equals(newRelation.get("type")) && newRelation.getMembersCount() != 0;
     }
 }
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructRouteAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructRouteAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructRouteAction.java	(revision 36102)
@@ -9,4 +9,5 @@
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import javax.swing.AbstractAction;
@@ -96,5 +97,5 @@
                 if (routeMembers.size() > 2) {
                     Way nextWay = (Way) routeMembers.get(rIndex + 1).getMember();
-                    if (w.lastNode().equals(nextWay.lastNode()) || w.lastNode().equals(nextWay.firstNode())) {
+                    if (Objects.equals(w.lastNode(), nextWay.lastNode()) || Objects.equals(w.lastNode(), nextWay.firstNode())) {
                         dirForward = true;
                         lastNode = w.lastNode();
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectInRelationPanelAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectInRelationPanelAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectInRelationPanelAction.java	(revision 36102)
@@ -16,5 +16,5 @@
 
 public class SelectInRelationPanelAction extends AbstractAction implements ChosenRelationListener {
-    private ChosenRelation rel;
+    private final ChosenRelation rel;
 
     public SelectInRelationPanelAction(ChosenRelation rel) {
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectMembersAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectMembersAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectMembersAction.java	(revision 36102)
@@ -5,4 +5,5 @@
 
 import java.awt.event.ActionEvent;
+import java.util.Collections;
 
 import javax.swing.AbstractAction;
@@ -16,5 +17,5 @@
 
 public class SelectMembersAction extends AbstractAction implements ChosenRelationListener {
-    private ChosenRelation rel;
+    private final ChosenRelation rel;
 
     public SelectMembersAction(ChosenRelation rel) {
@@ -28,5 +29,6 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        MainApplication.getLayerManager().getEditLayer().data.setSelected(rel.get() == null ? null : rel.get().getMemberPrimitives());
+        MainApplication.getLayerManager().getEditLayer().data.setSelected(
+                rel.get() == null ? Collections.emptyList() : rel.get().getMemberPrimitives());
     }
 
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectRelationAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectRelationAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectRelationAction.java	(revision 36102)
@@ -16,5 +16,5 @@
 
 public class SelectRelationAction extends AbstractAction implements ChosenRelationListener {
-    private ChosenRelation rel;
+    private final ChosenRelation rel;
 
     public SelectRelationAction(ChosenRelation rel) {
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SortAndFixAction.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SortAndFixAction.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SortAndFixAction.java	(revision 36102)
@@ -28,6 +28,6 @@
 public class SortAndFixAction extends AbstractAction implements ChosenRelationListener {
     private static final long serialVersionUID = 1L;
-    private ChosenRelation rel;
-    private List<RelationFixer> fixers;
+    private final ChosenRelation rel;
+    private final List<RelationFixer> fixers;
 
     public SortAndFixAction(ChosenRelation rel) {
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java	(revision 36102)
@@ -12,4 +12,5 @@
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import org.openstreetmap.josm.command.AddCommand;
@@ -19,7 +20,7 @@
 import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.coor.EastNorth;
-import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
+import org.openstreetmap.josm.data.osm.INode;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -206,5 +207,5 @@
                 for (int i = 0; i < rel.getMembersCount(); i++) {
                     if (rel.getMember(i).getMember().equals(w)) {
-                        references.put(rel, Integer.valueOf(i));
+                        references.put(rel, i);
                     }
                 }
@@ -253,12 +254,19 @@
             return null;
 
+        final Node segmentFirstNode = segment.firstNode();
+        final Node segmentLastNode = segment.lastNode();
+
+        if (segmentLastNode == null || segmentFirstNode == null) {
+            return null;
+        }
+
         List<Way> ways = intersection(
-                Utils.filteredCollection(segment.firstNode().getReferrers(), Way.class),
-                Utils.filteredCollection(segment.lastNode().getReferrers(), Way.class));
+                Utils.filteredCollection(segmentFirstNode.getReferrers(), Way.class),
+                Utils.filteredCollection(segmentLastNode.getReferrers(), Way.class));
         ways.remove(segment);
         for (Iterator<Way> iter = ways.iterator(); iter.hasNext();) {
             boolean save = false;
             for (OsmPrimitive ref : iter.next().getReferrers()) {
-                if (ref instanceof Relation && ((Relation) ref).isMultipolygon() && !ref.isDeleted()) {
+                if (ref instanceof Relation && ref.isMultipolygon() && !ref.isDeleted()) {
                     save = true;
                 }
@@ -292,5 +300,5 @@
 
         // now split the way, at last
-        List<Way> newWays = new ArrayList<>(splitWay(target, segment.firstNode(), segment.lastNode(), commands));
+        List<Way> newWays = new ArrayList<>(splitWay(target, segmentFirstNode, segmentLastNode, commands));
 
         Way addingWay = null;
@@ -303,6 +311,8 @@
         } else {
             for (Way w : newWays) {
-                if ((w.firstNode().equals(segment.firstNode()) && w.lastNode().equals(segment.lastNode()))
-                        || (w.firstNode().equals(segment.lastNode()) && w.lastNode().equals(segment.firstNode()))) {
+                final INode wFirstNode = w.firstNode();
+                final INode wLastNode = w.lastNode();
+                if ((Objects.equals(wFirstNode, segmentFirstNode) && Objects.equals(wLastNode, segmentLastNode))
+                        || (Objects.equals(wFirstNode, segmentLastNode) && Objects.equals(wLastNode, segmentFirstNode))) {
                     addingWay = w;
                     break;
@@ -341,5 +351,5 @@
                 if (p instanceof Way && !p.equals(ring)) {
                     for (OsmPrimitive r : p.getReferrers()) {
-                        if (r instanceof Relation && ((Relation) r).hasKey("type") && ((Relation) r).get("type").equals("multipolygon")) {
+                        if (r instanceof Relation && r.hasKey("type") && r.get("type").equals("multipolygon")) {
                             if (touchingWays.containsKey(p)) {
                                 touchingWays.put((Way) p, Boolean.TRUE);
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java	(revision 36102)
@@ -37,6 +37,6 @@
     private static final String PREF_MULTIPOLY = "reltoolbox.multipolygon.";
 
-    private Way source;
-    private List<RingSegment> segments;
+    private final Way source;
+    private final List<RingSegment> segments;
     private Relation relation = null;
 
@@ -277,6 +277,5 @@
 
         // rearrange references
-        for (int i = 0; i < rings.size(); i++) {
-            TheRing ring = rings.get(i);
+        for (TheRing ring : rings) {
             if (ring.countNonReferenceSegments() == 0) {
                 // need to find one non-reference segment
@@ -331,5 +330,6 @@
         Way sourceCopy = new Way(source);
         if (createMultipolygon) {
-            Collection<String> linearTags = Config.getPref().getList(PREF_MULTIPOLY + "lineartags", CreateMultipolygonAction.DEFAULT_LINEAR_TAGS);
+            Collection<String> linearTags = Config.getPref().getList(PREF_MULTIPOLY + "lineartags",
+                    CreateMultipolygonAction.DEFAULT_LINEAR_TAGS);
             relation = new Relation();
             relation.put("type", "multipolygon");
@@ -351,5 +351,5 @@
         for (OsmPrimitive p : source.getReferrers()) {
             if (p instanceof Relation) {
-                Relation rel = null;
+                Relation rel;
                 if (relationChangeMap != null) {
                     if (relationChangeMap.containsKey(p)) {
@@ -365,5 +365,5 @@
                 for (int i = 0; i < rel.getMembersCount(); i++) {
                     if (rel.getMember(i).getMember().equals(source)) {
-                        referencingRelations.put(rel, Integer.valueOf(i));
+                        referencingRelations.put(rel, i);
                     }
                 }
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/AssociatedStreetFixer.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/AssociatedStreetFixer.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/AssociatedStreetFixer.java	(revision 36102)
@@ -155,9 +155,8 @@
          */
         // return results
-        if (commandList.size() == 0)
+        if (commandList.isEmpty()) {
             return null;
-        if (commandList.size() == 1)
-            return commandList.get(0);
-        return new SequenceCommand(tr("fix associatedStreet relation"), commandList);
+        }
+        return SequenceCommand.wrapIfNeeded(tr("fix associatedStreet relation"), commandList);
     }
 }
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/BoundaryFixer.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/BoundaryFixer.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/BoundaryFixer.java	(revision 36102)
@@ -12,7 +12,7 @@
 import org.openstreetmap.josm.gui.MainApplication;
 
-
 /**
- * @see https://wiki.openstreetmap.org/wiki/Relation:boundary
+ * Fix multipolygon boundaries
+ * @see <a href="https://wiki.openstreetmap.org/wiki/Relation:boundary">osmwiki:Relation:boundary</a>
  */
 public class BoundaryFixer extends MultipolygonFixer {
@@ -25,5 +25,5 @@
      * For boundary relations both "boundary" and "multipolygon" types are applicable, but
      * it should also have key boundary=administrative to be fully boundary.
-     * @see https://wiki.openstreetmap.org/wiki/Relation:boundary
+     * @see <a href="https://wiki.openstreetmap.org/wiki/Relation:boundary">osmwiki:Relation:boundary</a>
      */
     @Override
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/MultipolygonFixer.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/MultipolygonFixer.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/MultipolygonFixer.java	(revision 36102)
@@ -20,5 +20,5 @@
 
 /**
- * @see https://wiki.openstreetmap.org/wiki/Relation:multipolygon
+ * @see <a href="https://wiki.openstreetmap.org/wiki/Relation:multipolygon">osmwiki:Relation:multipolygon</a>
  */
 public class MultipolygonFixer extends RelationFixer {
@@ -69,25 +69,22 @@
         Set<Way> outerWays = new HashSet<>();
         for (MultipolygonBuilder.JoinedPolygon poly : mpc.outerWays) {
-            for (Way w : poly.ways) {
-                outerWays.add(w);
-            }
+            outerWays.addAll(poly.ways);
         }
         Set<Way> innerWays = new HashSet<>();
         for (MultipolygonBuilder.JoinedPolygon poly : mpc.innerWays) {
-            for (Way w : poly.ways) {
-                innerWays.add(w);
-            }
+            innerWays.addAll(poly.ways);
         }
         for (int i = 0; i < r.getMembersCount(); i++) {
             RelationMember m = r.getMember(i);
             if (m.isWay()) {
+                final Way way = m.getWay();
                 String role = null;
-                if (outerWays.contains(m.getMember())) {
+                if (outerWays.contains(way)) {
                     role = "outer";
-                } else if (innerWays.contains(m.getMember())) {
+                } else if (innerWays.contains(way)) {
                     role = "inner";
                 }
                 if (role != null && !role.equals(m.getRole())) {
-                    r.setMember(i, new RelationMember(role, m.getMember()));
+                    r.setMember(i, new RelationMember(role, way));
                     fixed = true;
                 }
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/PublicTransportFixer.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/PublicTransportFixer.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/PublicTransportFixer.java	(revision 36102)
@@ -14,10 +14,7 @@
 
 /**
- * @see https://wiki.openstreetmap.org/wiki/Key:public_transport
- */
-
-/**
  * Helper function for determinate role in public_transport relation
  * @author freeExec
+ * @see <a href="https://wiki.openstreetmap.org/wiki/Key:public_transport">osmwiki:Key:public_transport</a>
  */
 public class PublicTransportFixer extends RelationFixer {
Index: /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/RelationFixer.java
===================================================================
--- /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/RelationFixer.java	(revision 36101)
+++ /applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/RelationFixer.java	(revision 36102)
@@ -17,5 +17,5 @@
 public abstract class RelationFixer {
 
-    private List<String> applicableTypes;
+    private final List<String> applicableTypes;
     private SortAndFixAction sortAndFixAction;
 
