Format and turn back on refaster checks

This commit is contained in:
Rick Ossendrijver
2021-02-15 11:34:48 +01:00
committed by Stephan Schroevers
parent 0cbcdb8c8b
commit a3c828fe94
2 changed files with 57 additions and 52 deletions

View File

@@ -1,5 +1,10 @@
package tech.picnic.errorprone.bugpatterns;
import static com.google.errorprone.matchers.ChildMultiMatcher.MatchType.AT_LEAST_ONE;
import static com.google.errorprone.matchers.Matchers.annotations;
import static com.google.errorprone.matchers.Matchers.anyOf;
import static com.google.errorprone.matchers.Matchers.isType;
import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.BugPattern.LinkType;
@@ -15,15 +20,9 @@ import com.sun.source.tree.AnnotationTree;
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.Tree;
import java.util.ArrayList;
import java.util.List;
import static com.google.errorprone.matchers.ChildMultiMatcher.MatchType.AT_LEAST_ONE;
import static com.google.errorprone.matchers.Matchers.annotations;
import static com.google.errorprone.matchers.Matchers.isType;
import static com.google.errorprone.matchers.Matchers.anyOf;
/** A {@link BugChecker} which flags probable missing Refaster annotations. */
@AutoService(BugChecker.class)
@BugPattern(
@@ -57,6 +56,12 @@ public final class MissingRefasterAnnotationCheck extends BugChecker implements
}
}
// tree.getMembers().stream()
// .filter(member -> member instanceof MethodTree &&
// !ASTHelpers.getSymbol((MethodTree) tree).isConstructor())
// .forEach(member -> HAS_REFASTER_ANNOTATION.matches(member, state) ?
// refasterAnnotatedMethods.add((MethodTree)member) : normalMethods.add((MethodTree)member));
if (refasterAnnotatedMethods.isEmpty() || normalMethods.isEmpty()) {
return Description.NO_MATCH;
}

View File

@@ -25,52 +25,52 @@ public final class RefasterCheckTest {
/** The names of all Refaster template groups defined in this module. */
private static final ImmutableSet<String> TEMPLATE_GROUPS =
ImmutableSet.of(
"AssertJ");
// "AssertJBigDecimal",
// "AssertJBigInteger",
// "AssertJBoolean",
// "AssertJByte",
// "AssertJCharSequence",
// "AssertJDouble",
// "AssertJEnumerable",
// "AssertJFloat",
// "AssertJInteger",
// "AssertJLong",
// "AssertJNumber",
// "AssertJObject",
// "AssertJOptional",
// "AssertJShort",
// "AssertJString",
// "Assorted",
// "BigDecimal",
// "Collection",
// "Comparator",
// "DoubleStream",
// "Equality",
// "ImmutableList",
// "ImmutableListMultimap",
// "ImmutableMap",
// "ImmutableMultiset",
// "ImmutableSet",
// "ImmutableSetMultimap",
// "ImmutableSortedMap",
// "ImmutableSortedMultiset",
// "ImmutableSortedSet",
// "IntStream",
// "JUnit",
// "LongStream",
// "MapEntry",
// "Mockito",
// "Multimap",
// "Null",
// "Optional",
// "Primitive",
// "Reactor",
// "RxJava2Adapter",
// "Stream",
// "String",
// "TestNGToAssertJ",
// "Time");
"AssertJ",
"AssertJBigDecimal",
"AssertJBigInteger",
"AssertJBoolean",
"AssertJByte",
"AssertJCharSequence",
"AssertJDouble",
"AssertJEnumerable",
"AssertJFloat",
"AssertJInteger",
"AssertJLong",
"AssertJNumber",
"AssertJObject",
"AssertJOptional",
"AssertJShort",
"AssertJString",
"Assorted",
"BigDecimal",
"Collection",
"Comparator",
"DoubleStream",
"Equality",
"ImmutableList",
"ImmutableListMultimap",
"ImmutableMap",
"ImmutableMultiset",
"ImmutableSet",
"ImmutableSetMultimap",
"ImmutableSortedMap",
"ImmutableSortedMultiset",
"ImmutableSortedSet",
"IntStream",
"JUnit",
"LongStream",
"MapEntry",
"Mockito",
"Multimap",
"Null",
"Optional",
"Primitive",
"Reactor",
"RxJava2Adapter",
"Stream",
"String",
"TestNGToAssertJ",
"Time");
/**
* Matches the parts of the fully-qualified name of a template class that should be removed in
* order to produce the associated {@link #TEMPLATE_GROUPS template group name}.