Skip to content

Commit

Permalink
refactor: remove redundant casts (#2478)
Browse files Browse the repository at this point in the history
  • Loading branch information
zielint0 authored and monperrus committed Sep 18, 2018
1 parent 661a3a8 commit 99043d9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private CtExecutable<T> getCtExecutable(CtType<?> typeDecl) {
Launcher.LOGGER.error(e.getMessage(), e);
}
} else if (method == null && getSimpleName().startsWith(CtExecutableReference.LAMBDA_NAME_PREFIX)) {
final List<CtLambda> elements = (List<CtLambda>) typeDecl.getElements(new NamedElementFilter<>(CtLambda.class, getSimpleName()));
final List<CtLambda> elements = typeDecl.getElements(new NamedElementFilter<>(CtLambda.class, getSimpleName()));
if (elements.isEmpty()) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/generating/CtBiScannerGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void process() {
replace.addArgument(factory.Code().createInvocation(otherRead, ((CtInvocation) replace.getArguments().get(1)).getExecutable()));

if ("Map".equals(targetInvocation.getExecutable().getType().getSimpleName())) {
((CtExpression) replace.getArguments().get(1)).replace(factory.Code().createInvocation(targetInvocation, factory.Executable().createReference("List Map#values()")));
replace.getArguments().get(1).replace(factory.Code().createInvocation(targetInvocation, factory.Executable().createReference("List Map#values()")));
CtInvocation invocation = factory.Code().createInvocation(replace.getArguments().get(2).clone(), factory.Executable().createReference("List Map#values()"));
replace.getArguments().get(2).replace(invocation);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/test/arrays/ArraysTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void testParameterizedTypeReference() throws Exception {
//contract: check actual type arguments of parameter type: List<?>
CtType<?> ctClass = ModelUtils.buildClass(VaragParam.class);
CtParameter<?> param1 = ctClass.getMethodsByName("m4").get(0).getParameters().get(0);
CtTypeReference<?> typeRef = (CtTypeReference<?>) param1.getType();
CtTypeReference<?> typeRef = param1.getType();
assertEquals("java.util.List<?>", typeRef.toString());
assertEquals(1, typeRef.getActualTypeArguments().size());
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/test/executable/ExecutableRefTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private CtAbstractInvocation<?> getInvocationFromMethod(String methodName) throw
assertEquals(1, methods.size());

CtMethod<?> ctMethod = methods.get(0);
CtBlock<?> ctBody = (CtBlock<?>) ctMethod.getBody();
CtBlock<?> ctBody = ctMethod.getBody();
Assert.assertNotNull(ctBody);

List<CtStatement> ctStatements = ctBody.getStatements();
Expand Down

0 comments on commit 99043d9

Please sign in to comment.