Ignore:
Timestamp:
2016-05-30T01:17:28+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - Performance - Method passes constant String of length 1 to character overridden method + add unit tests/javadoc

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

Legend:

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

    r10285 r10300  
    258258        @Override
    259259        public String toString() {
    260             return "LayerChangeAdapter [wrapped=" + wrapped + "]";
    261         }
    262 
     260            return "LayerChangeAdapter [wrapped=" + wrapped + ']';
     261        }
    263262    }
    264263
     
    314313        @Override
    315314        public String toString() {
    316             return "EditLayerChangeAdapter [wrapped=" + wrapped + "]";
    317         }
    318 
     315            return "EditLayerChangeAdapter [wrapped=" + wrapped + ']';
     316        }
    319317    }
    320318
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DeleteFromRelationConfirmationDialog.java

    r10179 r10300  
    114114                numParentRelations, numParentRelations);
    115115        @I18n.QuirkyPluralString
    116         final String msg = "<html>" + msg1 + " " + msg2 + "</html>";
     116        final String msg = "<html>" + msg1 + ' ' + msg2 + "</html>";
    117117        htmlPanel.getEditorPane().setText(msg);
    118118        invalidate();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java

    r10254 r10300  
    7272        p.setVisible(false);
    7373
    74         mSpltPane.add(p, "L"+i);
     74        mSpltPane.add(p, 'L'+Integer.toString(i));
    7575        panels.add(p);
    7676
     
    257257                ch.add(new Divider());
    258258            }
    259             Leaf l = new Leaf("L"+i);
     259            Leaf l = new Leaf('L'+Integer.toString(i));
    260260            l.setWeight(1.0 / numPanels);
    261261            ch.add(l);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java

    r9214 r10300  
    200200        tfLatLon.setText(ll.latToString(CoordinateFormat.getDefaultFormat()) + ' ' + ll.lonToString(CoordinateFormat.getDefaultFormat()));
    201201        EastNorth en = Main.getProjection().latlon2eastNorth(ll);
    202         tfEastNorth.setText(en.east()+" "+en.north());
     202        tfEastNorth.setText(Double.toString(en.east()) + ' ' + Double.toString(en.north()));
    203203        setOkEnabled(true);
    204204    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r10179 r10300  
    688688            p.add(new JScrollPane(txtErrors), GBC.std().fill());
    689689            for (T t : items) {
    690                 txtErrors.append(t + "\n");
     690                txtErrors.append(t.toString() + '\n');
    691691            }
    692692        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java

    r10245 r10300  
    299299        @Override
    300300        public String toString() {
    301             return "OpacitySlider [getRealValue()=" + getRealValue() + "]";
     301            return "OpacitySlider [getRealValue()=" + getRealValue() + ']';
    302302        }
    303303    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r10254 r10300  
    812812            Shortcut sc = Shortcut.findShortcut(KeyEvent.VK_1, commandDownMask);
    813813            if (sc != null) {
    814                 lines.add(sc.getKeyText() + " " + tr("to apply first suggestion"));
    815             }
    816             lines.add(KeyEvent.getKeyModifiersText(KeyEvent.SHIFT_MASK)+'+'+KeyEvent.getKeyText(KeyEvent.VK_ENTER) + " "
     814                lines.add(sc.getKeyText() + ' ' + tr("to apply first suggestion"));
     815            }
     816            lines.add(KeyEvent.getKeyModifiersText(KeyEvent.SHIFT_MASK)+'+'+KeyEvent.getKeyText(KeyEvent.VK_ENTER) + ' '
    817817                    +tr("to add without closing the dialog"));
    818818            sc = Shortcut.findShortcut(KeyEvent.VK_1, commandDownMask | KeyEvent.SHIFT_DOWN_MASK);
    819819            if (sc != null) {
    820                 lines.add(sc.getKeyText() + " " + tr("to add first suggestion without closing the dialog"));
     820                lines.add(sc.getKeyText() + ' ' + tr("to add first suggestion without closing the dialog"));
    821821            }
    822822            final JLabel helpLabel = new JLabel("<html>" + Utils.join("<br>", lines) + "</html>");
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r10179 r10300  
    16251625            return null;
    16261626        if (Main.isTraceEnabled()) {
    1627             Main.trace("Clicked on tile: " + clickedTile.getXtile() + " " + clickedTile.getYtile() +
     1627            Main.trace("Clicked on tile: " + clickedTile.getXtile() + ' ' + clickedTile.getYtile() +
    16281628                " currentZoomLevel: " + currentZoomLevel);
    16291629        }
  • trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java

    r10179 r10300  
    304304            return process(to);
    305305        }
     306
     307        @Override
     308        public String toString() {
     309            return "GammaImageProcessor [gamma=" + gamma + ']';
     310        }
    306311    }
    307312
     
    387392        @Override
    388393        public String toString() {
    389             return "SharpenImageProcessor [sharpenLevel=" + sharpenLevel + "]";
     394            return "SharpenImageProcessor [sharpenLevel=" + sharpenLevel + ']';
    390395        }
    391396    }
     
    437442        @Override
    438443        public String toString() {
    439             return "ColorfulImageProcessor [colorfulness=" + colorfulness + "]";
     444            return "ColorfulImageProcessor [colorfulness=" + colorfulness + ']';
    440445        }
    441446    }
     
    470475            int type = src.getType();
    471476            if (type != dest.getType()) {
    472                 Main.trace("Cannot apply color filter: Src / Dest differ in type (" + type + "/" + dest.getType() + ")");
     477                Main.trace("Cannot apply color filter: Src / Dest differ in type (" + type + '/' + dest.getType() + ')');
    473478                return src;
    474479            }
  • trunk/src/org/openstreetmap/josm/gui/layer/MapViewPaintable.java

    r10031 r10300  
    3131         */
    3232        public PaintableInvalidationEvent(MapViewPaintable paintable) {
    33             super();
    3433            this.paintable = paintable;
    3534        }
     
    4544        @Override
    4645        public String toString() {
    47             return "LayerInvalidationEvent [layer=" + paintable + "]";
     46            return "LayerInvalidationEvent [layer=" + paintable + ']';
    4847        }
    4948    }
  • trunk/src/org/openstreetmap/josm/gui/layer/NativeScaleLayer.java

    r9914 r10300  
    240240            StringBuilder stringBuilder = new StringBuilder();
    241241            for (Scale s: this.scales) {
    242                 stringBuilder.append(s + "\n");
     242                stringBuilder.append(s.toString() + '\n');
    243243            }
    244244            return stringBuilder.toString();
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r10280 r10300  
    804804            final GpxLayer gpxLayer = new GpxLayer(gpxData, tr("Converted from: {0}", getName()));
    805805            if (getAssociatedFile() != null) {
    806                 final String filename = getAssociatedFile().getName().replaceAll(Pattern.quote(".gpx.osm") + "$", "") + ".gpx";
     806                String filename = getAssociatedFile().getName().replaceAll(Pattern.quote(".gpx.osm") + '$', "") + ".gpx";
    807807                gpxLayer.setAssociatedFile(new File(getAssociatedFile().getParentFile(), filename));
    808808            }
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java

    r9277 r10300  
    9595
    9696    private BufferedImage loadThumb(ImageEntry entry) {
    97         final String cacheIdent = entry.getFile()+":"+maxSize;
     97        final String cacheIdent = entry.getFile().toString()+':'+maxSize;
    9898
    9999        if (!cacheOff && cache != null) {
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r10050 r10300  
    222222    @Override
    223223    public String getToolTipText() {
    224         return data.size()+" "+trn("marker", "markers", data.size());
     224        return Integer.toString(data.size())+' '+trn("marker", "markers", data.size());
    225225    }
    226226
    227227    @Override
    228228    public void mergeFrom(Layer from) {
    229         MarkerLayer layer = (MarkerLayer) from;
    230         data.addAll(layer.data);
    231         Collections.sort(data, new Comparator<Marker>() {
    232             @Override
    233             public int compare(Marker o1, Marker o2) {
    234                 return Double.compare(o1.time, o2.time);
    235             }
    236         });
     229        if (from instanceof MarkerLayer) {
     230            data.addAll(((MarkerLayer) from).data);
     231            Collections.sort(data, new Comparator<Marker>() {
     232                @Override
     233                public int compare(Marker o1, Marker o2) {
     234                    return Double.compare(o1.time, o2.time);
     235                }
     236            });
     237        }
    237238    }
    238239
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java

    r10200 r10300  
    130130            } catch (NumberFormatException e) {
    131131                if (Main.isDebugEnabled()) {
    132                     Main.debug("'"+o+"' cannot be converted to float");
     132                    Main.debug('\'' + (String) o + "' cannot be converted to float");
    133133                }
    134134            }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java

    r10245 r10300  
    743743        private final Expression e;
    744744
     745        /**
     746         * Constructs a new {@code ExpressionFactory}
     747         * @param e expression
     748         */
    745749        public ExpressionCondition(Expression e) {
    746750            this.e = e;
     
    755759        @Override
    756760        public String toString() {
    757             return "[" + e + ']';
     761            return '[' + e.toString() + ']';
    758762        }
    759763    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/LiteralExpression.java

    r8846 r10300  
    99/**
    1010 * Simple literal value, that does not depend on other expressions.
     11 * @since 5705
    1112 */
    1213public class LiteralExpression implements Expression {
    1314    private final Object literal;
    1415
     16    /**
     17     * Constructs a new {@code LiteralExpression}.
     18     * @param literal literal
     19     */
    1520    public LiteralExpression(Object literal) {
    1621        CheckParameterUtil.ensureParameterNotNull(literal);
     
    2833            return Arrays.toString((float[]) literal);
    2934        }
    30         return "<" + literal + '>';
     35        return '<' + literal.toString() + '>';
    3136    }
    3237}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r10033 r10300  
    435435        @Override
    436436        public String toString() {
    437             return left + " " + (ChildOrParentSelectorType.PARENT.equals(type) ? '<' : '>') + link + ' ' + right;
     437            return left.toString() + ' ' + (ChildOrParentSelectorType.PARENT.equals(type) ? '<' : '>') + link + ' ' + right;
    438438        }
    439439    }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java

    r9371 r10300  
    269269        @Override
    270270        public String toString() {
    271             return "{" + getClass().getSimpleName() +'}';
     271            return '{' + getClass().getSimpleName() + '}';
    272272        }
    273273
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java

    r10254 r10300  
    530530    @Override
    531531    public String toString() {
    532         return (types == null ? "" : types) + " " + name;
     532        return (types == null ? "" : types.toString()) + ' ' + name;
    533533    }
    534534
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r9422 r10300  
    168168        @Override
    169169        public String toString() {
    170             return classification + " " + preset;
     170            return Integer.toString(classification) + ' ' + preset;
    171171        }
    172172    }
Note: See TracChangeset for help on using the changeset viewer.