Index: /applications/editors/josm/plugins/validator/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- /applications/editors/josm/plugins/validator/.settings/org.eclipse.jdt.ui.prefs	(revision 19334)
+++ /applications/editors/josm/plugins/validator/.settings/org.eclipse.jdt.ui.prefs	(revision 19335)
@@ -1,4 +1,56 @@
-#Sun Sep 07 16:57:55 CEST 2008
+#Fri Jan 08 08:06:27 CET 2010
 eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
 formatter_profile=_JOSM
 formatter_settings_version=11
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
Index: /applications/editors/josm/plugins/validator/build.xml
===================================================================
--- /applications/editors/josm/plugins/validator/build.xml	(revision 19334)
+++ /applications/editors/josm/plugins/validator/build.xml	(revision 19335)
@@ -27,5 +27,5 @@
 	-->
 	<property name="commit.message" value="Update to JOSM 2748" />
-	<property name="plugin.main.version" value="2748" />
+	<property name="plugin.main.version" value="2788" />
 
 
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java	(revision 19334)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java	(revision 19335)
@@ -138,5 +138,5 @@
      * Visitor that highlights all cells the selected primitives go through
      */
-    class HighlightCellVisitor extends AbstractVisitor
+    static class HighlightCellVisitor extends AbstractVisitor
     {
         /** The MapView */
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java	(revision 19334)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java	(revision 19335)
@@ -39,4 +39,5 @@
 import org.openstreetmap.josm.plugins.validator.tests.DuplicateWay;
 import org.openstreetmap.josm.plugins.validator.tests.DuplicatedWayNodes;
+import org.openstreetmap.josm.plugins.validator.tests.MultipolygonTest;
 import org.openstreetmap.josm.plugins.validator.tests.NameMismatch;
 import org.openstreetmap.josm.plugins.validator.tests.NodesWithSameName;
@@ -80,5 +81,5 @@
     /**
      * All available tests
-     * TODO: is there any way to find out automagically all available tests?
+     * TODO: is there any way to find out automatically all available tests?
      */
     @SuppressWarnings("unchecked")
@@ -99,4 +100,5 @@
             DuplicateWay.class, // ID 1401 .. 1499
             NameMismatch.class, // ID  1501 ..  1599
+            MultipolygonTest.class, // ID  1601 ..  1699
     };
 
@@ -134,4 +136,5 @@
                 }
             } catch (final FileNotFoundException e) {
+                // Ignore
             } catch (final IOException e) {
                 e.printStackTrace();
@@ -157,5 +160,5 @@
 
     private ValidateUploadHook uploadHook;
-    
+
     @Override
     public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
@@ -166,5 +169,5 @@
             if (Main.pref.hasKey(PreferenceEditor.PREF_DEBUG + ".grid"))
                 Main.main.addLayer(new GridLayer(tr("Grid")));
-            MapView.addLayerChangeListener(this);            
+            MapView.addLayerChangeListener(this);
         } else
         	MapView.removeLayerChangeListener(this);
@@ -273,5 +276,5 @@
             } catch (InvocationTargetException ite) {
                 ite.getCause().printStackTrace();
-                JOptionPane.showMessageDialog(Main.parent, 
+                JOptionPane.showMessageDialog(Main.parent,
                 		tr("Error initializing test {0}:\n {1}", test.getClass()
                         .getSimpleName(), ite.getCause().getMessage()),
@@ -280,5 +283,5 @@
             } catch (Exception e) {
                 e.printStackTrace();
-                JOptionPane.showMessageDialog(Main.parent, 
+                JOptionPane.showMessageDialog(Main.parent,
                 		tr("Error initializing test {0}:\n {1}", test.getClass()
                         .getSimpleName(), e),
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Test.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Test.java	(revision 19334)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Test.java	(revision 19335)
@@ -3,4 +3,5 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.awt.GridBagConstraints;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -32,8 +33,8 @@
 {
     /** Name of the test */
-    protected String name;
+    protected final String name;
 
     /** Description of the test */
-    protected String description;
+    protected final String description;
 
     /** Whether this test is enabled. Enabled by default */
@@ -77,5 +78,5 @@
     public Test(String name)
     {
-        this.name = name;
+        this(name, null);
     }
 
@@ -162,5 +163,5 @@
 
         GBC a = GBC.eol();
-        a.anchor = GBC.EAST;
+        a.anchor = GridBagConstraints.EAST;
         checkBeforeUpload = new JCheckBox();
         checkBeforeUpload.setSelected(testBeforeUpload);
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java	(revision 19334)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java	(revision 19335)
@@ -438,5 +438,5 @@
         if (!Main.pref.getBoolean(PreferenceEditor.PREF_FILTER_BY_SELECTION, false))
             return;
-        if (newSelection == null || newSelection.size() == 0)
+        if (newSelection.isEmpty())
             tree.setFilter(null);
         HashSet<OsmPrimitive> filter = new HashSet<OsmPrimitive>(newSelection);
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/CrossingWays.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/CrossingWays.java	(revision 19334)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/CrossingWays.java	(revision 19335)
@@ -166,5 +166,5 @@
      * @author frsantos
      */
-    private class ExtendedSegment
+    private static class ExtendedSegment
     {
         public Node n1, n2;
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateWay.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateWay.java	(revision 19334)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateWay.java	(revision 19335)
@@ -28,5 +28,5 @@
 {
 
-    private class WayPair {
+    private static class WayPair {
         public List<LatLon> coor;
         public Map<String, String> keys;
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/MultipolygonTest.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/MultipolygonTest.java	(revision 19335)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/MultipolygonTest.java	(revision 19335)
@@ -0,0 +1,75 @@
+package org.openstreetmap.josm.plugins.validator.tests;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon;
+import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon.PolyData;
+import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon.PolyData.Intersection;
+import org.openstreetmap.josm.plugins.validator.Severity;
+import org.openstreetmap.josm.plugins.validator.Test;
+import org.openstreetmap.josm.plugins.validator.TestError;
+
+public class MultipolygonTest extends Test {
+
+    protected static final int WRONG_MEMBER_TYPE = 1601;
+    protected static final int WRONG_MEMBER_ROLE = 1602;
+    protected static final int NON_CLOSED_WAY = 1603;
+    protected static final int MISSING_OUTER_WAY = 1604;
+    protected static final int INNER_WAY_OUTSIDE = 1605;
+    protected static final int CROSSING_WAYS = 1606;
+
+    public MultipolygonTest() {
+        super(tr("Multipolygon"),
+                tr("This test checks if multipolygons are valid"));
+    }
+
+    @Override
+    public void visit(Relation r) {
+        if ("multipolygon".equals(r.get("type"))) {
+            checkMembersAndRoles(r);
+
+            Multipolygon polygon = new Multipolygon(Main.map.mapView);
+            polygon.load(r);
+
+            if (polygon.hasNonClosedWays()) {
+                errors.add( new TestError(this, Severity.WARNING, tr("Multipolygon is not closed"), NON_CLOSED_WAY,  r));
+            }
+
+            if (polygon.getOuterWays().isEmpty()) {
+                errors.add( new TestError(this, Severity.WARNING, tr("No outer way for multipolygon"), MISSING_OUTER_WAY,  r));
+            }
+
+            for (RelationMember rm: r.getMembers()) {
+                if (!rm.getMember().isUsable()) {
+                    return; // Rest of checks is only for complete multipolygons
+                }
+            }
+
+            for (PolyData pdInner: polygon.getInnerPolygons()) {
+                PolyData pdOuter = polygon.findOuterPolygon(pdInner, polygon.getOuterPolygons());
+                if (pdOuter == null) {
+                    errors.add(new TestError(this, Severity.WARNING, tr("Multipolygon inner way is outside."), INNER_WAY_OUTSIDE,  r));
+                } else if (pdOuter.contains(pdInner.poly) == Intersection.CROSSING) {
+                    errors.add(new TestError(this, Severity.WARNING, tr("Intersection between multipolygon ways"), CROSSING_WAYS, r));
+                }
+            }
+        }
+    }
+
+    private void checkMembersAndRoles(Relation r) {
+        for (RelationMember rm: r.getMembers()) {
+            if (rm.isWay()) {
+                if (!("inner".equals(rm.getRole()) || "outer".equals(rm.getRole()) || !rm.hasRole())) {
+                    errors.add( new TestError(this, Severity.WARNING, tr("No useful role for multipolygon member"), WRONG_MEMBER_ROLE, rm.getMember()));
+                }
+            } else {
+                errors.add( new TestError(this, Severity.WARNING, tr("Non-Way in multipolygon."), WRONG_MEMBER_TYPE, rm.getMember()));
+            }
+        }
+    }
+
+
+}
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java	(revision 19334)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java	(revision 19335)
@@ -886,5 +886,5 @@
         protected static int TAG_CHECK_INFO   = 1270;
 
-        private class CheckerElement {
+        private static class CheckerElement {
             public Object tag;
             public Object value;
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java	(revision 19334)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java	(revision 19335)
@@ -226,6 +226,8 @@
 //            return !w.containsNode(n)
 //            && line.ptSegDist(n.getEastNorth().east(), n.getEastNorth().north()) < dist;
-            if (w == null)
+            if (w == null) {
                 Main.debug("way null");
+                return false;
+            }
             if (w.containsNode(n))
                 return false;
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Entities.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Entities.java	(revision 19334)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Entities.java	(revision 19335)
@@ -341,5 +341,5 @@
         if (firstAmp < 0)
             return str;
-        String res = new String(str.substring(0, firstAmp));
+        String res = str.substring(0, firstAmp);
         int len = str.length();
         for (int i = firstAmp; i < len; i++) {
