Skip to content

Commit

Permalink
Remove redundant type arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
leonard84 committed Feb 16, 2022
1 parent c4a334b commit e9401a7
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static List<Statement> getStatements(MethodNode method) {
public static List<Statement> getStatements(ClosureExpression closure) {
BlockStatement blockStat = (BlockStatement)closure.getCode();
return blockStat == null ?
Collections.<Statement> emptyList() : // it's not possible to add any statements to such a ClosureExpression, so immutable list is OK
Collections.emptyList() : // it's not possible to add any statements to such a ClosureExpression, so immutable list is OK
blockStat.getStatements();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ private TryCatchStatement surroundSpecialTryCatch(Expression executeAndVerify) {
createDirectMethodCall(
new ClassExpression(resources.getAstNodeCache().SpockRuntime),
resources.getAstNodeCache().SpockRuntime_GroupConditionFailedWithException,
new ArgumentListExpression(Arrays.<Expression>asList(
new ArgumentListExpression(Arrays.asList(
new VariableExpression(errorCollectorName),
new VariableExpression(THROWABLE) // throwable
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private void createBuilder() {
builderExpr = new ConstructorCallExpression(
resources.getAstNodeCache().InteractionBuilder,
new ArgumentListExpression(
Arrays.<Expression> asList(
Arrays.asList(
new ConstantExpression(expr.getLineNumber()),
new ConstantExpression(expr.getColumnNumber()),
new ConstantExpression(resources.getSourceText(expr)))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public void visitCleanupBlock(CleanupBlock block) {

CatchStatement featureCatchStat = createThrowableAssignmentAndRethrowCatchStatement(featureThrowableVar);

List<Statement> cleanupStats = Collections.<Statement>singletonList(
List<Statement> cleanupStats = Collections.singletonList(
createCleanupTryCatch(block, featureThrowableVar));

TryCatchStatement tryFinally =
Expand Down Expand Up @@ -558,21 +558,21 @@ private CatchStatement createHandleSuppressedThrowableStatement(VariableExpressi
BinaryExpression featureThrowableNotNullExpr = createVariableNotNullExpression(featureThrowableVar);

List<Statement> addSuppressedStats =
Collections.<Statement>singletonList(new ExpressionStatement(
Collections.singletonList(new ExpressionStatement(
createDirectMethodCall(
featureThrowableVar,
nodeCache.Throwable_AddSuppressed,
new ArgumentListExpression(new VariableExpression(catchParameter)))));
List<Statement> throwFeatureStats =
Collections.<Statement>singletonList(new ThrowStatement(new VariableExpression(catchParameter)));
Collections.singletonList(new ThrowStatement(new VariableExpression(catchParameter)));

IfStatement ifFeatureNotNullStat = new IfStatement(new BooleanExpression(featureThrowableNotNullExpr),
new BlockStatement(addSuppressedStats, null),
new BlockStatement(throwFeatureStats, null));

return new CatchStatement(catchParameter,
new BlockStatement(
Collections.<Statement>singletonList(ifFeatureNotNullStat),
Collections.singletonList(ifFeatureNotNullStat),
null));
}

Expand Down Expand Up @@ -757,7 +757,7 @@ private void rewriteWhenBlockForExceptionCondition(WhenBlock block) {
new CatchStatement(
new Parameter(nodeCache.Throwable, SpockNames.SPOCK_EX),
new BlockStatement(
Arrays.<Statement>asList(
Arrays.asList(
new ExpressionStatement(
setThrownException(
new VariableExpression(SpockNames.SPOCK_EX)))),
Expand Down
50 changes: 25 additions & 25 deletions spock-core/src/main/java/org/spockframework/lang/SpecInternals.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ Throwable checkExceptionThrown(Class<? extends Throwable> exceptionType) {
}

Object MockImpl(String inferredName, Class<?> inferredType) {
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), null, null);
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, Collections.emptyMap(), null, null);
}

Object MockImpl(String inferredName, Class<?> inferredType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), null, closure);
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, Collections.emptyMap(), null, closure);
}

Object MockImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) {
Expand All @@ -98,11 +98,11 @@ Object MockImpl(String inferredName, Class<?> inferredType, Map<String, Object>
}

Object MockImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType) {
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), specifiedType, null);
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, Collections.emptyMap(), specifiedType, null);
}

Object MockImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), specifiedType, closure);
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, Collections.emptyMap(), specifiedType, closure);
}

Object MockImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) {
Expand All @@ -114,11 +114,11 @@ Object MockImpl(String inferredName, Class<?> inferredType, Map<String, Object>
}

Object StubImpl(String inferredName, Class<?> inferredType) {
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), null, null);
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.JAVA, Collections.emptyMap(), null, null);
}

Object StubImpl(String inferredName, Class<?> inferredType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), null, closure);
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.JAVA, Collections.emptyMap(), null, closure);
}

Object StubImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) {
Expand All @@ -130,11 +130,11 @@ Object StubImpl(String inferredName, Class<?> inferredType, Map<String, Object>
}

Object StubImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType) {
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), specifiedType, null);
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.JAVA, Collections.emptyMap(), specifiedType, null);
}

Object StubImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), specifiedType, closure);
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.JAVA, Collections.emptyMap(), specifiedType, closure);
}

Object StubImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) {
Expand All @@ -146,11 +146,11 @@ Object StubImpl(String inferredName, Class<?> inferredType, Map<String, Object>
}

Object SpyImpl(String inferredName, Class<?> inferredType) {
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), null, null);
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, Collections.emptyMap(), null, null);
}

Object SpyImpl(String inferredName, Class<?> inferredType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), null, closure);
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, Collections.emptyMap(), null, closure);
}

Object SpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) {
Expand All @@ -162,11 +162,11 @@ Object SpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> o
}

Object SpyImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType) {
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), specifiedType, null);
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, Collections.emptyMap(), specifiedType, null);
}

Object SpyImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, Collections.<String, Object>emptyMap(), specifiedType, closure);
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, Collections.emptyMap(), specifiedType, closure);
}

Object SpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) {
Expand All @@ -188,15 +188,15 @@ Object SpyImpl(String inferredName, Class<?> inferredType, Object instance, Clos
if (MOCK_UTIL.isMock(instance)) {
throw new SpockException("Spy instance may not be another mock object.");
}
return createMockImpl(inferredName, instance.getClass(), instance, MockNature.SPY, MockImplementation.JAVA, Collections.<String, Object>singletonMap("useObjenesis", true), null, closure);
return createMockImpl(inferredName, instance.getClass(), instance, MockNature.SPY, MockImplementation.JAVA, Collections.singletonMap("useObjenesis", true), null, closure);
}

Object GroovyMockImpl(String inferredName, Class<?> inferredType) {
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), null, null);
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, Collections.emptyMap(), null, null);
}

Object GroovyMockImpl(String inferredName, Class<?> inferredType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), null, closure);
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, Collections.emptyMap(), null, closure);
}

Object GroovyMockImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) {
Expand All @@ -208,11 +208,11 @@ Object GroovyMockImpl(String inferredName, Class<?> inferredType, Map<String, Ob
}

Object GroovyMockImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType) {
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), specifiedType, null);
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, Collections.emptyMap(), specifiedType, null);
}

Object GroovyMockImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), specifiedType, closure);
return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, Collections.emptyMap(), specifiedType, closure);
}

Object GroovyMockImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) {
Expand All @@ -224,11 +224,11 @@ Object GroovyMockImpl(String inferredName, Class<?> inferredType, Map<String, Ob
}

Object GroovyStubImpl(String inferredName, Class<?> inferredType) {
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), null, null);
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, Collections.emptyMap(), null, null);
}

Object GroovyStubImpl(String inferredName, Class<?> inferredType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), null, closure);
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, Collections.emptyMap(), null, closure);
}

Object GroovyStubImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) {
Expand All @@ -240,11 +240,11 @@ Object GroovyStubImpl(String inferredName, Class<?> inferredType, Map<String, Ob
}

Object GroovyStubImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType) {
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), specifiedType, null);
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, Collections.emptyMap(), specifiedType, null);
}

Object GroovyStubImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), specifiedType, closure);
return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, Collections.emptyMap(), specifiedType, closure);
}

Object GroovyStubImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) {
Expand All @@ -256,11 +256,11 @@ Object GroovyStubImpl(String inferredName, Class<?> inferredType, Map<String, Ob
}

Object GroovySpyImpl(String inferredName, Class<?> inferredType) {
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), null, null);
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, Collections.emptyMap(), null, null);
}

Object GroovySpyImpl(String inferredName, Class<?> inferredType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), null, closure);
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, Collections.emptyMap(), null, closure);
}

Object GroovySpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) {
Expand All @@ -272,11 +272,11 @@ Object GroovySpyImpl(String inferredName, Class<?> inferredType, Map<String, Obj
}

Object GroovySpyImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType) {
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), specifiedType, null);
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, Collections.emptyMap(), specifiedType, null);
}

Object GroovySpyImpl(String inferredName, Class<?> inferredType, Class<?> specifiedType, Closure closure) {
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, Collections.<String, Object>emptyMap(), specifiedType, closure);
return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, Collections.emptyMap(), specifiedType, closure);
}

Object GroovySpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ private Object createDummy(IMockInvocation invocation) {
Type genericType = invocation.getMethod().getExactReturnType();
Specification spec = invocation.getMockObject().getSpecification();
return spec.createMock("dummy", genericType, MockNature.STUB, GroovyObject.class.isAssignableFrom(type) ?
MockImplementation.GROOVY : MockImplementation.JAVA, Collections.<String, Object>emptyMap(), null);
MockImplementation.GROOVY : MockImplementation.JAVA, Collections.emptyMap(), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public boolean isSatisfiedBy(IMockInvocation invocation) {

@Override
public String describeMismatch(IMockInvocation invocation) {
Condition condition = new Condition(CollectionUtil.<Object>listOf(invocation.getMethod().getName(), methodName, false),
Condition condition = new Condition(CollectionUtil.listOf(invocation.getMethod().getName(), methodName, false),
String.format("methodName == \"%s\"", methodName), null, null,
null, null);
return condition.getRendering();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public boolean isSatisfiedBy(IMockInvocation invocation) {

@Override
public String describeMismatch(IMockInvocation invocation) {
Condition condition = new Condition(CollectionUtil.<Object>listOf(getPropertyName(invocation), propertyName, false),
Condition condition = new Condition(CollectionUtil.listOf(getPropertyName(invocation), propertyName, false),
String.format("propertyName == \"%s\"", propertyName), null, null,
null, null);
return condition.getRendering();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public boolean isSatisfiedBy(IMockInvocation invocation) {

@Override
public String describeMismatch(IMockInvocation invocation) {
Condition condition = new Condition(CollectionUtil.<Object>listOf(invocation.getMethod().getName(), pattern.pattern(), false),
Condition condition = new Condition(CollectionUtil.listOf(invocation.getMethod().getName(), pattern.pattern(), false),
String.format("methodName ==~ /%s/", pattern.pattern()), null, null,
null, null);
return condition.getRendering();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public boolean isSatisfiedBy(IMockInvocation invocation) {

@Override
public String describeMismatch(IMockInvocation invocation) {
Condition condition = new Condition(CollectionUtil.<Object>listOf(getPropertyName(invocation), pattern.pattern(), false),
Condition condition = new Condition(CollectionUtil.listOf(getPropertyName(invocation), pattern.pattern(), false),
String.format("propertyName ==~ /%s/", pattern.pattern()), null, null,
null, null);
return condition.getRendering();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public boolean isSatisfiedBy(IMockInvocation invocation) {
@Override
public String describeMismatch(IMockInvocation invocation) {
// need to explicitly call .toString() otherwise the render service will attempt to output the contents of collections and such
Condition condition = new Condition(CollectionUtil.<Object>listOf( invocation.getMockObject().getInstance().toString(), target.toString(), false),
Condition condition = new Condition(CollectionUtil.listOf( invocation.getMockObject().getInstance().toString(), target.toString(), false),
"instance == target", null, null,
null, null);
return condition.getRendering();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class DynamicMockMethod implements IMockMethod {
private final boolean isStatic;

public DynamicMockMethod(String methodName, int argumentCount, boolean isStatic) {
this(methodName, Collections.<Type>nCopies(argumentCount , Object.class), Object.class, isStatic);
this(methodName, Collections.nCopies(argumentCount , Object.class), Object.class, isStatic);
}

public DynamicMockMethod(String methodName, List<Type> parameterTypes, Type returnType, boolean isStatic) {
Expand Down
Loading

0 comments on commit e9401a7

Please sign in to comment.