| 1 |
import java.util.List; |
| 2 |
import java.util.stream.Stream; |
| 3 |
|
| 4 |
public class JavaTest { |
| 5 |
class MethodDeclaration { |
| 6 |
public <T> List<T> getNodesByType(Class<T> clazz) { |
| 7 |
return new ArrayList<T>(); |
| 8 |
} |
| 9 |
} |
| 10 |
class JavaParserFacade { |
| 11 |
public Solved solve(MethodDeclaration method) { |
| 12 |
return new Solved(); |
| 13 |
} |
| 14 |
} |
| 15 |
class Solved { |
| 16 |
public boolean isSolved() { |
| 17 |
return true; |
| 18 |
} |
| 19 |
} |
| 20 |
private Stream<Solved> foo(MethodDeclaration methodDecl) { |
| 21 |
return methodDecl |
| 22 |
.getNodesByType(MethodDeclaration.class) |
| 23 |
.stream() |
| 24 |
.map(statement -> { |
| 25 |
try { |
| 26 |
return new JavaParserFacade().solve(statement); |
| 27 |
} catch (Throwable e) { |
| 28 |
return null; |
| 29 |
} |
| 30 |
}) |
| 31 |
.filter(parsed -> parsed != null && parsed.isSolved()); |
| 32 |
} |
| 33 |
} |