Introduce SonarCloud integration and resolve assorted violations (#575)

This commit is contained in:
Stephan Schroevers
2023-04-25 08:19:11 +02:00
committed by GitHub
parent 554a3e634c
commit e0c795d248
142 changed files with 450 additions and 211 deletions

View File

@@ -54,4 +54,3 @@ jobs:
run: mvn build-helper:remove-project-artifact run: mvn build-helper:remove-project-artifact
# XXX: Enable Codecov once we "go public". # XXX: Enable Codecov once we "go public".
# XXX: Enable SonarCloud once we "go public".

36
.github/workflows/sonarcloud.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
# Analyzes the code base using SonarCloud. See
# https://sonarcloud.io/project/overview?id=PicnicSupermarket_error-prone-support.
name: SonarCloud analysis
on:
pull_request:
push:
branches: [ master ]
schedule:
- cron: '0 4 * * 1'
permissions:
contents: read
jobs:
analyze:
permissions:
contents: read
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@v3.8.0
with:
java-version: 17.0.6
distribution: temurin
cache: maven
- name: Create missing `test` directory
# XXX: Drop this step in favour of actually having a test.
run: mkdir refaster-compiler/src/test
- name: Perform SonarCloud analysis
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -T1C jacoco:prepare-agent verify jacoco:report sonar:sonar -Dverification.skip -Dsonar.projectKey=PicnicSupermarket_error-prone-support

View File

@@ -25,6 +25,7 @@ enum ExtractorType {
return identifier; return identifier;
} }
@SuppressWarnings("java:S1452" /* The extractor returns data of an unspecified type. */)
Extractor<?> getExtractor() { Extractor<?> getExtractor() {
return extractor; return extractor;
} }

View File

@@ -67,10 +67,11 @@ final class DocumentationGeneratorTaskListenerTest {
@Test @Test
void excessArguments(@TempDir Path outputDirectory) { void excessArguments(@TempDir Path outputDirectory) {
String actualOutputDirectory = outputDirectory.toAbsolutePath() + " extra-arg";
assertThatThrownBy( assertThatThrownBy(
() -> () ->
Compilation.compileWithDocumentationGenerator( Compilation.compileWithDocumentationGenerator(
outputDirectory.toAbsolutePath() + " extra-arg", "A.java", "package pkg;")) actualOutputDirectory, "A.java", "package pkg;"))
.isInstanceOf(IllegalArgumentException.class) .isInstanceOf(IllegalArgumentException.class)
.hasMessage("Precisely one path must be provided"); .hasMessage("Precisely one path must be provided");
} }

View File

@@ -24,7 +24,6 @@ project:
- Document how to apply patches. - Document how to apply patches.
- Document each of the checks. - Document each of the checks.
- Add [SonarQube][sonarcloud] and [Codecov][codecov] integrations.
- Add non-Java file formatting support, like we have internally at Picnic. - Add non-Java file formatting support, like we have internally at Picnic.
(I.e., somehow open-source that stuff.) (I.e., somehow open-source that stuff.)
- Auto-generate a website listing each of the checks, just like the Error Prone - Auto-generate a website listing each of the checks, just like the Error Prone
@@ -273,7 +272,6 @@ Refaster's expressiveness:
[autorefactor]: https://autorefactor.org [autorefactor]: https://autorefactor.org
[bettercodehub]: https://bettercodehub.com [bettercodehub]: https://bettercodehub.com
[checkstyle-external-project-tests]: https://github.com/checkstyle/checkstyle/blob/master/wercker.yml [checkstyle-external-project-tests]: https://github.com/checkstyle/checkstyle/blob/master/wercker.yml
[codecov]: https://codecov.io
[error-prone-bug-patterns]: https://errorprone.info/bugpatterns [error-prone-bug-patterns]: https://errorprone.info/bugpatterns
[error-prone]: https://errorprone.info [error-prone]: https://errorprone.info
[error-prone-repo]: https://github.com/google/error-prone [error-prone-repo]: https://github.com/google/error-prone
@@ -283,4 +281,3 @@ Refaster's expressiveness:
[main-contributing]: ../CONTRIBUTING.md [main-contributing]: ../CONTRIBUTING.md
[main-readme]: ../README.md [main-readme]: ../README.md
[modernizer-maven-plugin]: https://github.com/gaul/modernizer-maven-plugin [modernizer-maven-plugin]: https://github.com/gaul/modernizer-maven-plugin
[sonarcloud]: https://sonarcloud.io

View File

@@ -39,7 +39,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode;
@AutoService(BugChecker.class) @AutoService(BugChecker.class)
@BugPattern( @BugPattern(
summary = summary =
"These methods implement an associative operation, so the list of operands can be flattened", "This method implements an associative operation, so the list of operands can be flattened",
link = BUG_PATTERNS_BASE_URL + "AssociativeMethodInvocation", link = BUG_PATTERNS_BASE_URL + "AssociativeMethodInvocation",
linkType = CUSTOM, linkType = CUSTOM,
severity = SUGGESTION, severity = SUGGESTION,
@@ -70,24 +70,31 @@ public final class AssociativeMethodInvocation extends BugChecker
for (Matcher<ExpressionTree> matcher : ASSOCIATIVE_OPERATIONS) { for (Matcher<ExpressionTree> matcher : ASSOCIATIVE_OPERATIONS) {
if (matcher.matches(tree, state)) { if (matcher.matches(tree, state)) {
SuggestedFix.Builder fix = SuggestedFix.builder(); SuggestedFix fix = processMatchingArguments(tree, matcher, state);
for (ExpressionTree arg : tree.getArguments()) { return fix.isEmpty() ? Description.NO_MATCH : describeMatch(tree, fix);
if (matcher.matches(arg, state)) {
MethodInvocationTree invocation = (MethodInvocationTree) arg;
fix.merge(
invocation.getArguments().isEmpty()
? SuggestedFixes.removeElement(arg, tree.getArguments(), state)
: SourceCode.unwrapMethodInvocation(invocation, state));
}
}
return fix.isEmpty() ? Description.NO_MATCH : describeMatch(tree, fix.build());
} }
} }
return Description.NO_MATCH; return Description.NO_MATCH;
} }
private static SuggestedFix processMatchingArguments(
MethodInvocationTree tree, Matcher<ExpressionTree> matcher, VisitorState state) {
SuggestedFix.Builder fix = SuggestedFix.builder();
for (ExpressionTree arg : tree.getArguments()) {
if (matcher.matches(arg, state)) {
MethodInvocationTree invocation = (MethodInvocationTree) arg;
fix.merge(
invocation.getArguments().isEmpty()
? SuggestedFixes.removeElement(invocation, tree.getArguments(), state)
: SourceCode.unwrapMethodInvocation(invocation, state));
}
}
return fix.build();
}
private static Matcher<MethodInvocationTree> hasArgumentOfType(Supplier<Type> type) { private static Matcher<MethodInvocationTree> hasArgumentOfType(Supplier<Type> type) {
return (tree, state) -> return (tree, state) ->
tree.getArguments().stream() tree.getArguments().stream()

View File

@@ -58,8 +58,8 @@ public final class AutowiredConstructor extends BugChecker implements ClassTreeM
/* /*
* This is the only `@Autowired` constructor: suggest that it be removed. Note that this likely * This is the only `@Autowired` constructor: suggest that it be removed. Note that this likely
* means that the associated import can be removed as well. Rather than adding code for this case we * means that the associated import can be removed as well. Rather than adding code for this
* leave flagging the unused import to Error Prone's `RemoveUnusedImports` check. * case we leave flagging the unused import to Error Prone's `RemoveUnusedImports` check.
*/ */
AnnotationTree annotation = Iterables.getOnlyElement(annotations); AnnotationTree annotation = Iterables.getOnlyElement(annotations);
return describeMatch(annotation, SourceCode.deleteWithTrailingWhitespace(annotation, state)); return describeMatch(annotation, SourceCode.deleteWithTrailingWhitespace(annotation, state));

View File

@@ -30,7 +30,7 @@ import tech.picnic.errorprone.bugpatterns.util.ThirdPartyLibrary;
@AutoService(BugChecker.class) @AutoService(BugChecker.class)
@BugPattern( @BugPattern(
summary = summary =
"Avoid `Collectors.to{List,Map,Set}` in favour of alternatives that emphasize (im)mutability", "Avoid `Collectors.to{List,Map,Set}` in favor of collectors that emphasize (im)mutability",
link = BUG_PATTERNS_BASE_URL + "CollectorMutability", link = BUG_PATTERNS_BASE_URL + "CollectorMutability",
linkType = CUSTOM, linkType = CUSTOM,
severity = WARNING, severity = WARNING,

View File

@@ -42,6 +42,7 @@ public final class EmptyMethod extends BugChecker implements MethodTreeMatcher {
public EmptyMethod() {} public EmptyMethod() {}
@Override @Override
@SuppressWarnings("java:S1067" /* Chaining disjunctions like this does not impact readability. */)
public Description matchMethod(MethodTree tree, VisitorState state) { public Description matchMethod(MethodTree tree, VisitorState state) {
if (tree.getBody() == null if (tree.getBody() == null
|| !tree.getBody().getStatements().isEmpty() || !tree.getBody().getStatements().isEmpty()

View File

@@ -104,7 +104,9 @@ public final class ErrorProneTestHelperSourceFormat extends BugChecker
String formatted; String formatted;
try { try {
formatted = formatSourceCode(source, retainUnusedImports).trim(); formatted = formatSourceCode(source, retainUnusedImports).trim();
} catch (FormatterException e) { } catch (
@SuppressWarnings("java:S1166" /* Stack trace not relevant. */)
FormatterException e) {
return buildDescription(methodInvocation) return buildDescription(methodInvocation)
.setMessage(String.format("Source code is malformed: %s", e.getMessage())) .setMessage(String.format("Source code is malformed: %s", e.getMessage()))
.build(); .build();
@@ -131,7 +133,7 @@ public final class ErrorProneTestHelperSourceFormat extends BugChecker
SuggestedFix.replace( SuggestedFix.replace(
startPos, startPos,
endPos, endPos,
Splitter.on('\n') Splitter.on(System.lineSeparator())
.splitToStream(formatted) .splitToStream(formatted)
.map(state::getConstantExpression) .map(state::getConstantExpression)
.collect(joining(", ")))); .collect(joining(", "))));
@@ -157,7 +159,7 @@ public final class ErrorProneTestHelperSourceFormat extends BugChecker
return Optional.empty(); return Optional.empty();
} }
source.append(value).append('\n'); source.append(value).append(System.lineSeparator());
} }
return Optional.of(source.toString()); return Optional.of(source.toString());

View File

@@ -58,6 +58,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode;
linkType = CUSTOM, linkType = CUSTOM,
severity = SUGGESTION, severity = SUGGESTION,
tags = STYLE) tags = STYLE)
@SuppressWarnings("java:S2160" /* Super class equality definition suffices. */)
public final class LexicographicalAnnotationAttributeListing extends BugChecker public final class LexicographicalAnnotationAttributeListing extends BugChecker
implements AnnotationTreeMatcher { implements AnnotationTreeMatcher {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -46,9 +46,19 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode;
public final class LexicographicalAnnotationListing extends BugChecker public final class LexicographicalAnnotationListing extends BugChecker
implements MethodTreeMatcher { implements MethodTreeMatcher {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* A comparator that minimally reorders {@link AnnotationType}s, such that declaration annotations
* are placed before type annotations.
*/
@SuppressWarnings({
"java:S1067",
"java:S3358"
} /* Avoiding the nested ternary operator hurts readability. */)
private static final Comparator<@Nullable AnnotationType> BY_ANNOTATION_TYPE = private static final Comparator<@Nullable AnnotationType> BY_ANNOTATION_TYPE =
(a, b) -> (a, b) ->
(a == null || a == DECLARATION) && b == TYPE ? -1 : a == TYPE && b == DECLARATION ? 1 : 0; (a == null || a == DECLARATION) && b == TYPE
? -1
: (a == TYPE && b == DECLARATION ? 1 : 0);
/** Instantiates a new {@link LexicographicalAnnotationListing} instance. */ /** Instantiates a new {@link LexicographicalAnnotationListing} instance. */
public LexicographicalAnnotationListing() {} public LexicographicalAnnotationListing() {}

View File

@@ -118,6 +118,8 @@ public final class MethodReferenceUsage extends BugChecker implements LambdaExpr
.flatMap(expectedInstance -> constructMethodRef(lambdaExpr, subTree, expectedInstance)); .flatMap(expectedInstance -> constructMethodRef(lambdaExpr, subTree, expectedInstance));
} }
@SuppressWarnings(
"java:S1151" /* Extracting `IDENTIFIER` case block to separate method does not improve readability. */)
private static Optional<SuggestedFix.Builder> constructMethodRef( private static Optional<SuggestedFix.Builder> constructMethodRef(
LambdaExpressionTree lambdaExpr, LambdaExpressionTree lambdaExpr,
MethodInvocationTree subTree, MethodInvocationTree subTree,
@@ -130,10 +132,9 @@ public final class MethodReferenceUsage extends BugChecker implements LambdaExpr
return Optional.empty(); return Optional.empty();
} }
Symbol sym = ASTHelpers.getSymbol(methodSelect); Symbol sym = ASTHelpers.getSymbol(methodSelect);
if (!ASTHelpers.isStatic(sym)) { return ASTHelpers.isStatic(sym)
return constructFix(lambdaExpr, "this", methodSelect); ? constructFix(lambdaExpr, sym.owner, methodSelect)
} : constructFix(lambdaExpr, "this", methodSelect);
return constructFix(lambdaExpr, sym.owner, methodSelect);
case MEMBER_SELECT: case MEMBER_SELECT:
return constructMethodRef(lambdaExpr, (MemberSelectTree) methodSelect, expectedInstance); return constructMethodRef(lambdaExpr, (MemberSelectTree) methodSelect, expectedInstance);
default: default:

View File

@@ -43,6 +43,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode;
// emitting a value (e.g. `Mono.empty()`, `someFlux.then()`, ...), or known not to complete normally // emitting a value (e.g. `Mono.empty()`, `someFlux.then()`, ...), or known not to complete normally
// (`Mono.never()`, `someFlux.repeat()`, `Mono.error(...)`, ...). The latter category could // (`Mono.never()`, `someFlux.repeat()`, `Mono.error(...)`, ...). The latter category could
// potentially be split out further. // potentially be split out further.
@SuppressWarnings("java:S1192" /* Factoring out repeated method names impacts readability. */)
public final class NonEmptyMono extends BugChecker implements MethodInvocationTreeMatcher { public final class NonEmptyMono extends BugChecker implements MethodInvocationTreeMatcher {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Matcher<ExpressionTree> MONO_SIZE_CHECK = private static final Matcher<ExpressionTree> MONO_SIZE_CHECK =

View File

@@ -49,6 +49,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode;
linkType = CUSTOM, linkType = CUSTOM,
severity = WARNING, severity = WARNING,
tags = PERFORMANCE) tags = PERFORMANCE)
@SuppressWarnings("java:S1192" /* Factoring out repeated method names impacts readability. */)
public final class PrimitiveComparison extends BugChecker implements MethodInvocationTreeMatcher { public final class PrimitiveComparison extends BugChecker implements MethodInvocationTreeMatcher {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Matcher<ExpressionTree> STATIC_COMPARISON_METHOD = private static final Matcher<ExpressionTree> STATIC_COMPARISON_METHOD =

View File

@@ -62,6 +62,11 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode;
linkType = CUSTOM, linkType = CUSTOM,
severity = SUGGESTION, severity = SUGGESTION,
tags = SIMPLIFICATION) tags = SIMPLIFICATION)
@SuppressWarnings({
"java:S1192" /* Factoring out repeated method names impacts readability. */,
"java:S2160" /* Super class equality definition suffices. */,
"key-to-resolve-AnnotationUseStyle-and-TrailingComment-check-conflict"
})
public final class RedundantStringConversion extends BugChecker public final class RedundantStringConversion extends BugChecker
implements BinaryTreeMatcher, CompoundAssignmentTreeMatcher, MethodInvocationTreeMatcher { implements BinaryTreeMatcher, CompoundAssignmentTreeMatcher, MethodInvocationTreeMatcher {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -163,7 +168,7 @@ public final class RedundantStringConversion extends BugChecker
ExpressionTree lhs = tree.getLeftOperand(); ExpressionTree lhs = tree.getLeftOperand();
ExpressionTree rhs = tree.getRightOperand(); ExpressionTree rhs = tree.getRightOperand();
if (!STRING.matches(lhs, state)) { if (!STRING.matches(lhs, state)) {
return finalize(tree, tryFix(rhs, state, STRING)); return createDescription(tree, tryFix(rhs, state, STRING));
} }
List<SuggestedFix.Builder> fixes = new ArrayList<>(); List<SuggestedFix.Builder> fixes = new ArrayList<>();
@@ -177,7 +182,7 @@ public final class RedundantStringConversion extends BugChecker
} }
tryFix(rhs, state, ANY_EXPR).ifPresent(fixes::add); tryFix(rhs, state, ANY_EXPR).ifPresent(fixes::add);
return finalize(tree, fixes.stream().reduce(SuggestedFix.Builder::merge)); return createDescription(tree, fixes.stream().reduce(SuggestedFix.Builder::merge));
} }
@Override @Override
@@ -186,36 +191,36 @@ public final class RedundantStringConversion extends BugChecker
return Description.NO_MATCH; return Description.NO_MATCH;
} }
return finalize(tree, tryFix(tree.getExpression(), state, ANY_EXPR)); return createDescription(tree, tryFix(tree.getExpression(), state, ANY_EXPR));
} }
@Override @Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
if (STRINGBUILDER_APPEND_INVOCATION.matches(tree, state)) { if (STRINGBUILDER_APPEND_INVOCATION.matches(tree, state)) {
return finalize(tree, tryFixPositionalConverter(tree.getArguments(), state, 0)); return createDescription(tree, tryFixPositionalConverter(tree.getArguments(), state, 0));
} }
if (STRINGBUILDER_INSERT_INVOCATION.matches(tree, state)) { if (STRINGBUILDER_INSERT_INVOCATION.matches(tree, state)) {
return finalize(tree, tryFixPositionalConverter(tree.getArguments(), state, 1)); return createDescription(tree, tryFixPositionalConverter(tree.getArguments(), state, 1));
} }
if (FORMATTER_INVOCATION.matches(tree, state)) { if (FORMATTER_INVOCATION.matches(tree, state)) {
return finalize(tree, tryFixFormatter(tree.getArguments(), state)); return createDescription(tree, tryFixFormatter(tree.getArguments(), state));
} }
if (GUAVA_GUARD_INVOCATION.matches(tree, state)) { if (GUAVA_GUARD_INVOCATION.matches(tree, state)) {
return finalize(tree, tryFixGuavaGuard(tree.getArguments(), state)); return createDescription(tree, tryFixGuavaGuard(tree.getArguments(), state));
} }
if (SLF4J_LOGGER_INVOCATION.matches(tree, state)) { if (SLF4J_LOGGER_INVOCATION.matches(tree, state)) {
return finalize(tree, tryFixSlf4jLogger(tree.getArguments(), state)); return createDescription(tree, tryFixSlf4jLogger(tree.getArguments(), state));
} }
if (instanceMethod().matches(tree, state)) { if (instanceMethod().matches(tree, state)) {
return finalize(tree, tryFix(tree, state, STRING)); return createDescription(tree, tryFix(tree, state, STRING));
} }
return finalize(tree, tryFix(tree, state, NON_NULL_STRING)); return createDescription(tree, tryFix(tree, state, NON_NULL_STRING));
} }
private Optional<SuggestedFix.Builder> tryFixPositionalConverter( private Optional<SuggestedFix.Builder> tryFixPositionalConverter(
@@ -298,7 +303,7 @@ public final class RedundantStringConversion extends BugChecker
/* Simplify the values to be plugged into the format pattern, if possible. */ /* Simplify the values to be plugged into the format pattern, if possible. */
return arguments.stream() return arguments.stream()
.skip(patternIndex + 1) .skip(patternIndex + 1L)
.map(arg -> tryFix(arg, state, remainingArgFilter)) .map(arg -> tryFix(arg, state, remainingArgFilter))
.flatMap(Optional::stream) .flatMap(Optional::stream)
.reduce(SuggestedFix.Builder::merge); .reduce(SuggestedFix.Builder::merge);
@@ -362,7 +367,7 @@ public final class RedundantStringConversion extends BugChecker
return Optional.of(Iterables.getOnlyElement(methodInvocation.getArguments())); return Optional.of(Iterables.getOnlyElement(methodInvocation.getArguments()));
} }
private Description finalize(Tree tree, Optional<SuggestedFix.Builder> fixes) { private Description createDescription(Tree tree, Optional<SuggestedFix.Builder> fixes) {
return fixes return fixes
.map(SuggestedFix.Builder::build) .map(SuggestedFix.Builder::build)
.map(fix -> describeMatch(tree, fix)) .map(fix -> describeMatch(tree, fix))

View File

@@ -99,8 +99,9 @@ public final class RequestMappingAnnotation extends BugChecker implements Method
&& LACKS_PARAMETER_ANNOTATION.matches(tree, state) && LACKS_PARAMETER_ANNOTATION.matches(tree, state)
? buildDescription(tree) ? buildDescription(tree)
.setMessage( .setMessage(
"Not all parameters of this request mapping method are annotated; this may be a mistake. " "Not all parameters of this request mapping method are annotated; this may be a "
+ "If the unannotated parameters represent query string parameters, annotate them with `@RequestParam`.") + "mistake. If the unannotated parameters represent query string parameters, "
+ "annotate them with `@RequestParam`.")
.build() .build()
: Description.NO_MATCH; : Description.NO_MATCH;
} }

View File

@@ -38,6 +38,7 @@ import tech.picnic.errorprone.bugpatterns.util.Flags;
linkType = CUSTOM, linkType = CUSTOM,
severity = ERROR, severity = ERROR,
tags = LIKELY_ERROR) tags = LIKELY_ERROR)
@SuppressWarnings("java:S2160" /* Super class equality definition suffices. */)
public final class RequestParamType extends BugChecker implements VariableTreeMatcher { public final class RequestParamType extends BugChecker implements VariableTreeMatcher {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final String SUPPORTED_CUSTOM_TYPES_FLAG = "RequestParamType:SupportedCustomTypes"; private static final String SUPPORTED_CUSTOM_TYPES_FLAG = "RequestParamType:SupportedCustomTypes";

View File

@@ -103,7 +103,7 @@ public final class AnnotationAttributeMatcher implements Serializable {
* @param tree The annotation AST node to be inspected. * @param tree The annotation AST node to be inspected.
* @return Any matching annotation arguments. * @return Any matching annotation arguments.
*/ */
public Stream<? extends ExpressionTree> extractMatchingArguments(AnnotationTree tree) { public Stream<ExpressionTree> extractMatchingArguments(AnnotationTree tree) {
Type type = ASTHelpers.getType(tree.getAnnotationType()); Type type = ASTHelpers.getType(tree.getAnnotationType());
if (type == null) { if (type == null) {
return Stream.empty(); return Stream.empty();
@@ -111,6 +111,7 @@ public final class AnnotationAttributeMatcher implements Serializable {
String annotationType = type.toString(); String annotationType = type.toString();
return tree.getArguments().stream() return tree.getArguments().stream()
.map(ExpressionTree.class::cast)
.filter(a -> matches(annotationType, extractAttributeName(a))); .filter(a -> matches(annotationType, extractAttributeName(a)));
} }

View File

@@ -114,6 +114,7 @@ public final class JavaKeywords {
* @see <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.8">JDK 17 JLS * @see <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.8">JDK 17 JLS
* section 3.8: Identifiers</a> * section 3.8: Identifiers</a>
*/ */
@SuppressWarnings("java:S1067" /* Chaining conjunctions like this does not impact readability. */)
public static boolean isValidIdentifier(String str) { public static boolean isValidIdentifier(String str) {
return !str.isEmpty() return !str.isEmpty()
&& !isReservedKeyword(str) && !isReservedKeyword(str)

View File

@@ -18,6 +18,9 @@ import java.util.regex.Pattern;
public final class MethodMatcherFactory { public final class MethodMatcherFactory {
private static final Splitter ARGUMENT_TYPE_SPLITTER = private static final Splitter ARGUMENT_TYPE_SPLITTER =
Splitter.on(',').trimResults().omitEmptyStrings(); Splitter.on(',').trimResults().omitEmptyStrings();
// XXX: Check whether we can use a parser for "standard" Java signatures here. Maybe
// `sun.reflect.generics.parser.SignatureParser`?
@SuppressWarnings("java:S5998" /* In practice there will be only modest recursion. */)
private static final Pattern METHOD_SIGNATURE = private static final Pattern METHOD_SIGNATURE =
Pattern.compile("([^\\s#(,)]+)#([^\\s#(,)]+)\\(((?:[^\\s#(,)]+(?:,[^\\s#(,)]+)*)?)\\)"); Pattern.compile("([^\\s#(,)]+)#([^\\s#(,)]+)\\(((?:[^\\s#(,)]+(?:,[^\\s#(,)]+)*)?)\\)");

View File

@@ -90,7 +90,9 @@ public enum ThirdPartyLibrary {
try { try {
classFinder.loadClass(state.getSymtab().unnamedModule, binaryName); classFinder.loadClass(state.getSymtab().unnamedModule, binaryName);
return true; return true;
} catch (CompletionFailure e) { } catch (
@SuppressWarnings("java:S1166" /* Not exceptional. */)
CompletionFailure e) {
return false; return false;
} }
} }

View File

@@ -23,6 +23,8 @@ final class AssertJPrimitiveRules {
} }
@BeforeTemplate @BeforeTemplate
@SuppressWarnings(
"java:S1244" /* The (in)equality checks are fragile, but may be seen in the wild. */)
AbstractBooleanAssert<?> before(double actual, double expected) { AbstractBooleanAssert<?> before(double actual, double expected) {
return Refaster.anyOf( return Refaster.anyOf(
assertThat(actual == expected).isTrue(), assertThat(actual != expected).isFalse()); assertThat(actual == expected).isTrue(), assertThat(actual != expected).isFalse());
@@ -43,6 +45,8 @@ final class AssertJPrimitiveRules {
} }
@BeforeTemplate @BeforeTemplate
@SuppressWarnings(
"java:S1244" /* The (in)equality checks are fragile, but may be seen in the wild. */)
AbstractBooleanAssert<?> before(double actual, double expected) { AbstractBooleanAssert<?> before(double actual, double expected) {
return Refaster.anyOf( return Refaster.anyOf(
assertThat(actual != expected).isTrue(), assertThat(actual == expected).isFalse()); assertThat(actual != expected).isTrue(), assertThat(actual == expected).isFalse());

View File

@@ -2024,8 +2024,8 @@ final class AssertJRules {
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Above: Generated code. // Above: Generated code.
/////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Organize the code below. // Organize the code below.
// XXX: Do the "single Comparable" match shown below. // XXX: Do the "single Comparable" match shown below.

View File

@@ -47,7 +47,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalArgumentExceptionHasMessage { static final class AssertThatThrownByIllegalArgumentExceptionHasMessage {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalArgumentException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalArgumentException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatIllegalArgumentException().isThrownBy(throwingCallable).withMessage(message); return assertThatIllegalArgumentException().isThrownBy(throwingCallable).withMessage(message);
} }
@@ -64,7 +64,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalArgumentExceptionHasMessageParameters { static final class AssertThatThrownByIllegalArgumentExceptionHasMessageParameters {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalArgumentException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalArgumentException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before( AbstractObjectAssert<?, ?> before(
ThrowingCallable throwingCallable, String message, @Repeated Object parameters) { ThrowingCallable throwingCallable, String message, @Repeated Object parameters) {
return assertThatIllegalArgumentException() return assertThatIllegalArgumentException()
@@ -85,7 +85,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalArgumentExceptionHasMessageStartingWith { static final class AssertThatThrownByIllegalArgumentExceptionHasMessageStartingWith {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalArgumentException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalArgumentException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatIllegalArgumentException() return assertThatIllegalArgumentException()
.isThrownBy(throwingCallable) .isThrownBy(throwingCallable)
@@ -104,7 +104,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalArgumentExceptionHasMessageContaining { static final class AssertThatThrownByIllegalArgumentExceptionHasMessageContaining {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalArgumentException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalArgumentException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatIllegalArgumentException() return assertThatIllegalArgumentException()
.isThrownBy(throwingCallable) .isThrownBy(throwingCallable)
@@ -123,7 +123,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalArgumentExceptionHasMessageNotContainingAny { static final class AssertThatThrownByIllegalArgumentExceptionHasMessageNotContainingAny {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalArgumentException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalArgumentException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before( AbstractObjectAssert<?, ?> before(
ThrowingCallable throwingCallable, @Repeated CharSequence values) { ThrowingCallable throwingCallable, @Repeated CharSequence values) {
return assertThatIllegalArgumentException() return assertThatIllegalArgumentException()
@@ -157,7 +157,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalStateExceptionHasMessage { static final class AssertThatThrownByIllegalStateExceptionHasMessage {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalStateException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalStateException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatIllegalStateException().isThrownBy(throwingCallable).withMessage(message); return assertThatIllegalStateException().isThrownBy(throwingCallable).withMessage(message);
} }
@@ -174,7 +174,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalStateExceptionHasMessageParameters { static final class AssertThatThrownByIllegalStateExceptionHasMessageParameters {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalStateException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalStateException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before( AbstractObjectAssert<?, ?> before(
ThrowingCallable throwingCallable, String message, @Repeated Object parameters) { ThrowingCallable throwingCallable, String message, @Repeated Object parameters) {
return assertThatIllegalStateException() return assertThatIllegalStateException()
@@ -195,7 +195,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalStateExceptionHasMessageStartingWith { static final class AssertThatThrownByIllegalStateExceptionHasMessageStartingWith {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalStateException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalStateException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatIllegalStateException() return assertThatIllegalStateException()
.isThrownBy(throwingCallable) .isThrownBy(throwingCallable)
@@ -214,7 +214,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalStateExceptionHasMessageContaining { static final class AssertThatThrownByIllegalStateExceptionHasMessageContaining {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalStateException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalStateException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatIllegalStateException() return assertThatIllegalStateException()
.isThrownBy(throwingCallable) .isThrownBy(throwingCallable)
@@ -233,7 +233,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIllegalStateExceptionHasMessageNotContaining { static final class AssertThatThrownByIllegalStateExceptionHasMessageNotContaining {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByIllegalStateException" /* Matches strictly more specific expressions. */) "AssertThatThrownByIllegalStateException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatIllegalStateException() return assertThatIllegalStateException()
.isThrownBy(throwingCallable) .isThrownBy(throwingCallable)
@@ -265,7 +265,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByNullPointerExceptionHasMessage { static final class AssertThatThrownByNullPointerExceptionHasMessage {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByNullPointerException" /* Matches strictly more specific expressions. */) "AssertThatThrownByNullPointerException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatNullPointerException().isThrownBy(throwingCallable).withMessage(message); return assertThatNullPointerException().isThrownBy(throwingCallable).withMessage(message);
} }
@@ -282,7 +282,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByNullPointerExceptionHasMessageParameters { static final class AssertThatThrownByNullPointerExceptionHasMessageParameters {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByNullPointerException" /* Matches strictly more specific expressions. */) "AssertThatThrownByNullPointerException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before( AbstractObjectAssert<?, ?> before(
ThrowingCallable throwingCallable, String message, @Repeated Object parameters) { ThrowingCallable throwingCallable, String message, @Repeated Object parameters) {
return assertThatNullPointerException() return assertThatNullPointerException()
@@ -303,7 +303,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByNullPointerExceptionHasMessageStartingWith { static final class AssertThatThrownByNullPointerExceptionHasMessageStartingWith {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings(
"AssertThatThrownByNullPointerException" /* Matches strictly more specific expressions. */) "AssertThatThrownByNullPointerException" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatNullPointerException() return assertThatNullPointerException()
.isThrownBy(throwingCallable) .isThrownBy(throwingCallable)
@@ -334,8 +334,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIOExceptionHasMessage { static final class AssertThatThrownByIOExceptionHasMessage {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings("AssertThatThrownByIOException" /* This is a more specific template. */)
"AssertThatThrownByIOException" /* Matches strictly more specific expressions. */)
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) { AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
return assertThatIOException().isThrownBy(throwingCallable).withMessage(message); return assertThatIOException().isThrownBy(throwingCallable).withMessage(message);
} }
@@ -351,8 +350,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByIOExceptionHasMessageParameters { static final class AssertThatThrownByIOExceptionHasMessageParameters {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings( @SuppressWarnings("AssertThatThrownByIOException" /* This is a more specific template. */)
"AssertThatThrownByIOException" /* Matches strictly more specific expressions. */)
AbstractObjectAssert<?, ?> before( AbstractObjectAssert<?, ?> before(
ThrowingCallable throwingCallable, String message, @Repeated Object parameters) { ThrowingCallable throwingCallable, String message, @Repeated Object parameters) {
return assertThatIOException().isThrownBy(throwingCallable).withMessage(message, parameters); return assertThatIOException().isThrownBy(throwingCallable).withMessage(message, parameters);
@@ -385,7 +383,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByHasMessage { static final class AssertThatThrownByHasMessage {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("AssertThatThrownBy" /* Matches strictly more specific expressions. */) @SuppressWarnings("AssertThatThrownBy" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before( AbstractObjectAssert<?, ?> before(
Class<? extends Throwable> exceptionType, Class<? extends Throwable> exceptionType,
ThrowingCallable throwingCallable, ThrowingCallable throwingCallable,
@@ -407,7 +405,7 @@ final class AssertJThrowingCallableRules {
static final class AssertThatThrownByHasMessageParameters { static final class AssertThatThrownByHasMessageParameters {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("AssertThatThrownBy" /* Matches strictly more specific expressions. */) @SuppressWarnings("AssertThatThrownBy" /* This is a more specific template. */)
AbstractObjectAssert<?, ?> before( AbstractObjectAssert<?, ?> before(
Class<? extends Throwable> exceptionType, Class<? extends Throwable> exceptionType,
ThrowingCallable throwingCallable, ThrowingCallable throwingCallable,

View File

@@ -115,6 +115,7 @@ final class AssortedRules {
// intelligently. // intelligently.
static final class LogicalImplication { static final class LogicalImplication {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S2589" /* This violation will be rewritten. */)
boolean before(boolean firstTest, boolean secondTest) { boolean before(boolean firstTest, boolean secondTest) {
return firstTest || (!firstTest && secondTest); return firstTest || (!firstTest && secondTest);
} }

View File

@@ -56,6 +56,7 @@ final class BigDecimalRules {
// `BugChecker`. // `BugChecker`.
static final class BigDecimalValueOf { static final class BigDecimalValueOf {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S2111" /* This violation will be rewritten. */)
BigDecimal before(double value) { BigDecimal before(double value) {
return new BigDecimal(value); return new BigDecimal(value);
} }

View File

@@ -35,6 +35,7 @@ final class CollectionRules {
*/ */
static final class CollectionIsEmpty<T> { static final class CollectionIsEmpty<T> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1155" /* This violation will be rewritten. */)
boolean before(Collection<T> collection) { boolean before(Collection<T> collection) {
return Refaster.anyOf( return Refaster.anyOf(
collection.size() == 0, collection.size() == 0,

View File

@@ -233,6 +233,7 @@ final class ComparatorRules {
/** Prefer {@link Comparators#min(Comparable, Comparable)}} over more verbose alternatives. */ /** Prefer {@link Comparators#min(Comparable, Comparable)}} over more verbose alternatives. */
static final class MinOfPairNaturalOrder<T extends Comparable<? super T>> { static final class MinOfPairNaturalOrder<T extends Comparable<? super T>> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1067" /* The conditional operators are independent. */)
T before(T value1, T value2) { T before(T value1, T value2) {
return Refaster.anyOf( return Refaster.anyOf(
value1.compareTo(value2) <= 0 ? value1 : value2, value1.compareTo(value2) <= 0 ? value1 : value2,
@@ -259,6 +260,7 @@ final class ComparatorRules {
*/ */
static final class MinOfPairCustomOrder<T> { static final class MinOfPairCustomOrder<T> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1067" /* The conditional operators are independent. */)
T before(T value1, T value2, Comparator<T> cmp) { T before(T value1, T value2, Comparator<T> cmp) {
return Refaster.anyOf( return Refaster.anyOf(
cmp.compare(value1, value2) <= 0 ? value1 : value2, cmp.compare(value1, value2) <= 0 ? value1 : value2,
@@ -299,6 +301,7 @@ final class ComparatorRules {
/** Prefer {@link Comparators#max(Comparable, Comparable)}} over more verbose alternatives. */ /** Prefer {@link Comparators#max(Comparable, Comparable)}} over more verbose alternatives. */
static final class MaxOfPairNaturalOrder<T extends Comparable<? super T>> { static final class MaxOfPairNaturalOrder<T extends Comparable<? super T>> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1067" /* The conditional operators are independent. */)
T before(T value1, T value2) { T before(T value1, T value2) {
return Refaster.anyOf( return Refaster.anyOf(
value1.compareTo(value2) >= 0 ? value1 : value2, value1.compareTo(value2) >= 0 ? value1 : value2,
@@ -325,6 +328,7 @@ final class ComparatorRules {
*/ */
static final class MaxOfPairCustomOrder<T> { static final class MaxOfPairCustomOrder<T> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1067" /* The conditional operators are independent. */)
T before(T value1, T value2, Comparator<T> cmp) { T before(T value1, T value2, Comparator<T> cmp) {
return Refaster.anyOf( return Refaster.anyOf(
cmp.compare(value1, value2) >= 0 ? value1 : value2, cmp.compare(value1, value2) >= 0 ? value1 : value2,

View File

@@ -237,6 +237,7 @@ final class DoubleStreamRules {
/** Prefer {@link DoubleStream#anyMatch(DoublePredicate)} over more contrived alternatives. */ /** Prefer {@link DoubleStream#anyMatch(DoublePredicate)} over more contrived alternatives. */
static final class DoubleStreamAnyMatch { static final class DoubleStreamAnyMatch {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S4034" /* This violation will be rewritten. */)
boolean before(DoubleStream stream, DoublePredicate predicate) { boolean before(DoubleStream stream, DoublePredicate predicate) {
return Refaster.anyOf( return Refaster.anyOf(
!stream.noneMatch(predicate), stream.filter(predicate).findAny().isPresent()); !stream.noneMatch(predicate), stream.filter(predicate).findAny().isPresent());

View File

@@ -30,6 +30,7 @@ final class EqualityRules {
@AfterTemplate @AfterTemplate
@AlsoNegation @AlsoNegation
@SuppressWarnings("java:S1698" /* Reference comparison is valid for enums. */)
boolean after(T a, T b) { boolean after(T a, T b) {
return a == b; return a == b;
} }
@@ -56,6 +57,7 @@ final class EqualityRules {
/** Avoid double negations; this is not Javascript. */ /** Avoid double negations; this is not Javascript. */
static final class DoubleNegation { static final class DoubleNegation {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S2761" /* This violation will be rewritten. */)
boolean before(boolean b) { boolean before(boolean b) {
return !!b; return !!b;
} }
@@ -72,6 +74,7 @@ final class EqualityRules {
*/ */
// XXX: Replacing `a ? !b : b` with `a != b` changes semantics if both `a` and `b` are boxed // XXX: Replacing `a ? !b : b` with `a != b` changes semantics if both `a` and `b` are boxed
// booleans. // booleans.
@SuppressWarnings("java:S1940" /* This violation will be rewritten. */)
static final class Negation { static final class Negation {
@BeforeTemplate @BeforeTemplate
boolean before(boolean a, boolean b) { boolean before(boolean a, boolean b) {
@@ -79,6 +82,8 @@ final class EqualityRules {
} }
@BeforeTemplate @BeforeTemplate
@SuppressWarnings(
"java:S1244" /* The equality check is fragile, but may be seen in the wild. */)
boolean before(double a, double b) { boolean before(double a, double b) {
return !(a == b); return !(a == b);
} }
@@ -100,6 +105,7 @@ final class EqualityRules {
*/ */
// XXX: Replacing `a ? b : !b` with `a == b` changes semantics if both `a` and `b` are boxed // XXX: Replacing `a ? b : !b` with `a == b` changes semantics if both `a` and `b` are boxed
// booleans. // booleans.
@SuppressWarnings("java:S1940" /* This violation will be rewritten. */)
static final class IndirectDoubleNegation { static final class IndirectDoubleNegation {
@BeforeTemplate @BeforeTemplate
boolean before(boolean a, boolean b) { boolean before(boolean a, boolean b) {
@@ -107,6 +113,8 @@ final class EqualityRules {
} }
@BeforeTemplate @BeforeTemplate
@SuppressWarnings(
"java:S1244" /* The inequality check is fragile, but may be seen in the wild. */)
boolean before(double a, double b) { boolean before(double a, double b) {
return !(a != b); return !(a != b);
} }

View File

@@ -250,7 +250,8 @@ final class ImmutableMapRules {
* Prefer {@link ImmutableMap#of(Object, Object, Object, Object)} over alternatives that don't * Prefer {@link ImmutableMap#of(Object, Object, Object, Object)} over alternatives that don't
* communicate the immutability of the resulting map at the type level. * communicate the immutability of the resulting map at the type level.
*/ */
// XXX: Also rewrite the `ImmutableMap.builder()` variant? // XXX: Consider introducing a `BugChecker` to replace these `ImmutableMapOfX` rules. That will
// also make it easier to rewrite various `ImmutableMap.builder()` variants.
static final class ImmutableMapOf2<K, V> { static final class ImmutableMapOf2<K, V> {
@BeforeTemplate @BeforeTemplate
Map<K, V> before(K k1, V v1, K k2, V v2) { Map<K, V> before(K k1, V v1, K k2, V v2) {
@@ -267,7 +268,8 @@ final class ImmutableMapRules {
* Prefer {@link ImmutableMap#of(Object, Object, Object, Object, Object, Object)} over * Prefer {@link ImmutableMap#of(Object, Object, Object, Object, Object, Object)} over
* alternatives that don't communicate the immutability of the resulting map at the type level. * alternatives that don't communicate the immutability of the resulting map at the type level.
*/ */
// XXX: Also rewrite the `ImmutableMap.builder()` variant? // XXX: Consider introducing a `BugChecker` to replace these `ImmutableMapOfX` rules. That will
// also make it easier to rewrite various `ImmutableMap.builder()` variants.
static final class ImmutableMapOf3<K, V> { static final class ImmutableMapOf3<K, V> {
@BeforeTemplate @BeforeTemplate
Map<K, V> before(K k1, V v1, K k2, V v2, K k3, V v3) { Map<K, V> before(K k1, V v1, K k2, V v2, K k3, V v3) {
@@ -285,7 +287,9 @@ final class ImmutableMapRules {
* over alternatives that don't communicate the immutability of the resulting map at the type * over alternatives that don't communicate the immutability of the resulting map at the type
* level. * level.
*/ */
// XXX: Also rewrite the `ImmutableMap.builder()` variant? // XXX: Consider introducing a `BugChecker` to replace these `ImmutableMapOfX` rules. That will
// also make it easier to rewrite various `ImmutableMap.builder()` variants.
@SuppressWarnings("java:S107" /* Can't avoid many method parameters here. */)
static final class ImmutableMapOf4<K, V> { static final class ImmutableMapOf4<K, V> {
@BeforeTemplate @BeforeTemplate
Map<K, V> before(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { Map<K, V> before(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
@@ -303,7 +307,9 @@ final class ImmutableMapRules {
* Object, Object)} over alternatives that don't communicate the immutability of the resulting map * Object, Object)} over alternatives that don't communicate the immutability of the resulting map
* at the type level. * at the type level.
*/ */
// XXX: Also rewrite the `ImmutableMap.builder()` variant? // XXX: Consider introducing a `BugChecker` to replace these `ImmutableMapOfX` rules. That will
// also make it easier to rewrite various `ImmutableMap.builder()` variants.
@SuppressWarnings("java:S107" /* Can't avoid many method parameters here. */)
static final class ImmutableMapOf5<K, V> { static final class ImmutableMapOf5<K, V> {
@BeforeTemplate @BeforeTemplate
Map<K, V> before(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) { Map<K, V> before(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {

View File

@@ -250,6 +250,7 @@ final class IntStreamRules {
/** Prefer {@link IntStream#anyMatch(IntPredicate)} over more contrived alternatives. */ /** Prefer {@link IntStream#anyMatch(IntPredicate)} over more contrived alternatives. */
static final class IntStreamAnyMatch { static final class IntStreamAnyMatch {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S4034" /* This violation will be rewritten. */)
boolean before(IntStream stream, IntPredicate predicate) { boolean before(IntStream stream, IntPredicate predicate) {
return Refaster.anyOf( return Refaster.anyOf(
!stream.noneMatch(predicate), stream.filter(predicate).findAny().isPresent()); !stream.noneMatch(predicate), stream.filter(predicate).findAny().isPresent());

View File

@@ -34,8 +34,7 @@ import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
* <p>Note that, while both libraries throw an {@link AssertionError} in case of an assertion * <p>Note that, while both libraries throw an {@link AssertionError} in case of an assertion
* failure, the exact subtype used generally differs. * failure, the exact subtype used generally differs.
*/ */
// XXX: Not all `org.assertj.core.api.Assertions` methods have an associated Refaster rule yet; // XXX: Not all JUnit `Assertions` methods have an associated Refaster rule yet; expand this class.
// expand this class.
// XXX: Introduce a `@Matcher` on `Executable` and `ThrowingSupplier` expressions, such that they // XXX: Introduce a `@Matcher` on `Executable` and `ThrowingSupplier` expressions, such that they
// are only matched if they are also compatible with the `ThrowingCallable` functional interface. // are only matched if they are also compatible with the `ThrowingCallable` functional interface.
// When implementing such a matcher, note that expressions with a non-void return type such as // When implementing such a matcher, note that expressions with a non-void return type such as
@@ -45,7 +44,7 @@ import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
final class JUnitToAssertJRules { final class JUnitToAssertJRules {
private JUnitToAssertJRules() {} private JUnitToAssertJRules() {}
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Assertions.class, Assertions.class,
assertDoesNotThrow(() -> null), assertDoesNotThrow(() -> null),

View File

@@ -250,6 +250,7 @@ final class LongStreamRules {
/** Prefer {@link LongStream#anyMatch(LongPredicate)} over more contrived alternatives. */ /** Prefer {@link LongStream#anyMatch(LongPredicate)} over more contrived alternatives. */
static final class LongStreamAnyMatch { static final class LongStreamAnyMatch {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S4034" /* This violation will be rewritten. */)
boolean before(LongStream stream, LongPredicate predicate) { boolean before(LongStream stream, LongPredicate predicate) {
return Refaster.anyOf( return Refaster.anyOf(
!stream.noneMatch(predicate), stream.filter(predicate).findAny().isPresent()); !stream.noneMatch(predicate), stream.filter(predicate).findAny().isPresent());

View File

@@ -68,7 +68,10 @@ final class OptionalRules {
/** Prefer {@link Optional#orElseThrow()} over the less explicit {@link Optional#get()}. */ /** Prefer {@link Optional#orElseThrow()} over the less explicit {@link Optional#get()}. */
static final class OptionalOrElseThrow<T> { static final class OptionalOrElseThrow<T> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("NullAway") @SuppressWarnings({
"java:S3655" /* Matched expressions are in practice embedded in a larger context. */,
"NullAway"
})
T before(Optional<T> optional) { T before(Optional<T> optional) {
return optional.get(); return optional.get();
} }
@@ -304,14 +307,12 @@ final class OptionalRules {
abstract Optional<S> toOptionalFunction(@MayOptionallyUse T element); abstract Optional<S> toOptionalFunction(@MayOptionallyUse T element);
@BeforeTemplate @BeforeTemplate
Optional<R> before( Optional<R> before(Optional<T> optional, Function<? super S, Optional<? extends R>> function) {
Optional<T> optional, Function<? super S, ? extends Optional<? extends R>> function) {
return optional.flatMap(v -> toOptionalFunction(v).flatMap(function)); return optional.flatMap(v -> toOptionalFunction(v).flatMap(function));
} }
@AfterTemplate @AfterTemplate
Optional<R> after( Optional<R> after(Optional<T> optional, Function<? super S, Optional<? extends R>> function) {
Optional<T> optional, Function<? super S, ? extends Optional<? extends R>> function) {
return optional.flatMap(v -> toOptionalFunction(v)).flatMap(function); return optional.flatMap(v -> toOptionalFunction(v)).flatMap(function);
} }
} }

View File

@@ -91,6 +91,7 @@ final class PreconditionsRules {
/** Prefer {@link Objects#requireNonNull(Object)} over more verbose alternatives. */ /** Prefer {@link Objects#requireNonNull(Object)} over more verbose alternatives. */
static final class RequireNonNullStatement<T> { static final class RequireNonNullStatement<T> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1695" /* This violation will be rewritten. */)
void before(T object) { void before(T object) {
if (object == null) { if (object == null) {
throw new NullPointerException(); throw new NullPointerException();
@@ -121,6 +122,7 @@ final class PreconditionsRules {
/** Prefer {@link Objects#requireNonNull(Object, String)} over more verbose alternatives. */ /** Prefer {@link Objects#requireNonNull(Object, String)} over more verbose alternatives. */
static final class RequireNonNullWithMessageStatement<T> { static final class RequireNonNullWithMessageStatement<T> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1695" /* This violation will be rewritten. */)
void before(T object, String message) { void before(T object, String message) {
if (object == null) { if (object == null) {
throw new NullPointerException(message); throw new NullPointerException(message);

View File

@@ -13,6 +13,7 @@ final class PrimitiveRules {
/** Avoid contrived ways of expressing the "less than" relationship. */ /** Avoid contrived ways of expressing the "less than" relationship. */
static final class LessThan { static final class LessThan {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1940" /* This violation will be rewritten. */)
boolean before(double a, double b) { boolean before(double a, double b) {
return !(a >= b); return !(a >= b);
} }
@@ -26,6 +27,7 @@ final class PrimitiveRules {
/** Avoid contrived ways of expressing the "less than or equal to" relationship. */ /** Avoid contrived ways of expressing the "less than or equal to" relationship. */
static final class LessThanOrEqualTo { static final class LessThanOrEqualTo {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1940" /* This violation will be rewritten. */)
boolean before(double a, double b) { boolean before(double a, double b) {
return !(a > b); return !(a > b);
} }
@@ -39,6 +41,7 @@ final class PrimitiveRules {
/** Avoid contrived ways of expressing the "greater than" relationship. */ /** Avoid contrived ways of expressing the "greater than" relationship. */
static final class GreaterThan { static final class GreaterThan {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1940" /* This violation will be rewritten. */)
boolean before(double a, double b) { boolean before(double a, double b) {
return !(a <= b); return !(a <= b);
} }
@@ -52,6 +55,7 @@ final class PrimitiveRules {
/** Avoid contrived ways of expressing the "greater than or equal to" relationship. */ /** Avoid contrived ways of expressing the "greater than or equal to" relationship. */
static final class GreaterThanOrEqualTo { static final class GreaterThanOrEqualTo {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S1940" /* This violation will be rewritten. */)
boolean before(double a, double b) { boolean before(double a, double b) {
return !(a < b); return !(a < b);
} }

View File

@@ -620,6 +620,7 @@ final class ReactorRules {
abstract S transformation(@MayOptionallyUse T value); abstract S transformation(@MayOptionallyUse T value);
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S138" /* Method is long, but not complex. */)
Publisher<S> before(Flux<T> flux, boolean delayUntilEnd, int maxConcurrency, int prefetch) { Publisher<S> before(Flux<T> flux, boolean delayUntilEnd, int maxConcurrency, int prefetch) {
return Refaster.anyOf( return Refaster.anyOf(
flux.concatMap( flux.concatMap(

View File

@@ -316,6 +316,7 @@ final class StreamRules {
/** Prefer {@link Stream#noneMatch(Predicate)} over more contrived alternatives. */ /** Prefer {@link Stream#noneMatch(Predicate)} over more contrived alternatives. */
static final class StreamNoneMatch<T> { static final class StreamNoneMatch<T> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S4034" /* This violation will be rewritten. */)
boolean before(Stream<T> stream, Predicate<? super T> predicate) { boolean before(Stream<T> stream, Predicate<? super T> predicate) {
return Refaster.anyOf( return Refaster.anyOf(
!stream.anyMatch(predicate), !stream.anyMatch(predicate),
@@ -347,6 +348,7 @@ final class StreamRules {
/** Prefer {@link Stream#anyMatch(Predicate)} over more contrived alternatives. */ /** Prefer {@link Stream#anyMatch(Predicate)} over more contrived alternatives. */
static final class StreamAnyMatch<T> { static final class StreamAnyMatch<T> {
@BeforeTemplate @BeforeTemplate
@SuppressWarnings("java:S4034" /* This violation will be rewritten. */)
boolean before(Stream<T> stream, Predicate<? super T> predicate) { boolean before(Stream<T> stream, Predicate<? super T> predicate) {
return Refaster.anyOf( return Refaster.anyOf(
!stream.noneMatch(predicate), stream.filter(predicate).findAny().isPresent()); !stream.noneMatch(predicate), stream.filter(predicate).findAny().isPresent());

View File

@@ -2,6 +2,7 @@ package tech.picnic.errorprone.bugpatterns.util;
import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION; import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION;
import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.params.provider.Arguments.arguments;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.errorprone.BugPattern; import com.google.errorprone.BugPattern;
@@ -13,7 +14,11 @@ import com.google.errorprone.matchers.Description;
import com.google.errorprone.matchers.Matcher; import com.google.errorprone.matchers.Matcher;
import com.sun.source.tree.ExpressionTree; import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.MethodInvocationTree; import com.sun.source.tree.MethodInvocationTree;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
final class MethodMatcherFactoryTest { final class MethodMatcherFactoryTest {
private static final Matcher<ExpressionTree> TEST_MATCHER = private static final Matcher<ExpressionTree> TEST_MATCHER =
@@ -24,16 +29,20 @@ final class MethodMatcherFactoryTest {
"com.example.A#m2(java.lang.String)", "com.example.A#m2(java.lang.String)",
"com.example.sub.B#m3(int,int)")); "com.example.sub.B#m3(int,int)"));
@Test private static Stream<Arguments> createWithMalformedSignaturesTestCases() {
void createWithMalformedSignatures() { /* { signatures } */
return Stream.of(
arguments(ImmutableList.of("foo.bar")),
arguments(ImmutableList.of("foo.bar#baz")),
arguments(ImmutableList.of("a", "foo.bar#baz()")),
arguments(ImmutableList.of("foo.bar#baz()", "a")));
}
@MethodSource("createWithMalformedSignaturesTestCases")
@ParameterizedTest
void createWithMalformedSignatures(ImmutableList<String> signatures) {
MethodMatcherFactory factory = new MethodMatcherFactory(); MethodMatcherFactory factory = new MethodMatcherFactory();
assertThatThrownBy(() -> factory.create(ImmutableList.of("foo.bar"))) assertThatThrownBy(() -> factory.create(signatures))
.isInstanceOf(IllegalArgumentException.class);
assertThatThrownBy(() -> factory.create(ImmutableList.of("foo.bar#baz")))
.isInstanceOf(IllegalArgumentException.class);
assertThatThrownBy(() -> factory.create(ImmutableList.of("a", "foo.bar#baz()")))
.isInstanceOf(IllegalArgumentException.class);
assertThatThrownBy(() -> factory.create(ImmutableList.of("foo.bar#baz()", "a")))
.isInstanceOf(IllegalArgumentException.class); .isInstanceOf(IllegalArgumentException.class);
} }

View File

@@ -11,7 +11,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJBigDecimalRulesTest implements RefasterRuleCollectionTestCase { final class AssertJBigDecimalRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -11,7 +11,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJBigDecimalRulesTest implements RefasterRuleCollectionTestCase { final class AssertJBigDecimalRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -11,7 +11,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJBigIntegerRulesTest implements RefasterRuleCollectionTestCase { final class AssertJBigIntegerRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -11,7 +11,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJBigIntegerRulesTest implements RefasterRuleCollectionTestCase { final class AssertJBigIntegerRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJByteRulesTest implements RefasterRuleCollectionTestCase { final class AssertJByteRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJByteRulesTest implements RefasterRuleCollectionTestCase { final class AssertJByteRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJDoubleRulesTest implements RefasterRuleCollectionTestCase { final class AssertJDoubleRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(withPercentage(0)); return ImmutableSet.of(withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJDoubleRulesTest implements RefasterRuleCollectionTestCase { final class AssertJDoubleRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(withPercentage(0)); return ImmutableSet.of(withPercentage(0));
} }

View File

@@ -9,7 +9,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJEnumerableRulesTest implements RefasterRuleCollectionTestCase { final class AssertJEnumerableRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Iterables.class); return ImmutableSet.of(Iterables.class);
} }

View File

@@ -9,7 +9,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJEnumerableRulesTest implements RefasterRuleCollectionTestCase { final class AssertJEnumerableRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Iterables.class); return ImmutableSet.of(Iterables.class);
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJFloatRulesTest implements RefasterRuleCollectionTestCase { final class AssertJFloatRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(withPercentage(0)); return ImmutableSet.of(withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJFloatRulesTest implements RefasterRuleCollectionTestCase { final class AssertJFloatRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(withPercentage(0)); return ImmutableSet.of(withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJIntegerRulesTest implements RefasterRuleCollectionTestCase { final class AssertJIntegerRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJIntegerRulesTest implements RefasterRuleCollectionTestCase { final class AssertJIntegerRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJLongRulesTest implements RefasterRuleCollectionTestCase { final class AssertJLongRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJLongRulesTest implements RefasterRuleCollectionTestCase { final class AssertJLongRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -23,7 +23,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJMapRulesTest implements RefasterRuleCollectionTestCase { final class AssertJMapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
ArrayList.class, ArrayList.class,
HashMap.class, HashMap.class,

View File

@@ -23,7 +23,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJMapRulesTest implements RefasterRuleCollectionTestCase { final class AssertJMapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
ArrayList.class, ArrayList.class,
HashMap.class, HashMap.class,

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJShortRulesTest implements RefasterRuleCollectionTestCase { final class AssertJShortRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJShortRulesTest implements RefasterRuleCollectionTestCase { final class AssertJShortRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(offset(0), withPercentage(0)); return ImmutableSet.of(offset(0), withPercentage(0));
} }

View File

@@ -13,7 +13,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJStringRulesTest implements RefasterRuleCollectionTestCase { final class AssertJStringRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Files.class); return ImmutableSet.of(Files.class);
} }

View File

@@ -14,7 +14,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJStringRulesTest implements RefasterRuleCollectionTestCase { final class AssertJStringRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Files.class); return ImmutableSet.of(Files.class);
} }

View File

@@ -14,7 +14,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTestCase { final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
assertThatExceptionOfType(Throwable.class), assertThatExceptionOfType(Throwable.class),
assertThatIOException(), assertThatIOException(),

View File

@@ -15,7 +15,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTestCase { final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
assertThatExceptionOfType(Throwable.class), assertThatExceptionOfType(Throwable.class),
assertThatIOException(), assertThatIOException(),

View File

@@ -17,7 +17,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssortedRulesTest implements RefasterRuleCollectionTestCase { final class AssortedRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
HashSet.class, HashSet.class,
Iterables.class, Iterables.class,

View File

@@ -20,7 +20,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssortedRulesTest implements RefasterRuleCollectionTestCase { final class AssortedRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
HashSet.class, HashSet.class,
Iterables.class, Iterables.class,

View File

@@ -8,7 +8,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class BugCheckerRulesTest implements RefasterRuleCollectionTestCase { final class BugCheckerRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(FixChoosers.class); return ImmutableSet.of(FixChoosers.class);
} }

View File

@@ -8,7 +8,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class BugCheckerRulesTest implements RefasterRuleCollectionTestCase { final class BugCheckerRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(FixChoosers.class); return ImmutableSet.of(FixChoosers.class);
} }

View File

@@ -16,7 +16,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class CollectionRulesTest implements RefasterRuleCollectionTestCase { final class CollectionRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Iterables.class, Lists.class); return ImmutableSet.of(Iterables.class, Lists.class);
} }

View File

@@ -16,7 +16,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class CollectionRulesTest implements RefasterRuleCollectionTestCase { final class CollectionRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Iterables.class, Lists.class); return ImmutableSet.of(Iterables.class, Lists.class);
} }

View File

@@ -16,7 +16,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ComparatorRulesTest implements RefasterRuleCollectionTestCase { final class ComparatorRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Arrays.class, Arrays.class,
Collections.class, Collections.class,

View File

@@ -16,7 +16,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ComparatorRulesTest implements RefasterRuleCollectionTestCase { final class ComparatorRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Arrays.class, Arrays.class,
Collections.class, Collections.class,

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class DoubleStreamRulesTest implements RefasterRuleCollectionTestCase { final class DoubleStreamRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Streams.class); return ImmutableSet.of(Streams.class);
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class DoubleStreamRulesTest implements RefasterRuleCollectionTestCase { final class DoubleStreamRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Streams.class); return ImmutableSet.of(Streams.class);
} }

View File

@@ -9,7 +9,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class EqualityRulesTest implements RefasterRuleCollectionTestCase { final class EqualityRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Objects.class); return ImmutableSet.of(Objects.class);
} }

View File

@@ -9,7 +9,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class EqualityRulesTest implements RefasterRuleCollectionTestCase { final class EqualityRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Objects.class); return ImmutableSet.of(Objects.class);
} }

View File

@@ -20,7 +20,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableListMultimapRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableListMultimapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Streams.class, flatteningToImmutableListMultimap(null, null), identity()); Streams.class, flatteningToImmutableListMultimap(null, null), identity());
} }

View File

@@ -20,7 +20,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableListMultimapRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableListMultimapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Streams.class, flatteningToImmutableListMultimap(null, null), identity()); Streams.class, flatteningToImmutableListMultimap(null, null), identity());
} }

View File

@@ -15,7 +15,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableListRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableListRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Arrays.class, Collections.class, Comparator.class, Streams.class, naturalOrder()); Arrays.class, Collections.class, Comparator.class, Streams.class, naturalOrder());
} }

View File

@@ -16,7 +16,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableListRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableListRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Arrays.class, Collections.class, Comparator.class, Streams.class, naturalOrder()); Arrays.class, Collections.class, Comparator.class, Streams.class, naturalOrder());
} }

View File

@@ -16,7 +16,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableMapRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableMapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Collections.class, Streams.class, identity()); return ImmutableSet.of(Collections.class, Streams.class, identity());
} }

View File

@@ -16,7 +16,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableMapRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableMapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Collections.class, Streams.class, identity()); return ImmutableSet.of(Collections.class, Streams.class, identity());
} }

View File

@@ -12,7 +12,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableMultisetRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableMultisetRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Arrays.class, Streams.class); return ImmutableSet.of(Arrays.class, Streams.class);
} }

View File

@@ -12,7 +12,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableMultisetRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableMultisetRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Arrays.class, Streams.class); return ImmutableSet.of(Arrays.class, Streams.class);
} }

View File

@@ -17,7 +17,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSetMultimapRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSetMultimapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Streams.class, flatteningToImmutableSetMultimap(null, null)); return ImmutableSet.of(Streams.class, flatteningToImmutableSetMultimap(null, null));
} }

View File

@@ -17,7 +17,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSetMultimapRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSetMultimapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Streams.class, flatteningToImmutableSetMultimap(null, null)); return ImmutableSet.of(Streams.class, flatteningToImmutableSetMultimap(null, null));
} }

View File

@@ -14,7 +14,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSetRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSetRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Arrays.class, Collections.class, Streams.class); return ImmutableSet.of(Arrays.class, Collections.class, Streams.class);
} }

View File

@@ -14,7 +14,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSetRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSetRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Arrays.class, Collections.class, Streams.class); return ImmutableSet.of(Arrays.class, Collections.class, Streams.class);
} }

View File

@@ -14,7 +14,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSortedMapRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSortedMapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Stream.class, Streams.class, naturalOrder(), toImmutableSortedMap(null, null, null)); Stream.class, Streams.class, naturalOrder(), toImmutableSortedMap(null, null, null));
} }

View File

@@ -14,7 +14,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSortedMapRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSortedMapRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Stream.class, Streams.class, naturalOrder(), toImmutableSortedMap(null, null, null)); Stream.class, Streams.class, naturalOrder(), toImmutableSortedMap(null, null, null));
} }

View File

@@ -15,7 +15,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSortedMultisetRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSortedMultisetRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Arrays.class, Streams.class); return ImmutableSet.of(Arrays.class, Streams.class);
} }

View File

@@ -15,7 +15,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSortedMultisetRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSortedMultisetRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Arrays.class, Streams.class); return ImmutableSet.of(Arrays.class, Streams.class);
} }

View File

@@ -14,7 +14,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSortedSetRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSortedSetRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Arrays.class, Streams.class); return ImmutableSet.of(Arrays.class, Streams.class);
} }

View File

@@ -14,7 +14,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class ImmutableSortedSetRulesTest implements RefasterRuleCollectionTestCase { final class ImmutableSortedSetRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Arrays.class, Streams.class); return ImmutableSet.of(Arrays.class, Streams.class);
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class IntStreamRulesTest implements RefasterRuleCollectionTestCase { final class IntStreamRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Streams.class); return ImmutableSet.of(Streams.class);
} }

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class IntStreamRulesTest implements RefasterRuleCollectionTestCase { final class IntStreamRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Streams.class); return ImmutableSet.of(Streams.class);
} }

View File

@@ -17,7 +17,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase { final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Assertions.class, Assertions.class,
assertDoesNotThrow(() -> null), assertDoesNotThrow(() -> null),

View File

@@ -21,7 +21,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase { final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of( return ImmutableSet.of(
Assertions.class, Assertions.class,
assertDoesNotThrow(() -> null), assertDoesNotThrow(() -> null),

View File

@@ -10,7 +10,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class LongStreamRulesTest implements RefasterRuleCollectionTestCase { final class LongStreamRulesTest implements RefasterRuleCollectionTestCase {
@Override @Override
public ImmutableSet<?> elidedTypesAndStaticImports() { public ImmutableSet<Object> elidedTypesAndStaticImports() {
return ImmutableSet.of(Streams.class); return ImmutableSet.of(Streams.class);
} }

Some files were not shown because too many files have changed in this diff Show More