Changeset 6986 in josm


Ignore:
Timestamp:
2014-04-16T00:54:15+02:00 (10 years ago)
Author:
Don-vip
Message:

sonar - fix various minor issues

Location:
trunk/src/org/openstreetmap/josm
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r6889 r6986  
    4848
    4949    /**
    50      * Constructor
     50     * Constructs a new {@code OrthogonalizeAction}.
    5151     */
    5252    public OrthogonalizeAction() {
     
    519519     */
    520520    private static class EN {
     521        private EN() {
     522            // Hide implicit public constructor for utility class
     523        }
    521524        // rotate counter-clock-wise
    522525        public static EastNorth rotate_cc(EastNorth pivot, EastNorth en, double angle) {
  • trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java

    r6380 r6986  
    1010import java.util.ArrayList;
    1111import java.util.Collection;
    12 import java.util.Collections;
    1312import java.util.Iterator;
    1413import java.util.List;
     
    1817import org.openstreetmap.josm.Main;
    1918import org.openstreetmap.josm.command.RemoveNodesCommand;
    20 import org.openstreetmap.josm.command.Command;
    2119import org.openstreetmap.josm.data.osm.Node;
    2220import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2422import org.openstreetmap.josm.tools.Shortcut;
    2523
     24/**
     25 * Disconnect nodes from a way they currently belong to.
     26 * @since 6253
     27 */
    2628public class UnJoinNodeWayAction extends JosmAction {
     29   
     30    /**
     31     * Constructs a new {@code UnJoinNodeWayAction}.
     32     */
    2733    public UnJoinNodeWayAction() {
    2834        super(tr("Disconnect Node from Way"), "unjoinnodeway",
  • trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java

    r6326 r6986  
    9393     */
    9494    public static class TagSwitcher {
     95
     96        private TagSwitcher() {
     97            // Hide implicit public constructor for utility class
     98        }
    9599
    96100        /**
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r6643 r6986  
    740740     */
    741741    public static class PreferencesUtils {
     742
     743        private PreferencesUtils() {
     744            // Hide implicit public constructor for utility class
     745        }
    742746
    743747        private static void replacePreferences(Preferences fragment, Preferences mainpref) {
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r6950 r6986  
    576576     *  the corresponding value otherwise. The result is not null.
    577577     */
    578     synchronized public String get(final String key) {
     578    public synchronized String get(final String key) {
    579579        String value = get(key, null);
    580580        return value == null ? "" : value;
     
    589589     *  def otherwise
    590590     */
    591     synchronized public String get(final String key, final String def) {
     591    public synchronized String get(final String key, final String def) {
    592592        return getSetting(key, new StringSetting(def), StringSetting.class).getValue();
    593593    }
    594594
    595     synchronized public Map<String, String> getAllPrefix(final String prefix) {
     595    public synchronized Map<String, String> getAllPrefix(final String prefix) {
    596596        final Map<String,String> all = new TreeMap<String,String>();
    597597        for (final Entry<String,Setting> e : settingsMap.entrySet()) {
     
    603603    }
    604604
    605     synchronized public List<String> getAllPrefixCollectionKeys(final String prefix) {
     605    public synchronized List<String> getAllPrefixCollectionKeys(final String prefix) {
    606606        final List<String> all = new LinkedList<String>();
    607607        for (Map.Entry<String, Setting> entry : settingsMap.entrySet()) {
     
    613613    }
    614614
    615     synchronized public Map<String, String> getAllColors() {
     615    public synchronized Map<String, String> getAllColors() {
    616616        final Map<String,String> all = new TreeMap<String,String>();
    617617        for (final Entry<String,Setting> e : defaultsMap.entrySet()) {
     
    631631    }
    632632
    633     synchronized public boolean getBoolean(final String key) {
     633    public synchronized boolean getBoolean(final String key) {
    634634        String s = get(key, null);
    635635        return s == null ? false : Boolean.parseBoolean(s);
    636636    }
    637637
    638     synchronized public boolean getBoolean(final String key, final boolean def) {
     638    public synchronized boolean getBoolean(final String key, final boolean def) {
    639639        return Boolean.parseBoolean(get(key, Boolean.toString(def)));
    640640    }
    641641
    642     synchronized public boolean getBoolean(final String key, final String specName, final boolean def) {
     642    public synchronized boolean getBoolean(final String key, final String specName, final boolean def) {
    643643        boolean generic = getBoolean(key, def);
    644644        String skey = key+"."+specName;
     
    823823     * @return a Color object for the configured colour, or the default value if none configured.
    824824     */
    825     synchronized public Color getColor(String colName, Color def) {
     825    public synchronized Color getColor(String colName, Color def) {
    826826        return getColor(colName, null, def);
    827827    }
    828828
    829     synchronized public Color getUIColor(String colName) {
     829    public synchronized Color getUIColor(String colName) {
    830830        return UIManager.getColor(colName);
    831831    }
    832832
    833833    /* only for preferences */
    834     synchronized public String getColorName(String o) {
     834    public synchronized String getColorName(String o) {
    835835        try {
    836836            Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o);
     
    869869     * @return a Color object for the configured colour, or the default value if none configured.
    870870     */
    871     synchronized public Color getColor(String colName, String specName, Color def) {
     871    public synchronized Color getColor(String colName, String specName, Color def) {
    872872        String colKey = ColorProperty.getColorKey(colName);
    873873        if(!colKey.equals(colName)) {
     
    885885    }
    886886
    887     synchronized public Color getDefaultColor(String colKey) {
     887    public synchronized Color getDefaultColor(String colKey) {
    888888        StringSetting col = Utils.cast(defaultsMap.get("color."+colKey), StringSetting.class);
    889889        String colStr = col == null ? null : col.getValue();
     
    891891    }
    892892
    893     synchronized public boolean putColor(String colKey, Color val) {
     893    public synchronized boolean putColor(String colKey, Color val) {
    894894        return put("color."+colKey, val != null ? ColorHelper.color2html(val, true) : null);
    895895    }
    896896
    897     synchronized public int getInteger(String key, int def) {
     897    public synchronized int getInteger(String key, int def) {
    898898        String v = get(key, Integer.toString(def));
    899899        if(v.isEmpty())
     
    908908    }
    909909
    910     synchronized public int getInteger(String key, String specName, int def) {
     910    public synchronized int getInteger(String key, String specName, int def) {
    911911        String v = get(key+"."+specName);
    912912        if(v.isEmpty())
     
    923923    }
    924924
    925     synchronized public long getLong(String key, long def) {
     925    public synchronized long getLong(String key, long def) {
    926926        String v = get(key, Long.toString(def));
    927927        if(null == v)
     
    936936    }
    937937
    938     synchronized public double getDouble(String key, double def) {
     938    public synchronized double getDouble(String key, double def) {
    939939        String v = get(key, Double.toString(def));
    940940        if(null == v)
     
    971971    }
    972972
    973     synchronized public void removeFromCollection(String key, String value) {
     973    public synchronized void removeFromCollection(String key, String value) {
    974974        List<String> a = new ArrayList<String>(getCollection(key, Collections.<String>emptyList()));
    975975        a.remove(value);
     
    10171017    }
    10181018
    1019     synchronized public Setting getSetting(String key, Setting def) {
     1019    public synchronized Setting getSetting(String key, Setting def) {
    10201020        return getSetting(key, def, Setting.class);
    10211021    }
     
    10331033     */
    10341034    @SuppressWarnings("unchecked")
    1035     synchronized public <T extends Setting> T getSetting(String key, T def, Class<T> klass) {
     1035    public synchronized <T extends Setting> T getSetting(String key, T def, Class<T> klass) {
    10361036        CheckParameterUtil.ensureParameterNotNull(key);
    10371037        CheckParameterUtil.ensureParameterNotNull(def);
     
    10741074     */
    10751075    @SuppressWarnings({ "unchecked", "rawtypes" })
    1076     synchronized public Collection<Collection<String>> getArray(String key, Collection<Collection<String>> def) {
     1076    public synchronized Collection<Collection<String>> getArray(String key, Collection<Collection<String>> def) {
    10771077        ListListSetting val = getSetting(key, ListListSetting.create(def), ListListSetting.class);
    10781078        return (Collection) val.getValue();
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r6413 r6986  
    6262     * @param c The command to execute. Must not be {@code null}.
    6363     */
    64     synchronized public void add(final Command c) {
     64    public synchronized void add(final Command c) {
    6565        addNoRedraw(c);
    6666        afterAdd();
     
    7878     * @param num The number of commands to undo
    7979     */
    80     synchronized public void undo(int num) {
     80    public synchronized void undo(int num) {
    8181        if (commands.isEmpty())
    8282            return;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r6897 r6986  
    8787         */
    8888        abstract static class PrimitiveToTag implements Utils.Function<OsmPrimitive, Tag> {
     89
     90            private PrimitiveToTag() {
     91                // Hide implicit public constructor for utility class
     92            }
    8993
    9094            /**
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

    r6623 r6986  
    5454            // fake country/state to not get errors on holidays
    5555            ENGINE.eval("var nominatimJSON = {address: {state: 'Bayern', country_code: 'de'}};");
    56             ENGINE.eval("" +
     56            ENGINE.eval(
    5757                    "var oh = function (value, mode) {" +
    5858                    " try {" +
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r6889 r6986  
    174174
    175175                if (n == null) {
    176                     n = node.isNew() ? tr("node") : ""+ node.getId();
     176                    n = node.isNew() ? tr("node") : Long.toString(node.getId());
    177177                }
    178178                name.append(n);
  • trunk/src/org/openstreetmap/josm/gui/MenuScroller.java

    r6920 r6986  
    566566        UP(9, 1, 9),
    567567        DOWN(1, 9, 1);
    568         final int[] xPoints = {1, 5, 9};
     568        static final int[] xPoints = {1, 5, 9};
    569569        final int[] yPoints;
    570570
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PresetListPanel.java

    r6572 r6986  
    1414import java.util.Map;
    1515
    16 import javax.swing.Action;
    17 import javax.swing.Icon;
    1816import javax.swing.JLabel;
    1917import javax.swing.JPanel;
     
    2725public class PresetListPanel extends JPanel {
    2826
     27    /**
     28     * Constructs a new {@code PresetListPanel}.
     29     */
    2930    public PresetListPanel() {
    3031        super(new GridBagLayout());
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r6890 r6986  
    8181 * Class that helps PropertiesDialog add and edit tag values
    8282 */
    83  class TagEditHelper {
     83class TagEditHelper {
    8484    private final DefaultTableModel tagData;
    8585    private final Map<String, Map<String, Integer>> valueCount;
     
    769769        }
    770770    }
    771  }
     771}
  • trunk/src/org/openstreetmap/josm/gui/layer/JumpToMarkerActions.java

    r6362 r6986  
    4242    }
    4343
    44     private static abstract class JumpToMarker extends AbstractAction implements MultikeyShortcutAction {
     44    private abstract static class JumpToMarker extends AbstractAction implements MultikeyShortcutAction {
    4545
    4646        private final Layer layer;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java

    r6883 r6986  
    246246        "exifCoor = "+exifCoor+" | "+
    247247        (tmp == null ? " tmp==null" :
    248             " [tmp] pos = "+tmp.pos+"");
     248            " [tmp] pos = "+tmp.pos);
    249249        return result;
    250250    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java

    r6889 r6986  
    197197            } else if (val instanceof Color) {
    198198                res.append(Utils.toString((Color)val));
    199             } else {
    200                 res.append(val+"");
     199            } else if (val != null) {
     200                res.append(val.toString());
    201201            }
    202202            res.append("; ");
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java

    r6970 r6986  
    7979        REGEX, NREGEX, ONE_OF, BEGINS_WITH, ENDS_WITH, CONTAINS;
    8080
    81         private static Set<Op> NEGATED_OPS = EnumSet.of(NEQ, NREGEX);
     81        private static final Set<Op> NEGATED_OPS = EnumSet.of(NEQ, NREGEX);
    8282
    8383        public boolean eval(String testString, String prototypeString) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/Prototype.java

    r6883 r6986  
    3838    }
    3939
    40     public boolean check(OsmPrimitive primitive)
    41     {
     40    public boolean check(OsmPrimitive primitive) {
    4241        if(conditions == null)
    4342            return true;
    44         for(XmlCondition r : conditions)
    45         {
     43        for(XmlCondition r : conditions) {
    4644            String k = primitive.get(r.key);
    4745
     
    5654        return true;
    5755    }
    58 
    5956}
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java

    r6830 r6986  
    836836     * Base class for the nodes that model a MultiSplitLayout.
    837837     */
    838     public static abstract class Node {
     838    public abstract static class Node {
    839839        private Split parent = null;
    840840        private Rectangle bounds = new Rectangle();
     
    11071107            sb.append(" \"");
    11081108            sb.append(getName());
    1109             sb.append("\"");
     1109            sb.append('\"');
    11101110            sb.append(" weight=");
    11111111            sb.append(getWeight());
    1112             sb.append(" ");
     1112            sb.append(' ');
    11131113            sb.append(getBounds());
    11141114            return sb.toString();
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitPane.java

    r6340 r6986  
    145145     * @see #setDividerPainter
    146146     */
    147     public static abstract class DividerPainter {
     147    public abstract static class DividerPainter {
    148148        /**
    149149         * Paint a single Divider.
  • trunk/src/org/openstreetmap/josm/tools/template_engine/Condition.java

    r4282 r6986  
    5555        return sb.toString();
    5656    }
    57 
    5857}
  • trunk/src/org/openstreetmap/josm/tools/template_engine/StaticText.java

    r4282 r6986  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.tools.template_engine;
    3 
    43
    54public class StaticText implements TemplateEntry {
     
    2524        return staticText;
    2625    }
    27 
    28 
    2926}
  • trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateEntry.java

    r4282 r6986  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.tools.template_engine;
    3 
    43
    54public interface TemplateEntry {
  • trunk/src/org/openstreetmap/josm/tools/template_engine/Variable.java

    r4431 r6986  
    33
    44import java.util.Collection;
    5 
    65
    76public class Variable implements TemplateEntry {
     
    6261        return special;
    6362    }
    64 
    6563}
Note: See TracChangeset for help on using the changeset viewer.