Index: trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java	(revision 18918)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java	(revision 18922)
@@ -20,4 +20,7 @@
 import java.util.stream.Stream;
 
+import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.DeleteCommand;
@@ -31,8 +34,12 @@
 import org.openstreetmap.josm.data.osm.TagMap;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.preferences.BooleanProperty;
 import org.openstreetmap.josm.data.preferences.DoubleProperty;
+import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper;
 import org.openstreetmap.josm.data.validation.Severity;
 import org.openstreetmap.josm.data.validation.Test;
 import org.openstreetmap.josm.data.validation.TestError;
+import org.openstreetmap.josm.gui.progress.ProgressMonitor;
+import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.Geometry;
 import org.openstreetmap.josm.tools.Logging;
@@ -71,5 +78,15 @@
     protected static final String ADDR_POSTCODE      = "addr:postcode";
     protected static final String ASSOCIATED_STREET  = "associatedStreet";
+    protected static final String NAME_TAG           = "name";
+    private static final String HOUSE                = "house";
+    private static final String STREET               = "street";
     // CHECKSTYLE.ON: SingleSpaceSeparator
+
+    private static final BooleanProperty PREF_INCLUDE_BLDG_POI =
+            new BooleanProperty(ValidatorPrefHelper.PREFIX + "." + OpeningHourTest.class.getSimpleName() + "." + "includebuildingpois", false);
+    private final JCheckBox checkboxIncludeBldgPOI = new JCheckBox(
+            /* I18n: Label text for checkbox choosing to validate addresses for all types of objects, not just plain addresses */
+            tr("Include POIs like amenities, offices, and buildings in duplicate address detection"));
+    private boolean includeBldgAndPOI;
 
     private Map<String, Collection<OsmPrimitive>> knownAddresses;
@@ -80,4 +97,5 @@
      */
     public Addresses() {
+        /* I18n: Label text for checkbox choosing to validate addresses */
         super(tr("Addresses"), tr("Checks for errors in addresses and associatedStreet relations."));
     }
@@ -142,5 +160,5 @@
      */
     private void collectAddress(OsmPrimitive p) {
-        if (!isPOI(p)) {
+        if (includeBldgAndPOI || !isPOI(p)) {
             for (String simplifiedAddress : getSimplifiedAddresses(p)) {
                 if (!ignoredAddresses.contains(simplifiedAddress)) {
@@ -155,5 +173,5 @@
         ignoredAddresses = new HashSet<>();
         for (OsmPrimitive p : primitive.getDataSet().allNonDeletedPrimitives()) {
-            if (p instanceof Node && p.hasKey(ADDR_UNIT, ADDR_FLATS)) {
+            if ((includeBldgAndPOI || p instanceof Node) && p.hasKey(ADDR_UNIT, ADDR_FLATS)) {
                 for (OsmPrimitive r : p.getReferrers()) {
                     if (hasAddress(r)) {
@@ -177,4 +195,10 @@
 
     @Override
+    public void startTest(ProgressMonitor progressMonitor) {
+        super.startTest(progressMonitor);
+        this.includeBldgAndPOI = PREF_INCLUDE_BLDG_POI.get();
+    }
+
+    @Override
     public void endTest() {
         knownAddresses = null;
@@ -187,5 +211,5 @@
             initAddressMap(p);
         }
-        if (!isPOI(p) && hasAddress(p)) {
+        if ((includeBldgAndPOI || !isPOI(p)) && hasAddress(p)) {
             List<TestError> result = new ArrayList<>();
             for (String simplifiedAddress : getSimplifiedAddresses(p)) {
@@ -199,4 +223,6 @@
                         String city1 = p.get(ADDR_CITY);
                         String city2 = p2.get(ADDR_CITY);
+                        String name1 = p.get(NAME_TAG);
+                        String name2 = p2.get(NAME_TAG);
                         double distance = getDistance(p, p2);
                         if (city1 != null && city2 != null) {
@@ -236,4 +262,8 @@
                             }
                         }
+                        if (severityLevel == Severity.WARNING && !Objects.equals(name1, name2)) {
+                            // since multiple objects can exist at one address, a different name tag isn't very concerning
+                            severityLevel = Severity.OTHER;
+                        }
                         result.add(TestError.builder(this, severityLevel, DUPLICATE_HOUSE_NUMBER)
                                 .message(tr("Duplicate house numbers"), marktr("''{0}'' ({1}m)"), simplifiedAddress, (int) distance)
@@ -302,5 +332,5 @@
                 String role = m.getRole();
                 OsmPrimitive p = m.getMember();
-                if ("house".equals(role)) {
+                if (HOUSE.equals(role)) {
                     houses.add(p);
                     String number = p.get(ADDR_HOUSE_NUMBER);
@@ -316,5 +346,5 @@
                         wrongStreetNames.add(p);
                     }
-                } else if ("street".equals(role)) {
+                } else if (STREET.equals(role)) {
                     if (p instanceof Way) {
                         street.add((Way) p);
@@ -457,10 +487,10 @@
             if ("".equals(role)) {
                 if (m.isWay() && m.getMember().hasKey("highway")) {
-                    role = "street";
+                    role = STREET;
                 } else if (m.getMember().hasTag("building"))
-                    role = "house";
+                    role = HOUSE;
             }
             switch (role) {
-            case "house":
+            case HOUSE:
             case "addr:houselink":
             case "address":
@@ -472,5 +502,5 @@
                 }
                 break;
-            case "street":
+            case STREET:
                 if (!m.getMember().hasTag("name") && r.hasTag("name"))
                     return;
@@ -523,3 +553,18 @@
     }
 
+    @Override
+    public void addGui(JPanel testPanel) {
+        super.addGui(testPanel);
+        checkboxIncludeBldgPOI.setSelected(PREF_INCLUDE_BLDG_POI.get());
+        testPanel.add(checkboxIncludeBldgPOI, GBC.eol().insets(20, 0, 0, 0));
+    }
+
+    @Override
+    public boolean ok() {
+        super.ok();
+        PREF_INCLUDE_BLDG_POI.put(checkboxIncludeBldgPOI.isSelected());
+        includeBldgAndPOI = PREF_INCLUDE_BLDG_POI.get();
+        return false;
+    }
+
 }
