Ignore:
Timestamp:
2015-10-10T01:40:42+02:00 (9 years ago)
Author:
Don-vip
Message:

sonar - fb-contrib - minor performance improvements:

  • Method passes constant String of length 1 to character overridden method
  • Method needlessly boxes a boolean constant
  • Method uses iterator().next() on a List to get the first item
  • Method converts String to boxed primitive using excessive boxing
  • Method converts String to primitive using excessive boxing
  • Method creates array using constants
  • Class defines List based fields but uses them like Sets
Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java

    r7828 r8846  
    3737        errorCount++;
    3838        if (errorCount <= MAX_ERRORS) {
    39             writer.println("[" + type + "] " + String.format(message, args));
     39            writer.println('[' + type + "] " + String.format(message, args));
    4040        }
    4141    }
     
    187187        if (Main.isDebugEnabled()) {
    188188            StackTraceElement item = Thread.currentThread().getStackTrace()[2];
    189             String operation = getClass().getSimpleName() + "." + item.getMethodName();
     189            String operation = getClass().getSimpleName() + '.' + item.getMethodName();
    190190            long elapsedTime = System.currentTimeMillis() - startTime;
    191191            Main.debug(tr("Test ''{0}'' completed in {1}",
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r8540 r8846  
    275275    public String toString() {
    276276        String coorDesc = isLatLonKnown() ? "lat="+lat+",lon="+lon : "";
    277         return "{Node id=" + getUniqueId() + " version=" + getVersion() + " " + getFlagsAsString() + " "  + coorDesc+"}";
     277        return "{Node id=" + getUniqueId() + " version=" + getVersion() + ' ' + getFlagsAsString() + ' '  + coorDesc+'}';
    278278    }
    279279
  • trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java

    r8510 r8846  
    7373                : null;
    7474        if (p == null) {
    75             throw new IllegalArgumentException("Expecting n/node/w/way/r/relation/area, but got '" + x[0] + "'");
     75            throw new IllegalArgumentException("Expecting n/node/w/way/r/relation/area, but got '" + x[0] + '\'');
    7676        }
    7777        for (final Map.Entry<String, String> i : TextTagParser.readTagsFromText(x[1]).entrySet()) {
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r8836 r8846  
    8080        @Override
    8181        public String toString() {
    82             return super.toString() + "[" + level + "]: " + bbox();
     82            return super.toString() + '[' + level + "]: " + bbox();
    8383        }
    8484
     
    361361
    362362            if (!canRemove()) {
    363                 abort("attempt to remove non-empty child: " + this.content + " " + Arrays.toString(this.getChildren()));
     363                abort("attempt to remove non-empty child: " + this.content + ' ' + Arrays.toString(this.getChildren()));
    364364            }
    365365
  • trunk/src/org/openstreetmap/josm/data/osm/RelationMemberData.java

    r8510 r8846  
    3636    @Override
    3737    public String toString() {
    38         return (memberType != null ? memberType.getAPIName() : "undefined") + " " + memberId;
     38        return (memberType != null ? memberType.getAPIName() : "undefined") + ' ' + memberId;
    3939    }
    4040
  • trunk/src/org/openstreetmap/josm/data/osm/Tag.java

    r8419 r8846  
    112112            return new Tag(x[0], x[1]);
    113113        } else {
    114             throw new IllegalArgumentException("'" + s + "' does not contain '='");
     114            throw new IllegalArgumentException('\'' + s + "' does not contain '='");
    115115        }
    116116    }
     
    118118    @Override
    119119    public String toString() {
    120         return key + "=" + value;
     120        return key + '=' + value;
    121121    }
    122122
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r8512 r8846  
    331331    public String toString() {
    332332        String nodesDesc = isIncomplete() ? "(incomplete)" : "nodes=" + Arrays.toString(nodes);
    333         return "{Way id=" + getUniqueId() + " version=" + getVersion()+ " " + getFlagsAsString()  + " " + nodesDesc + "}";
     333        return "{Way id=" + getUniqueId() + " version=" + getVersion()+ ' ' + getFlagsAsString() + ' ' + nodesDesc + '}';
    334334    }
    335335
  • trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java

    r8510 r8846  
    9494    @Override
    9595    public String toString() {
    96         return "WaySegment [way=" + way.getUniqueId() + ", lowerIndex=" + lowerIndex + "]";
     96        return "WaySegment [way=" + way.getUniqueId() + ", lowerIndex=" + lowerIndex + ']';
    9797    }
    9898}
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java

    r8540 r8846  
    238238        if (get(key) != null)
    239239            return get(key);
    240         key = "name:" + Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry();
     240        key = "name:" + Locale.getDefault().getLanguage() + '_' + Locale.getDefault().getCountry();
    241241        if (get(key) != null)
    242242            return get(key);
     
    278278                + (user != null ? "user=" + user + ", " : "") + "changesetId="
    279279                + changesetId
    280                 + "]";
     280                + ']';
    281281    }
    282282}
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r8840 r8846  
    181181    @Override
    182182    public String toString() {
    183         return "BoundingXYVisitor["+bounds+"]";
     183        return "BoundingXYVisitor["+bounds+']';
    184184    }
    185185
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r8840 r8846  
    17291729                System.err.println("; phase 2 (draw): " + Utils.getDurationString(timeFinished - timePhase1) +
    17301730                    "; total: " + Utils.getDurationString(timeFinished - timeStart) +
    1731                     " (scale: " + circum + " zoom level: " + Selector.GeneralSelector.scale2level(circum) + ")");
     1731                    " (scale: " + circum + " zoom level: " + Selector.GeneralSelector.scale2level(circum) + ')');
    17321732            }
    17331733
Note: See TracChangeset for help on using the changeset viewer.