Picnic-Bot
2023-10-04 14:43:27 +02:00
committed by GitHub
parent 7c618f7e2d
commit ef75b80e7b
4 changed files with 8 additions and 11 deletions

View File

@@ -220,7 +220,10 @@ public final class LexicographicalAnnotationAttributeListing extends BugChecker
private static AnnotationAttributeMatcher createAnnotationAttributeMatcher( private static AnnotationAttributeMatcher createAnnotationAttributeMatcher(
ErrorProneFlags flags) { ErrorProneFlags flags) {
return AnnotationAttributeMatcher.create( return AnnotationAttributeMatcher.create(
flags.getList(INCLUDED_ANNOTATIONS_FLAG), excludedAnnotations(flags)); flags.get(INCLUDED_ANNOTATIONS_FLAG).isPresent()
? Optional.of(flags.getListOrEmpty(INCLUDED_ANNOTATIONS_FLAG))
: Optional.empty(),
excludedAnnotations(flags));
} }
private static ImmutableList<String> excludedAnnotations(ErrorProneFlags flags) { private static ImmutableList<String> excludedAnnotations(ErrorProneFlags flags) {

View File

@@ -16,10 +16,7 @@ public final class Flags {
* provided, or if the flag's value is the empty string. * provided, or if the flag's value is the empty string.
*/ */
public static ImmutableList<String> getList(ErrorProneFlags errorProneFlags, String name) { public static ImmutableList<String> getList(ErrorProneFlags errorProneFlags, String name) {
return errorProneFlags ImmutableList<String> list = errorProneFlags.getListOrEmpty(name);
.getList(name) return list.equals(ImmutableList.of("")) ? ImmutableList.of() : list;
.map(ImmutableList::copyOf)
.filter(flags -> !flags.equals(ImmutableList.of("")))
.orElseGet(ImmutableList::of);
} }
} }

View File

@@ -201,7 +201,7 @@
<version.auto-value>1.10.4</version.auto-value> <version.auto-value>1.10.4</version.auto-value>
<version.error-prone>${version.error-prone-orig}</version.error-prone> <version.error-prone>${version.error-prone-orig}</version.error-prone>
<version.error-prone-fork>v${version.error-prone-orig}-picnic-1</version.error-prone-fork> <version.error-prone-fork>v${version.error-prone-orig}-picnic-1</version.error-prone-fork>
<version.error-prone-orig>2.21.1</version.error-prone-orig> <version.error-prone-orig>2.22.0</version.error-prone-orig>
<version.error-prone-slf4j>0.1.20</version.error-prone-slf4j> <version.error-prone-slf4j>0.1.20</version.error-prone-slf4j>
<version.guava-beta-checker>1.0</version.guava-beta-checker> <version.guava-beta-checker>1.0</version.guava-beta-checker>
<version.jdk>11</version.jdk> <version.jdk>11</version.jdk>
@@ -1739,8 +1739,6 @@
false-positives. false-positives.
-XepOpt:CheckReturnValue:CheckAllMethods=true --> -XepOpt:CheckReturnValue:CheckAllMethods=true -->
-XepOpt:InlineMe:SkipInliningsWithComments=false -XepOpt:InlineMe:SkipInliningsWithComments=false
-XepOpt:NamedLikeContextualKeyword:EnableClassNames=true
-XepOpt:NamedLikeContextualKeyword:EnableMethodNames=true
-XepOpt:NullAway:AnnotatedPackages=tech.picnic -XepOpt:NullAway:AnnotatedPackages=tech.picnic
-XepOpt:NullAway:AssertsEnabled=true -XepOpt:NullAway:AssertsEnabled=true
-XepOpt:NullAway:CheckOptionalEmptiness=true -XepOpt:NullAway:CheckOptionalEmptiness=true

View File

@@ -42,7 +42,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.Set;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.inject.Inject; import javax.inject.Inject;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
@@ -180,7 +179,7 @@ public final class RefasterRuleCollection extends BugChecker implements Compilat
for (Description description : matches) { for (Description description : matches) {
String ruleName = extractRefasterRuleName(description); String ruleName = extractRefasterRuleName(description);
Set<Replacement> replacements = ImmutableSet<Replacement> replacements =
Iterables.getOnlyElement(description.fixes).getReplacements(endPositions); Iterables.getOnlyElement(description.fixes).getReplacements(endPositions);
for (Replacement replacement : replacements) { for (Replacement replacement : replacements) {
ruleMatches.put(replacement.range(), ruleName); ruleMatches.put(replacement.range(), ruleName);