Uses 363K of libraries. Click here for Pure Java version (4272L/28K/95K).
1 | !7 |
2 | |
3 | lib 1004950 // JavaParser |
4 | |
5 | import com.github.javaparser.*; |
6 | import com.github.javaparser.ast.CompilationUnit; |
7 | import com.github.javaparser.ast.body.*; |
8 | import com.github.javaparser.ast.visitor.*; |
9 | |
10 | p { |
11 | File file = getProgramFile("it.java"); |
12 | S java = loadTextFile(file); |
13 | if (java == null) { |
14 | java = getServerTranspilation("#1004930"); |
15 | saveTextFile(file, java); |
16 | } |
17 | |
18 | CompilationUnit cu = JavaParser.parse(java); |
19 | |
20 | // prints the resulting compilation unit to default system output |
21 | print(cu.toString()); |
22 | |
23 | // Visit methods |
24 | new MethodVisitor().visit(cu, null); |
25 | } |
26 | |
27 | static class MethodVisitor extends VoidVisitorAdapter { |
28 | public void visit(MethodDeclaration n, Object arg) { |
29 | // here you can access the attributes of the method. |
30 | // this method will be called for all methods in this |
31 | // CompilationUnit, including inner class methods |
32 | print("Method found: " + n.getName()); |
33 | super.visit(n, arg); |
34 | } |
35 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004951 |
Snippet name: | Test JavaParser [older version] |
Eternal ID of this version: | #1004951/3 |
Text MD5: | 62e8c57b67bea88cf187d0bc676ed1e3 |
Transpilation MD5: | 429ad5156b67bf5d1f7949ce72e489f7 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-10-19 16:17:34 |
Source code size: | 973 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 614 / 708 |
Version history: | 2 change(s) |
Referenced in: | [show references] |