Given the code:
public Statement methodCallByName(MethodDeclaration method, String string) {
List<ExpressionStatement> expressions = method.getBody().statements().stream()
.filter(s -> s instanceof ExpressionStatement)
.map(ExpressionStatement.class::cast)
.collect(Collectors.toList());
return null;
}
I have the following error in Eclipse Oxygen:
Notice that statements()
returns a List
according to JDT docs.
What is wrong?