Changeset 11294 in josm for trunk/src/org


Ignore:
Timestamp:
2016-11-22T16:07:59+01:00 (3 years ago)
Author:
simon04
Message:

Fix http://errorprone.info/bugpattern/NarrowingCompoundAssignment

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

Legend:

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

    r11288 r11294  
    5757     * and on upload the object will be send to the server.
    5858     */
    59     protected static final int FLAG_MODIFIED = 1 << 0;
     59    protected static final short FLAG_MODIFIED = 1 << 0;
    6060
    6161    /**
     
    6363     * as deleted on the server.
    6464     */
    65     protected static final int FLAG_VISIBLE = 1 << 1;
     65    protected static final short FLAG_VISIBLE = 1 << 1;
    6666
    6767    /**
     
    7272     * objects still referring to it.
    7373     */
    74     protected static final int FLAG_DELETED = 1 << 2;
     74    protected static final short FLAG_DELETED = 1 << 2;
    7575
    7676    /**
     
    7979     * fetched from the server.
    8080     */
    81     protected static final int FLAG_INCOMPLETE = 1 << 3;
     81    protected static final short FLAG_INCOMPLETE = 1 << 3;
    8282
    8383    /**
     
    277277    /* ------*/
    278278
    279     protected void updateFlags(int flag, boolean value) {
     279    protected void updateFlags(short flag, boolean value) {
    280280        if (value) {
    281281            flags |= flag;
    282282        } else {
    283             flags &= ~flag;
     283            flags &= (short) ~flag;
    284284        }
    285285    }
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r11292 r11294  
    5252     * while the filter is active.
    5353     */
    54     protected static final int FLAG_DISABLED = 1 << 4;
     54    protected static final short FLAG_DISABLED = 1 << 4;
    5555
    5656    /**
     
    6363     * unset as well (for efficient access).
    6464     */
    65     protected static final int FLAG_HIDE_IF_DISABLED = 1 << 5;
     65    protected static final short FLAG_HIDE_IF_DISABLED = 1 << 5;
    6666
    6767    /**
    6868     * Flag used internally by the filter mechanism.
    6969     */
    70     protected static final int FLAG_DISABLED_TYPE = 1 << 6;
     70    protected static final short FLAG_DISABLED_TYPE = 1 << 6;
    7171
    7272    /**
    7373     * Flag used internally by the filter mechanism.
    7474     */
    75     protected static final int FLAG_HIDDEN_TYPE = 1 << 7;
     75    protected static final short FLAG_HIDDEN_TYPE = 1 << 7;
    7676
    7777    /**
     
    8080     * (e.g. one way street.)
    8181     */
    82     protected static final int FLAG_HAS_DIRECTIONS = 1 << 8;
     82    protected static final short FLAG_HAS_DIRECTIONS = 1 << 8;
    8383
    8484    /**
     
    8686     * Some trivial tags like source=* are ignored here.
    8787     */
    88     protected static final int FLAG_TAGGED = 1 << 9;
     88    protected static final short FLAG_TAGGED = 1 << 9;
    8989
    9090    /**
     
    9393     * (E.g. oneway=-1.)
    9494     */
    95     protected static final int FLAG_DIRECTION_REVERSED = 1 << 10;
     95    protected static final short FLAG_DIRECTION_REVERSED = 1 << 10;
    9696
    9797    /**
     
    100100     * that the primitive is currently highlighted.
    101101     */
    102     protected static final int FLAG_HIGHLIGHTED = 1 << 11;
     102    protected static final short FLAG_HIGHLIGHTED = 1 << 11;
    103103
    104104    /**
     
    106106     * Match the "work in progress" tags in default map style.
    107107     */
    108     protected static final int FLAG_ANNOTATED = 1 << 12;
     108    protected static final short FLAG_ANNOTATED = 1 << 12;
    109109
    110110    /**
     
    396396    /* ------*/
    397397
    398     private void updateFlagsNoLock(int flag, boolean value) {
     398    private void updateFlagsNoLock(short flag, boolean value) {
    399399        super.updateFlags(flag, value);
    400400    }
    401401
    402402    @Override
    403     protected final void updateFlags(int flag, boolean value) {
     403    protected final void updateFlags(short flag, boolean value) {
    404404        boolean locked = writeLock();
    405405        try {
     
    440440        try {
    441441            int oldFlags = flags;
    442             updateFlagsNoLock(FLAG_DISABLED + FLAG_HIDE_IF_DISABLED, false);
     442            updateFlagsNoLock(FLAG_DISABLED, false);
     443            updateFlagsNoLock(FLAG_HIDE_IF_DISABLED, false);
    443444            return oldFlags != flags;
    444445        } finally {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r11285 r11294  
    806806            LineMetrics metrics = text.font.getLineMetrics(s, frc);
    807807            if (bs.vAlign == VerticalTextAlignment.ABOVE) {
    808                 y -= -box.y + metrics.getDescent();
     808                y -= -box.y + (int) metrics.getDescent();
    809809            } else if (bs.vAlign == VerticalTextAlignment.TOP) {
    810                 y -= -box.y - metrics.getAscent();
     810                y -= -box.y - (int) metrics.getAscent();
    811811            } else if (bs.vAlign == VerticalTextAlignment.CENTER) {
    812                 y += (metrics.getAscent() - metrics.getDescent()) / 2;
     812                y += (int) ((metrics.getAscent() - metrics.getDescent()) / 2);
    813813            } else if (bs.vAlign == VerticalTextAlignment.BELOW) {
    814                 y += box.y + box.height + metrics.getAscent() + 2;
     814                y += box.y + box.height + (int) metrics.getAscent() + 2;
    815815            } else throw new AssertionError();
    816816        }
  • trunk/src/org/openstreetmap/josm/tools/MultiLineFlowLayout.java

    r10717 r11294  
    7575                    x += getHgap();
    7676                }
    77                 x += size.getWidth();
     77                x += size.width;
    7878                if (x > containerWidth) {
    7979                    totalHeight += rowHeight + getVgap();
Note: See TracChangeset for help on using the changeset viewer.