Changeset 14212 in josm


Ignore:
Timestamp:
2018-08-31T23:45:00+02:00 (6 years ago)
Author:
Don-vip
Message:

sonarqube - various minor issues

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java

    r14206 r14212  
    327327    @Override
    328328    public void otherDatasetChange(AbstractDatasetChangedEvent event) {
    329         if (!DatasetEventType.FILTERS_CHANGED.equals(event.getType())) {
     329        if (DatasetEventType.FILTERS_CHANGED != event.getType()) {
    330330            filterModel.executeFilters();
    331331        }
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r14209 r14212  
    759759
    760760        @Override
    761         public void layerRemoving(LayerRemoveEvent e) {}
    762 
    763         @Override
    764         public void layerOrderChanged(LayerOrderChangeEvent e) {}
     761        public void layerRemoving(LayerRemoveEvent e) {
     762            // Not used
     763        }
     764
     765        @Override
     766        public void layerOrderChanged(LayerOrderChangeEvent e) {
     767            // Not used
     768        }
    765769    }
    766770
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java

    r14205 r14212  
    55import java.io.File;
    66import java.util.Collections;
     7import java.util.Objects;
    78
    89import org.openstreetmap.josm.data.gpx.GpxImageEntry;
     
    6364        }
    6465    }
     66
     67    @Override
     68    public int hashCode() {
     69        return 31 * super.hashCode() + ((thumbnail == null) ? 0 : thumbnail.hashCode());
     70    }
     71
     72    @Override
     73    public boolean equals(Object obj) {
     74        if (this == obj)
     75            return true;
     76        if (!super.equals(obj) || getClass() != obj.getClass())
     77            return false;
     78        ImageEntry other = (ImageEntry) obj;
     79        return Objects.equals(thumbnail, other.thumbnail);
     80    }
    6581}
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImageEntryTest.java

    r9669 r14212  
    88import org.junit.Test;
    99import org.openstreetmap.josm.TestUtils;
     10import org.openstreetmap.josm.data.gpx.GpxImageEntry;
     11
     12import nl.jqno.equalsverifier.EqualsVerifier;
     13import nl.jqno.equalsverifier.Warning;
    1014
    1115/**
     
    2327        assertNotNull(e.getExifTime());
    2428    }
     29
     30    /**
     31     * Unit test of methods {@link ImageEntry#equals} and {@link ImageEntry#hashCode}.
     32     */
     33    @Test
     34    public void testEqualsContract() {
     35        TestUtils.assumeWorkingEqualsVerifier();
     36        EqualsVerifier.forClass(ImageEntry.class).usingGetClass()
     37            .suppress(Warning.NONFINAL_FIELDS)
     38            .withPrefabValues(GpxImageEntry.class, new GpxImageEntry(new File("foo")), new GpxImageEntry(new File("bar")))
     39            .verify();
     40    }
    2541}
Note: See TracChangeset for help on using the changeset viewer.