Skip to content

Commit d171e37

Browse files
committed
Fix quality flaw: rename MethodInvocationMatcherCollection to MethodMatcherCollection
1 parent 47ca32b commit d171e37

19 files changed

Lines changed: 76 additions & 76 deletions

java-checks/src/main/java/org/sonar/java/checks/AbsOnNegativeCheck.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.sonar.api.server.rule.RulesDefinition;
2424
import org.sonar.check.Priority;
2525
import org.sonar.check.Rule;
26-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
26+
import org.sonar.java.matcher.MethodMatcherCollection;
2727
import org.sonar.java.matcher.MethodMatcher;
2828
import org.sonar.java.matcher.TypeCriteria;
2929
import org.sonar.java.tag.Tag;
@@ -55,7 +55,7 @@
5555
@SqaleConstantRemediation("5min")
5656
public class AbsOnNegativeCheck extends IssuableSubscriptionVisitor {
5757

58-
private static final MethodInvocationMatcherCollection MATH_ABS_METHODS = MethodInvocationMatcherCollection.create(
58+
private static final MethodMatcherCollection MATH_ABS_METHODS = MethodMatcherCollection.create(
5959
MethodMatcher.create()
6060
.typeDefinition("java.lang.Math")
6161
.name("abs")
@@ -66,7 +66,7 @@ public class AbsOnNegativeCheck extends IssuableSubscriptionVisitor {
6666
.addParameter("long")
6767
);
6868

69-
private static final MethodInvocationMatcherCollection NEGATIVE_METHODS = MethodInvocationMatcherCollection.create(
69+
private static final MethodMatcherCollection NEGATIVE_METHODS = MethodMatcherCollection.create(
7070
MethodMatcher.create()
7171
.name("hashCode"),
7272
MethodMatcher.create()

java-checks/src/main/java/org/sonar/java/checks/AssertionsCompletenessCheck.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.sonar.api.server.rule.RulesDefinition;
2424
import org.sonar.check.Priority;
2525
import org.sonar.check.Rule;
26-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
26+
import org.sonar.java.matcher.MethodMatcherCollection;
2727
import org.sonar.java.matcher.MethodMatcher;
2828
import org.sonar.java.matcher.NameCriteria;
2929
import org.sonar.java.matcher.TypeCriteria;
@@ -50,7 +50,7 @@ public class AssertionsCompletenessCheck extends BaseTreeVisitor implements Java
5050

5151
private static final MethodMatcher MOCKITO_VERIFY = MethodMatcher.create()
5252
.typeDefinition("org.mockito.Mockito").name("verify").withNoParameterConstraint();
53-
private static final MethodInvocationMatcherCollection FEST_LIKE_ASSERT_THAT = MethodInvocationMatcherCollection.create(
53+
private static final MethodMatcherCollection FEST_LIKE_ASSERT_THAT = MethodMatcherCollection.create(
5454
// Fest 1.X
5555
assertThatOnType("org.fest.assertions.Assertions"),
5656
// Fest 2.X
@@ -68,7 +68,7 @@ private static MethodMatcher assertThatOnType(String type) {
6868
return MethodMatcher.create().typeDefinition(type).name("assertThat").addParameter(TypeCriteria.anyType());
6969
}
7070

71-
private static final MethodInvocationMatcherCollection FEST_LIKE_EXCLUSIONS = MethodInvocationMatcherCollection.create(
71+
private static final MethodMatcherCollection FEST_LIKE_EXCLUSIONS = MethodMatcherCollection.create(
7272
methodWithName(NameCriteria.startsWith("as")),
7373
methodWithName(NameCriteria.startsWith("using")),
7474
methodWithName(NameCriteria.startsWith("with")),

java-checks/src/main/java/org/sonar/java/checks/AssertionsInTestsCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.sonar.api.server.rule.RulesDefinition;
2323
import org.sonar.check.Priority;
2424
import org.sonar.check.Rule;
25-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
25+
import org.sonar.java.matcher.MethodMatcherCollection;
2626
import org.sonar.java.matcher.MethodMatcher;
2727
import org.sonar.java.matcher.NameCriteria;
2828
import org.sonar.java.matcher.TypeCriteria;
@@ -67,7 +67,7 @@ public class AssertionsInTestsCheck extends BaseTreeVisitor implements JavaFileS
6767
.typeDefinition(TypeCriteria.anyType()).name("describedAs").withNoParameterConstraint();
6868
private static final MethodMatcher FEST_OVERRIDE_ERROR_METHOD = MethodMatcher.create()
6969
.typeDefinition(TypeCriteria.anyType()).name("overridingErrorMessage").withNoParameterConstraint();
70-
private static final MethodInvocationMatcherCollection ASSERTION_INVOCATION_MATCHERS = MethodInvocationMatcherCollection.create(
70+
private static final MethodMatcherCollection ASSERTION_INVOCATION_MATCHERS = MethodMatcherCollection.create(
7171
MethodMatcher.create().typeDefinition("org.junit.Assert").name(NameCriteria.startsWith("assert")).withNoParameterConstraint(),
7272
MethodMatcher.create().typeDefinition("org.junit.Assert").name("fail").withNoParameterConstraint(),
7373
MethodMatcher.create().typeDefinition("org.junit.rules.ExpectedException").name(NameCriteria.startsWith("expect")).withNoParameterConstraint(),

java-checks/src/main/java/org/sonar/java/checks/CatchOfThrowableOrErrorCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.sonar.api.server.rule.RulesDefinition;
2424
import org.sonar.check.Priority;
2525
import org.sonar.check.Rule;
26-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
26+
import org.sonar.java.matcher.MethodMatcherCollection;
2727
import org.sonar.java.matcher.MethodMatcher;
2828
import org.sonar.java.tag.Tag;
2929
import org.sonar.plugins.java.api.IssuableSubscriptionVisitor;
@@ -101,7 +101,7 @@ private void insertIssue(TypeTree typeTree, Type type) {
101101

102102
private static class GuavaCloserRethrowVisitor extends BaseTreeVisitor {
103103
private static final String JAVA_LANG_CLASS = "java.lang.Class";
104-
private static final MethodInvocationMatcherCollection MATCHERS = MethodInvocationMatcherCollection.create(
104+
private static final MethodMatcherCollection MATCHERS = MethodMatcherCollection.create(
105105
rethrowMethod(),
106106
rethrowMethod().addParameter(JAVA_LANG_CLASS),
107107
rethrowMethod().addParameter(JAVA_LANG_CLASS).addParameter(JAVA_LANG_CLASS));

java-checks/src/main/java/org/sonar/java/checks/ClassComparedByNameCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.sonar.check.Priority;
2626
import org.sonar.check.Rule;
2727
import org.sonar.java.checks.methods.AbstractMethodDetection;
28-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
28+
import org.sonar.java.matcher.MethodMatcherCollection;
2929
import org.sonar.java.matcher.MethodMatcher;
3030
import org.sonar.java.tag.Tag;
3131
import org.sonar.plugins.java.api.tree.BaseTreeVisitor;
@@ -77,7 +77,7 @@ private static class ClassGetNameDetector extends BaseTreeVisitor {
7777
private boolean useClassGetName = false;
7878
private boolean useStackTraceElementGetClassName = false;
7979

80-
private final MethodInvocationMatcherCollection methodMatchers = MethodInvocationMatcherCollection.create(
80+
private final MethodMatcherCollection methodMatchers = MethodMatcherCollection.create(
8181
MethodMatcher.create().typeDefinition("java.lang.Class").name("getName"),
8282
MethodMatcher.create().typeDefinition("java.lang.Class").name("getSimpleName"));
8383

java-checks/src/main/java/org/sonar/java/checks/ConstantMathCheck.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.sonar.check.Priority;
2525
import org.sonar.check.Rule;
2626
import org.sonar.java.checks.helpers.ExpressionsHelper;
27-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
27+
import org.sonar.java.matcher.MethodMatcherCollection;
2828
import org.sonar.java.matcher.MethodMatcher;
2929
import org.sonar.java.model.LiteralUtils;
3030
import org.sonar.java.resolve.JavaType;
@@ -64,14 +64,14 @@ public class ConstantMathCheck extends IssuableSubscriptionVisitor implements Ja
6464
private static final String MATH_PACKAGE_NAME = "java.lang.Math";
6565
private static final String ROUND = "round";
6666

67-
private static final MethodInvocationMatcherCollection CONSTANT_WITH_LITERAL_METHODS = MethodInvocationMatcherCollection.create(
67+
private static final MethodMatcherCollection CONSTANT_WITH_LITERAL_METHODS = MethodMatcherCollection.create(
6868
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name(ABS).addParameter(DOUBLE),
6969
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name(ABS).addParameter(FLOAT),
7070
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name(ABS).addParameter("int"),
7171
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name(ABS).addParameter("long")
7272
);
7373

74-
private static final MethodInvocationMatcherCollection TRUNCATION_METHODS = MethodInvocationMatcherCollection.create(
74+
private static final MethodMatcherCollection TRUNCATION_METHODS = MethodMatcherCollection.create(
7575
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name(CEIL).addParameter(DOUBLE),
7676
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name(CEIL).addParameter(FLOAT),
7777
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name(FLOOR).addParameter(DOUBLE),
@@ -81,7 +81,7 @@ public class ConstantMathCheck extends IssuableSubscriptionVisitor implements Ja
8181
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name(ROUND).addParameter(FLOAT)
8282
);
8383

84-
private static final MethodInvocationMatcherCollection CONSTANT_WITH_ZERO_METHODS = MethodInvocationMatcherCollection.create(
84+
private static final MethodMatcherCollection CONSTANT_WITH_ZERO_METHODS = MethodMatcherCollection.create(
8585
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name("atan2").addParameter(DOUBLE).addParameter(DOUBLE),
8686
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name("cos").addParameter(DOUBLE),
8787
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name("cosh").addParameter(DOUBLE),
@@ -93,7 +93,7 @@ public class ConstantMathCheck extends IssuableSubscriptionVisitor implements Ja
9393
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name("toRadians").addParameter(DOUBLE)
9494
);
9595

96-
private static final MethodInvocationMatcherCollection CONSTANT_WITH_ZERO_OR_ONE_METHODS = MethodInvocationMatcherCollection.create(
96+
private static final MethodMatcherCollection CONSTANT_WITH_ZERO_OR_ONE_METHODS = MethodMatcherCollection.create(
9797
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name("acos").addParameter(DOUBLE),
9898
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name("asin").addParameter(DOUBLE),
9999
MethodMatcher.create().typeDefinition(MATH_PACKAGE_NAME).name("atan").addParameter(DOUBLE),

java-checks/src/main/java/org/sonar/java/checks/DataStoredInSessionCheck.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.sonar.check.Rule;
2727
import org.sonar.java.checks.helpers.ReassignmentFinder;
2828
import org.sonar.java.checks.methods.AbstractMethodDetection;
29-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
29+
import org.sonar.java.matcher.MethodMatcherCollection;
3030
import org.sonar.java.matcher.MethodMatcher;
3131
import org.sonar.java.matcher.NameCriteria;
3232
import org.sonar.java.matcher.TypeCriteria;
@@ -57,11 +57,11 @@ public class DataStoredInSessionCheck extends AbstractMethodDetection {
5757

5858
private Set<IdentifierTree> identifiersUsedToSetAttribute;
5959

60-
private static final MethodInvocationMatcherCollection REQUEST_OR_COOKIE_DATA_RETRIEVAL = MethodInvocationMatcherCollection.create(
60+
private static final MethodMatcherCollection REQUEST_OR_COOKIE_DATA_RETRIEVAL = MethodMatcherCollection.create(
6161
MethodMatcher.create().typeDefinition("javax.servlet.http.Cookie").name(NameCriteria.startsWith("get")).withNoParameterConstraint(),
6262
MethodMatcher.create().callSite(TypeCriteria.is("javax.servlet.http.HttpServletRequest")).name(NameCriteria.startsWith("get")).withNoParameterConstraint());
6363

64-
private static final MethodInvocationMatcherCollection NO_EFFECT_OPERATION = MethodInvocationMatcherCollection.create(
64+
private static final MethodMatcherCollection NO_EFFECT_OPERATION = MethodMatcherCollection.create(
6565
MethodMatcher.create().typeDefinition("java.net.URLDecoder").name("decode").withNoParameterConstraint(),
6666
MethodMatcher.create().typeDefinition("org.apache.commons.lang.StringEscapeUtils").name("escapeHtml").withNoParameterConstraint());
6767

java-checks/src/main/java/org/sonar/java/checks/IgnoredStreamReturnValueCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.sonar.check.Priority;
2525
import org.sonar.check.Rule;
2626
import org.sonar.java.checks.helpers.MethodsHelper;
27-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
27+
import org.sonar.java.matcher.MethodMatcherCollection;
2828
import org.sonar.java.matcher.MethodMatcher;
2929
import org.sonar.java.matcher.TypeCriteria;
3030
import org.sonar.java.tag.Tag;
@@ -50,7 +50,7 @@
5050
@SqaleConstantRemediation("15min")
5151
public class IgnoredStreamReturnValueCheck extends IssuableSubscriptionVisitor {
5252

53-
private static final MethodInvocationMatcherCollection MATCHERS = MethodInvocationMatcherCollection.create(
53+
private static final MethodMatcherCollection MATCHERS = MethodMatcherCollection.create(
5454
inputStreamInvocationMatcher("skip", "long"),
5555
inputStreamInvocationMatcher("read", "byte[]"));
5656

java-checks/src/main/java/org/sonar/java/checks/ImmediateReverseBoxingCheck.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.sonar.api.server.rule.RulesDefinition;
2525
import org.sonar.check.Priority;
2626
import org.sonar.check.Rule;
27-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
27+
import org.sonar.java.matcher.MethodMatcherCollection;
2828
import org.sonar.java.matcher.MethodMatcher;
2929
import org.sonar.java.matcher.TypeCriteria;
3030
import org.sonar.java.tag.Tag;
@@ -69,8 +69,8 @@ public class ImmediateReverseBoxingCheck extends IssuableSubscriptionVisitor {
6969
.put("java.lang.Character", "char")
7070
.build();
7171

72-
private static final MethodInvocationMatcherCollection unboxingInvocationMatchers = unboxingInvocationMatchers();
73-
private static final MethodInvocationMatcherCollection valueOfInvocationMatchers = valueOfInvocationMatchers();
72+
private static final MethodMatcherCollection unboxingInvocationMatchers = unboxingInvocationMatchers();
73+
private static final MethodMatcherCollection valueOfInvocationMatchers = valueOfInvocationMatchers();
7474

7575
@Override
7676
public List<Kind> nodesToVisit() {
@@ -202,8 +202,8 @@ private void addUnboxingIssue(ExpressionTree expressionTree, ExpressionTree expr
202202
}
203203
}
204204

205-
private static MethodInvocationMatcherCollection unboxingInvocationMatchers() {
206-
MethodInvocationMatcherCollection matchers = MethodInvocationMatcherCollection.create();
205+
private static MethodMatcherCollection unboxingInvocationMatchers() {
206+
MethodMatcherCollection matchers = MethodMatcherCollection.create();
207207
for (Entry<String, String> type : PRIMITIVE_TYPES_BY_WRAPPER.entrySet()) {
208208
String primitiveType = type.getValue();
209209
TypeCriteria typeCriteria;
@@ -217,8 +217,8 @@ private static MethodInvocationMatcherCollection unboxingInvocationMatchers() {
217217
return matchers;
218218
}
219219

220-
private static MethodInvocationMatcherCollection valueOfInvocationMatchers() {
221-
MethodInvocationMatcherCollection matchers = MethodInvocationMatcherCollection.create();
220+
private static MethodMatcherCollection valueOfInvocationMatchers() {
221+
MethodMatcherCollection matchers = MethodMatcherCollection.create();
222222
for (Entry<String, String> primitiveMapping : PRIMITIVE_TYPES_BY_WRAPPER.entrySet()) {
223223
matchers.add(
224224
MethodMatcher.create()

java-checks/src/main/java/org/sonar/java/checks/IndexOfWithPositiveNumberCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.sonar.api.server.rule.RulesDefinition;
2424
import org.sonar.check.Priority;
2525
import org.sonar.check.Rule;
26-
import org.sonar.java.matcher.MethodInvocationMatcherCollection;
26+
import org.sonar.java.matcher.MethodMatcherCollection;
2727
import org.sonar.java.matcher.MethodMatcher;
2828
import org.sonar.java.matcher.TypeCriteria;
2929
import org.sonar.java.model.LiteralUtils;
@@ -53,7 +53,7 @@ public class IndexOfWithPositiveNumberCheck extends IssuableSubscriptionVisitor
5353

5454
private static final String INDEXOF = "indexOf";
5555

56-
private static final MethodInvocationMatcherCollection CHECKED_METHODS = MethodInvocationMatcherCollection.create(
56+
private static final MethodMatcherCollection CHECKED_METHODS = MethodMatcherCollection.create(
5757
MethodMatcher.create()
5858
.typeDefinition(String.class.getName())
5959
.name(INDEXOF)

0 commit comments

Comments
 (0)