ImmutableEnumSetRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$).*
as compiler argument.
Table of contents
SetsImmutableEnumSetIterable
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SetsImmutableEnumSetIterable")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$SetsImmutableEnumSetIterable).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ImmutableSet<RoundingMode>> testSetsImmutableEnumSetIterable() {
return ImmutableSet.of(
- ImmutableSet.copyOf(Iterables.cycle(RoundingMode.UP)),
- ImmutableSet.copyOf(EnumSet.allOf(RoundingMode.class)));
+ Sets.immutableEnumSet(Iterables.cycle(RoundingMode.UP)),
+ Sets.immutableEnumSet(EnumSet.allOf(RoundingMode.class)));
}
SetsImmutableEnumSetArraysAsList
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SetsImmutableEnumSetArraysAsList")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$SetsImmutableEnumSetArraysAsList).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<RoundingMode> testSetsImmutableEnumSetArraysAsList() {
- return ImmutableSet.copyOf(RoundingMode.values());
+ return Sets.immutableEnumSet(Arrays.asList(RoundingMode.values()));
}
SetsImmutableEnumSet1
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SetsImmutableEnumSet1")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$SetsImmutableEnumSet1).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ImmutableSet<RoundingMode>> testSetsImmutableEnumSet1() {
return ImmutableSet.of(
- ImmutableSet.of(RoundingMode.UP), ImmutableSet.copyOf(EnumSet.of(RoundingMode.UP)));
+ Sets.immutableEnumSet(RoundingMode.UP), Sets.immutableEnumSet(RoundingMode.UP));
}
SetsImmutableEnumSet2
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SetsImmutableEnumSet2")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$SetsImmutableEnumSet2).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ImmutableSet<RoundingMode>> testSetsImmutableEnumSet2() {
return ImmutableSet.of(
- ImmutableSet.of(RoundingMode.UP, RoundingMode.DOWN),
- ImmutableSet.copyOf(EnumSet.of(RoundingMode.UP, RoundingMode.DOWN)));
+ Sets.immutableEnumSet(RoundingMode.UP, RoundingMode.DOWN),
+ Sets.immutableEnumSet(RoundingMode.UP, RoundingMode.DOWN));
}
SetsImmutableEnumSet3
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SetsImmutableEnumSet3")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$SetsImmutableEnumSet3).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ImmutableSet<RoundingMode>> testSetsImmutableEnumSet3() {
return ImmutableSet.of(
- ImmutableSet.of(RoundingMode.UP, RoundingMode.DOWN, RoundingMode.CEILING),
- ImmutableSet.copyOf(EnumSet.of(RoundingMode.UP, RoundingMode.DOWN, RoundingMode.CEILING)));
+ Sets.immutableEnumSet(RoundingMode.UP, RoundingMode.DOWN, RoundingMode.CEILING),
+ Sets.immutableEnumSet(RoundingMode.UP, RoundingMode.DOWN, RoundingMode.CEILING));
}
SetsImmutableEnumSet4
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SetsImmutableEnumSet4")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$SetsImmutableEnumSet4).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ImmutableSet<RoundingMode>> testSetsImmutableEnumSet4() {
return ImmutableSet.of(
- ImmutableSet.of(
+ Sets.immutableEnumSet(
RoundingMode.UP, RoundingMode.DOWN, RoundingMode.CEILING, RoundingMode.FLOOR),
- ImmutableSet.copyOf(
- EnumSet.of(
- RoundingMode.UP, RoundingMode.DOWN, RoundingMode.CEILING, RoundingMode.FLOOR)));
+ Sets.immutableEnumSet(
+ RoundingMode.UP, RoundingMode.DOWN, RoundingMode.CEILING, RoundingMode.FLOOR));
}
SetsImmutableEnumSet5
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SetsImmutableEnumSet5")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$SetsImmutableEnumSet5).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ImmutableSet<RoundingMode>> testSetsImmutableEnumSet5() {
return ImmutableSet.of(
- ImmutableSet.of(
+ Sets.immutableEnumSet(
RoundingMode.UP,
RoundingMode.DOWN,
RoundingMode.CEILING,
RoundingMode.FLOOR,
RoundingMode.UNNECESSARY),
- ImmutableSet.copyOf(
- EnumSet.of(
- RoundingMode.UP,
- RoundingMode.DOWN,
- RoundingMode.CEILING,
- RoundingMode.FLOOR,
- RoundingMode.UNNECESSARY)));
+ Sets.immutableEnumSet(
+ RoundingMode.UP,
+ RoundingMode.DOWN,
+ RoundingMode.CEILING,
+ RoundingMode.FLOOR,
+ RoundingMode.UNNECESSARY));
}
SetsImmutableEnumSet6
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SetsImmutableEnumSet6")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$SetsImmutableEnumSet6).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<RoundingMode> testSetsImmutableEnumSet6() {
- return ImmutableSet.of(
+ return Sets.immutableEnumSet(
RoundingMode.UP,
RoundingMode.DOWN,
RoundingMode.CEILING,
RoundingMode.FLOOR,
RoundingMode.UNNECESSARY,
RoundingMode.HALF_EVEN);
}
SetsImmutableEnumSetVarArgs
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("SetsImmutableEnumSetVarArgs")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$SetsImmutableEnumSetVarArgs).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<RoundingMode> testSetsImmutableEnumSetVarArgs() {
- return ImmutableSet.copyOf(
- EnumSet.of(
- RoundingMode.UP,
- RoundingMode.DOWN,
- RoundingMode.CEILING,
- RoundingMode.FLOOR,
- RoundingMode.UNNECESSARY,
- RoundingMode.HALF_EVEN));
+ return Sets.immutableEnumSet(
+ RoundingMode.UP,
+ RoundingMode.DOWN,
+ RoundingMode.CEILING,
+ RoundingMode.FLOOR,
+ RoundingMode.UNNECESSARY,
+ RoundingMode.HALF_EVEN);
}
StreamToImmutableEnumSet
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("StreamToImmutableEnumSet")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableEnumSetRules\$StreamToImmutableEnumSet).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<BoundType> testStreamToImmutableEnumSet() {
- return Stream.of(BoundType.OPEN).collect(toImmutableSet());
+ return Stream.of(BoundType.OPEN).collect(toImmutableEnumSet());
}