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