Changeset 16626 in josm


Ignore:
Timestamp:
2020-06-14T14:55:23+02:00 (4 years ago)
Author:
simon04
Message:

see #19334 - https://errorprone.info/bugpattern/ImmutableEnumChecker

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r16625 r16626  
    302302            <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
    303303            <compilerarg value="-XDignore.symbol.file"/>
    304             <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:ImmutableEnumChecker:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:FloatingPointLiteralPrecision:OFF -Xep:ShortCircuitBoolean:OFF -Xep:StringSplitter:OFF -Xep:JdkObsolete:OFF -Xep:UnnecessaryParentheses:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:MixedMutabilityReturnType:OFF -Xep:JavaTimeDefaultTimeZone:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:MutablePublicArray:OFF"/>
     304            <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:FloatingPointLiteralPrecision:OFF -Xep:ShortCircuitBoolean:OFF -Xep:StringSplitter:OFF -Xep:JdkObsolete:OFF -Xep:UnnecessaryParentheses:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:MixedMutabilityReturnType:OFF -Xep:JavaTimeDefaultTimeZone:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:MutablePublicArray:OFF"/>
    305305            <compilerarg line="-Xmaxwarns 1000"/>
    306306            <classpath>
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r16558 r16626  
    7575        way_with_nodes(/* ICON(cursor/modifier/) */ "delete_way_node_only");
    7676
     77        @SuppressWarnings("ImmutableEnumChecker")
    7778        private final Cursor c;
    7879
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r16438 r16626  
    109109        move(Cursor.MOVE_CURSOR);
    110110
     111        @SuppressWarnings("ImmutableEnumChecker")
    111112        private final Cursor c;
    112113        SelectActionCursor(String main, String sub) {
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java

    r16445 r16626  
    3232    private final Class<? extends OsmPrimitive> osmClass;
    3333    private final Class<? extends PrimitiveData> dataClass;
     34    @SuppressWarnings("ImmutableEnumChecker")
    3435    private final UniqueIdGenerator idGenerator;
    3536
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java

    r14784 r16626  
    7979    AREA_TEXT(marktr("areatext"), Color.LIGHT_GRAY);
    8080
     81    @SuppressWarnings("ImmutableEnumChecker")
    8182    private final NamedColorProperty baseProperty;
     83    @SuppressWarnings("ImmutableEnumChecker")
    8284    private final CachingProperty<Color> property;
    8385
  • trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java

    r16436 r16626  
    185185        SOUTH(LatLon.SOUTH_POLE);
    186186
     187        @SuppressWarnings("ImmutableEnumChecker")
    187188        private final LatLon latlon;
    188189
  • trunk/src/org/openstreetmap/josm/data/validation/Severity.java

    r12987 r16626  
    3131
    3232    /** Associated color */
     33    @SuppressWarnings("ImmutableEnumChecker") // see https://github.com/google/error-prone/pull/1682
    3334    private final Color color;
    3435
  • trunk/src/org/openstreetmap/josm/gui/MenuScroller.java

    r16438 r16626  
    422422        DOWN(1, 9, 1);
    423423        private static final int[] XPOINTS = {1, 5, 9};
     424        @SuppressWarnings("ImmutableEnumChecker")
    424425        private final int[] yPoints;
    425426
  • trunk/src/org/openstreetmap/josm/gui/conflict/ConflictColors.java

    r12987 r16626  
    8282    FGCOLOR_MEMBER_REMOVE(marktr("Conflict foreground: remove member"), Color.black);
    8383
     84    @SuppressWarnings("ImmutableEnumChecker")
    8485    private final NamedColorProperty property;
    8586
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java

    r16438 r16626  
    55import static org.openstreetmap.josm.gui.conflict.pair.ListRole.THEIR_ENTRIES;
    66import static org.openstreetmap.josm.tools.I18n.tr;
    7 
    8 import java.util.Arrays;
    9 
    10 import org.openstreetmap.josm.tools.Utils;
    117
    128/**
     
    3329    /** the localized display name */
    3430    private final String displayName;
    35     private final ListRole[] participatingRoles;
     31    private final ListRole participatingRole1;
     32    private final ListRole participatingRole2;
    3633
    37     ComparePairType(String displayName, ListRole... participatingRoles) {
     34    ComparePairType(String displayName, ListRole participatingRole1, ListRole participatingRole2) {
    3835        this.displayName = displayName;
    39         this.participatingRoles = Utils.copyArray(participatingRoles);
     36        this.participatingRole1 = participatingRole1;
     37        this.participatingRole2 = participatingRole2;
    4038    }
    4139
     
    5654     */
    5755    public boolean isParticipatingIn(ListRole role) {
    58         return Arrays.stream(participatingRoles).anyMatch(r -> r == role);
     56        return participatingRole1 == role || participatingRole2 == role;
    5957    }
    6058
     
    6563     */
    6664    public ListRole[] getParticipatingRoles() {
    67         return Utils.copyArray(participatingRoles);
     65        return new ListRole[]{participatingRole1, participatingRole2};
    6866    }
    6967
     
    7876        if (!isParticipatingIn(role))
    7977            throw new IllegalStateException(tr("Role {0} is not participating in compare pair {1}.", role.toString(), this.toString()));
    80         if (participatingRoles[0] == role)
    81             return participatingRoles[1];
    82         else
    83             return participatingRoles[0];
     78        return participatingRole1 == role ? participatingRole2 : participatingRole1;
    8479    }
    8580}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorListManagementDialog.java

    r15586 r16626  
    4949        CANCEL(1, tr("Cancel"), new ImageProvider("cancel"));
    5050
    51         private int index;
    52         private String name;
    53         private ImageIcon icon;
     51        private final int index;
     52        private final String name;
     53        @SuppressWarnings("ImmutableEnumChecker")
     54        private final ImageIcon icon;
    5455
    5556        BUTTONS(int index, String name, ImageProvider image) {
  • trunk/src/org/openstreetmap/josm/gui/history/TwoColumnDiff.java

    r16458 r16626  
    3939            EMPTY(new Color(234, 234, 234));
    4040
     41            @SuppressWarnings("ImmutableEnumChecker") // see https://github.com/google/error-prone/pull/1682
    4142            private final Color color;
    4243            DiffItemType(Color color) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java

    r16438 r16626  
    182182        static final Set<Op> NEGATED_OPS = EnumSet.of(NEQ, NREGEX);
    183183
     184        @SuppressWarnings("ImmutableEnumChecker")
    184185        private final BiPredicate<String, String> function;
    185186
  • trunk/src/org/openstreetmap/josm/tools/OptionParser.java

    r14640 r16626  
    251251        MULTIPLE(0, Integer.MAX_VALUE);
    252252
    253         private int min;
    254         private int max;
     253        private final int min;
     254        private final int max;
    255255
    256256        OptionCount(int min, int max) {
Note: See TracChangeset for help on using the changeset viewer.