Changeset 11519 in josm


Ignore:
Timestamp:
2017-01-31T23:27:09+01:00 (22 months ago)
Author:
Don-vip
Message:

sonar - fb-contrib:PDP_POORLY_DEFINED_PARAMETER - Correctness - Method defines parameters more abstractly than needed to function properly

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java

    r11366 r11519  
    2020import javax.swing.event.TableModelEvent;
    2121import javax.swing.event.TableModelListener;
    22 import javax.swing.table.TableModel;
    2322
    2423import org.openstreetmap.josm.Main;
     
    318317    }
    319318
    320     private static PrimitiveId primitiveIdAtRow(TableModel model, int row) {
    321         DiffTableModel castedModel = (DiffTableModel) model;
    322         Long id = (Long) castedModel.getValueAt(row, 0).value;
     319    private static PrimitiveId primitiveIdAtRow(DiffTableModel model, int row) {
     320        Long id = (Long) model.getValueAt(row, 0).value;
    323321        return id == null ? null : new SimplePrimitiveId(id, OsmPrimitiveType.NODE);
    324322    }
     
    332330        protected int checkTableSelection(JTable table, Point p) {
    333331            int row = super.checkTableSelection(table, p);
    334             popupMenu.prepare(primitiveIdAtRow(table.getModel(), row));
     332            popupMenu.prepare(primitiveIdAtRow((DiffTableModel) table.getModel(), row));
    335333            return row;
    336334        }
     
    353351            if (row <= 0)
    354352                return;
    355             PrimitiveId pid = primitiveIdAtRow(table.getModel(), row);
     353            PrimitiveId pid = primitiveIdAtRow((DiffTableModel) table.getModel(), row);
    356354            if (pid == null || pid.isNew())
    357355                return;
  • trunk/src/org/openstreetmap/josm/gui/layer/JumpToMarkerActions.java

    r8836 r11519  
    4545    private abstract static class JumpToMarker extends AbstractAction implements MultikeyShortcutAction {
    4646
    47         private final transient Layer layer;
     47        private final transient JumpToMarkerLayer layer;
    4848        private final transient Shortcut multikeyShortcut;
    4949        private transient WeakReference<Layer> lastLayer;
    5050
    5151        JumpToMarker(JumpToMarkerLayer layer, Shortcut shortcut) {
    52             this.layer = (Layer) layer;
     52            this.layer = layer;
    5353            this.multikeyShortcut = shortcut;
    5454            this.multikeyShortcut.setAccelerator(this);
     
    7474            if (l != null) {
    7575                if (l instanceof JumpToMarkerLayer) {
    76                     execute(l);
     76                    execute((JumpToMarkerLayer) l);
    7777                }
    7878            } else if (repeat && lastLayer != null) {
    7979                l = lastLayer.get();
    80                 if (LayerListDialog.isLayerValid(l)) {
    81                     execute(l);
     80                if (LayerListDialog.isLayerValid(l) && l instanceof JumpToMarkerLayer) {
     81                    execute((JumpToMarkerLayer) l);
    8282                }
    8383            }
    8484        }
    8585
    86         protected abstract void execute(Layer l);
     86        protected abstract void execute(JumpToMarkerLayer l);
    8787
    8888        @Override
     
    110110
    111111        @Override
    112         protected void execute(Layer l) {
    113             ((JumpToMarkerLayer) l).jumpToNextMarker();
    114             setLastLayer(l);
     112        protected void execute(JumpToMarkerLayer l) {
     113            l.jumpToNextMarker();
     114            setLastLayer((Layer) l);
    115115        }
    116116    }
     
    126126
    127127        @Override
    128         protected void execute(Layer l) {
    129             ((JumpToMarkerLayer) l).jumpToPreviousMarker();
    130             setLastLayer(l);
     128        protected void execute(JumpToMarkerLayer l) {
     129            l.jumpToPreviousMarker();
     130            setLastLayer((Layer) l);
    131131        }
    132132    }
Note: See TracChangeset for help on using the changeset viewer.