Created
December 30, 2018 04:26
-
-
Save naoto-ogawa/27bc8907296fcc10ca1ba7bf224df9fe to your computer and use it in GitHub Desktop.
JavaParser Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.testcode; | |
import com.github.javaparser.JavaParser; | |
import com.github.javaparser.Position; | |
import com.github.javaparser.ast.CompilationUnit; | |
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; | |
import com.github.javaparser.ast.body.MethodDeclaration; | |
import com.github.javaparser.ast.expr.MethodCallExpr; | |
import com.github.javaparser.ast.nodeTypes.NodeWithRange; | |
import com.github.javaparser.ast.stmt.CatchClause; | |
import com.github.javaparser.ast.visitor.VoidVisitorAdapter; | |
import com.github.javaparser.printer.JsonPrinter; | |
import com.google.gson.Gson; | |
import com.google.gson.GsonBuilder; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonParser; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Optional; | |
import java.util.function.Predicate; | |
public class Main { | |
public static void main(String[] args) throws IOException { | |
Files.walk(Paths.get("src/com/example/testcode/")) | |
.filter(Files::isRegularFile) | |
.map(Path::toFile) | |
.filter(x -> x.getName().endsWith(".java")) | |
.forEach(Main::doJob); | |
} | |
public static void doJob(File file) { | |
CompilationUnit cu = null; | |
try { | |
logline(); | |
log(file); | |
cu = JavaParser.parse(file); | |
} catch (FileNotFoundException e) { | |
throw new RuntimeException(e); | |
} | |
logline(); | |
cu.stream().forEach(x -> log("[" + x.getClass() + "] : " + x.toString())); | |
// logline(); | |
// log(getJsonString(cu)); | |
logline(); | |
cu.accept(new VoidVisitorAdapter<Void>() { | |
private int i = 0; | |
public void visit(MethodCallExpr expr, Void arg) { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
public void visit(MethodDeclaration expr, Void arg) { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
private List<String> classNames = new ArrayList<String>(); | |
private String className = ""; | |
public void visit(ClassOrInterfaceDeclaration expr, Void arg) { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
public void visit(CatchClause expr, Void arg) { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
}, null); | |
} | |
private static String getJsonString(CompilationUnit cu) { | |
String json = new JsonPrinter(true).output(cu); | |
Gson gson = new GsonBuilder().setPrettyPrinting().create(); | |
JsonParser jp = new JsonParser(); | |
JsonElement je = jp.parse(json); | |
return gson.toJson(je); | |
} | |
private static int getLength(NodeWithRange expr) { | |
Optional<Position> e = expr.getEnd(); | |
Optional<Position> s = expr.getBegin(); | |
return 1 + e.get().line - s.get().line; | |
} | |
private static Predicate<MethodCallExpr> hasStream = hasName("stream"); | |
private static Predicate<MethodCallExpr> hasForEach = hasName("forEach"); | |
private static Predicate<MethodCallExpr> hasName(String word) { | |
return expr -> expr.getName().getIdentifier().equals(word); | |
} | |
private static void logline() { | |
log("-------------------------------------"); | |
} | |
private static void log(Object contents) { | |
System.out.println(contents); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.testcode; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* aaaaaaaaa | |
*/ | |
public class Test01 { | |
public static final String BUZZ = "buzz"; | |
public static void main(String[] args) { | |
new Test01().foo(); | |
} | |
private class Test01Child { | |
private int childMethod(int i) { | |
return i*2; | |
} | |
} | |
public void foo() { | |
List<String> l1 = Arrays.asList("a", "b", "c"); | |
; | |
List<String> l2 = Arrays.asList("X", "Y", "Z"); | |
l1.stream().forEach(x1 -> { | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
}); | |
l2.stream().forEach(x3 -> { | |
System.out.println(x3); | |
}); | |
} | |
public int bar(String str) { | |
int ret = Integer.parseInt(str); | |
return ret; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/java -Didea.launcher.port=7535 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/htmlconverter.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/lib/tools.jar:/Users/ogawanaoto/work03/untitled/out/production/untitled:/Users/ogawanaoto/work03/untitled/lib/javaparser-core-generators-3.5.11.jar:/Users/ogawanaoto/work03/untitled/lib/javaparser-core-3.5.11.jar:/Users/ogawanaoto/work03/untitled/lib/gson-2.8.5.jar:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain com.example.testcode.Main | |
------------------------------------- | |
src/com/example/testcode/Main.java | |
------------------------------------- | |
[class com.github.javaparser.ast.CompilationUnit] : package com.example.testcode; | |
import com.github.javaparser.JavaParser; | |
import com.github.javaparser.Position; | |
import com.github.javaparser.ast.CompilationUnit; | |
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; | |
import com.github.javaparser.ast.body.MethodDeclaration; | |
import com.github.javaparser.ast.expr.MethodCallExpr; | |
import com.github.javaparser.ast.nodeTypes.NodeWithRange; | |
import com.github.javaparser.ast.stmt.CatchClause; | |
import com.github.javaparser.ast.visitor.VoidVisitorAdapter; | |
import com.github.javaparser.printer.JsonPrinter; | |
import com.google.gson.Gson; | |
import com.google.gson.GsonBuilder; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonParser; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Optional; | |
import java.util.function.Predicate; | |
public class Main { | |
public static void main(String[] args) throws IOException { | |
Files.walk(Paths.get("src/com/example/testcode/")).filter(Files::isRegularFile).map(Path::toFile).filter(x -> x.getName().endsWith(".java")).forEach(Main::doJob); | |
} | |
public static void doJob(File file) { | |
CompilationUnit cu = null; | |
try { | |
logline(); | |
log(file); | |
cu = JavaParser.parse(file); | |
} catch (FileNotFoundException e) { | |
throw new RuntimeException(e); | |
} | |
logline(); | |
cu.stream().forEach(x -> log("[" + x.getClass() + "] : " + x.toString())); | |
logline(); | |
log(getJsonString(cu)); | |
logline(); | |
cu.accept(new VoidVisitorAdapter<Void>() { | |
private int i = 0; | |
public void visit(MethodCallExpr expr, Void arg) { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
public void visit(MethodDeclaration expr, Void arg) { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
private List<String> classNames = new ArrayList<String>(); | |
private String className = ""; | |
public void visit(ClassOrInterfaceDeclaration expr, Void arg) { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
public void visit(CatchClause expr, Void arg) { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
}, null); | |
} | |
private static String getJsonString(CompilationUnit cu) { | |
String json = new JsonPrinter(true).output(cu); | |
Gson gson = new GsonBuilder().setPrettyPrinting().create(); | |
JsonParser jp = new JsonParser(); | |
JsonElement je = jp.parse(json); | |
return gson.toJson(je); | |
} | |
private static int getLength(NodeWithRange expr) { | |
Optional<Position> e = expr.getEnd(); | |
Optional<Position> s = expr.getBegin(); | |
return 1 + e.get().line - s.get().line; | |
} | |
private static Predicate<MethodCallExpr> hasStream = hasName("stream"); | |
private static Predicate<MethodCallExpr> hasForEach = hasName("forEach"); | |
private static Predicate<MethodCallExpr> hasName(String word) { | |
return expr -> expr.getName().getIdentifier().equals(word); | |
} | |
private static void logline() { | |
log("-------------------------------------"); | |
} | |
private static void log(Object contents) { | |
System.out.println(contents); | |
} | |
} | |
[class com.github.javaparser.ast.PackageDeclaration] : package com.example.testcode; | |
[class com.github.javaparser.ast.expr.Name] : com.example.testcode | |
[class com.github.javaparser.ast.expr.Name] : com.example | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.JavaParser; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.JavaParser | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.Position; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.Position | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.ast.CompilationUnit; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.CompilationUnit | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.body.ClassOrInterfaceDeclaration | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.body | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.ast.body.MethodDeclaration; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.body.MethodDeclaration | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.body | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.ast.expr.MethodCallExpr; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.expr.MethodCallExpr | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.expr | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.ast.nodeTypes.NodeWithRange; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.nodeTypes.NodeWithRange | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.nodeTypes | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.ast.stmt.CatchClause; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.stmt.CatchClause | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.stmt | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.ast.visitor.VoidVisitorAdapter; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.visitor.VoidVisitorAdapter | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast.visitor | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.ast | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.github.javaparser.printer.JsonPrinter; | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.printer.JsonPrinter | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser.printer | |
[class com.github.javaparser.ast.expr.Name] : com.github.javaparser | |
[class com.github.javaparser.ast.expr.Name] : com.github | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.google.gson.Gson; | |
[class com.github.javaparser.ast.expr.Name] : com.google.gson.Gson | |
[class com.github.javaparser.ast.expr.Name] : com.google.gson | |
[class com.github.javaparser.ast.expr.Name] : com.google | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.google.gson.GsonBuilder; | |
[class com.github.javaparser.ast.expr.Name] : com.google.gson.GsonBuilder | |
[class com.github.javaparser.ast.expr.Name] : com.google.gson | |
[class com.github.javaparser.ast.expr.Name] : com.google | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.google.gson.JsonElement; | |
[class com.github.javaparser.ast.expr.Name] : com.google.gson.JsonElement | |
[class com.github.javaparser.ast.expr.Name] : com.google.gson | |
[class com.github.javaparser.ast.expr.Name] : com.google | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import com.google.gson.JsonParser; | |
[class com.github.javaparser.ast.expr.Name] : com.google.gson.JsonParser | |
[class com.github.javaparser.ast.expr.Name] : com.google.gson | |
[class com.github.javaparser.ast.expr.Name] : com.google | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.io.File; | |
[class com.github.javaparser.ast.expr.Name] : java.io.File | |
[class com.github.javaparser.ast.expr.Name] : java.io | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.io.FileNotFoundException; | |
[class com.github.javaparser.ast.expr.Name] : java.io.FileNotFoundException | |
[class com.github.javaparser.ast.expr.Name] : java.io | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.io.IOException; | |
[class com.github.javaparser.ast.expr.Name] : java.io.IOException | |
[class com.github.javaparser.ast.expr.Name] : java.io | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.nio.file.Files; | |
[class com.github.javaparser.ast.expr.Name] : java.nio.file.Files | |
[class com.github.javaparser.ast.expr.Name] : java.nio.file | |
[class com.github.javaparser.ast.expr.Name] : java.nio | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.nio.file.Path; | |
[class com.github.javaparser.ast.expr.Name] : java.nio.file.Path | |
[class com.github.javaparser.ast.expr.Name] : java.nio.file | |
[class com.github.javaparser.ast.expr.Name] : java.nio | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.nio.file.Paths; | |
[class com.github.javaparser.ast.expr.Name] : java.nio.file.Paths | |
[class com.github.javaparser.ast.expr.Name] : java.nio.file | |
[class com.github.javaparser.ast.expr.Name] : java.nio | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.util.ArrayList; | |
[class com.github.javaparser.ast.expr.Name] : java.util.ArrayList | |
[class com.github.javaparser.ast.expr.Name] : java.util | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.util.List; | |
[class com.github.javaparser.ast.expr.Name] : java.util.List | |
[class com.github.javaparser.ast.expr.Name] : java.util | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.util.Optional; | |
[class com.github.javaparser.ast.expr.Name] : java.util.Optional | |
[class com.github.javaparser.ast.expr.Name] : java.util | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.util.function.Predicate; | |
[class com.github.javaparser.ast.expr.Name] : java.util.function.Predicate | |
[class com.github.javaparser.ast.expr.Name] : java.util.function | |
[class com.github.javaparser.ast.expr.Name] : java.util | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.body.ClassOrInterfaceDeclaration] : public class Main { | |
public static void main(String[] args) throws IOException { | |
Files.walk(Paths.get("src/com/example/testcode/")).filter(Files::isRegularFile).map(Path::toFile).filter(x -> x.getName().endsWith(".java")).forEach(Main::doJob); | |
} | |
public static void doJob(File file) { | |
CompilationUnit cu = null; | |
try { | |
logline(); | |
log(file); | |
cu = JavaParser.parse(file); | |
} catch (FileNotFoundException e) { | |
throw new RuntimeException(e); | |
} | |
logline(); | |
cu.stream().forEach(x -> log("[" + x.getClass() + "] : " + x.toString())); | |
logline(); | |
log(getJsonString(cu)); | |
logline(); | |
cu.accept(new VoidVisitorAdapter<Void>() { | |
private int i = 0; | |
public void visit(MethodCallExpr expr, Void arg) { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
public void visit(MethodDeclaration expr, Void arg) { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
private List<String> classNames = new ArrayList<String>(); | |
private String className = ""; | |
public void visit(ClassOrInterfaceDeclaration expr, Void arg) { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
public void visit(CatchClause expr, Void arg) { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
}, null); | |
} | |
private static String getJsonString(CompilationUnit cu) { | |
String json = new JsonPrinter(true).output(cu); | |
Gson gson = new GsonBuilder().setPrettyPrinting().create(); | |
JsonParser jp = new JsonParser(); | |
JsonElement je = jp.parse(json); | |
return gson.toJson(je); | |
} | |
private static int getLength(NodeWithRange expr) { | |
Optional<Position> e = expr.getEnd(); | |
Optional<Position> s = expr.getBegin(); | |
return 1 + e.get().line - s.get().line; | |
} | |
private static Predicate<MethodCallExpr> hasStream = hasName("stream"); | |
private static Predicate<MethodCallExpr> hasForEach = hasName("forEach"); | |
private static Predicate<MethodCallExpr> hasName(String word) { | |
return expr -> expr.getName().getIdentifier().equals(word); | |
} | |
private static void logline() { | |
log("-------------------------------------"); | |
} | |
private static void log(Object contents) { | |
System.out.println(contents); | |
} | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : Main | |
[class com.github.javaparser.ast.body.MethodDeclaration] : public static void main(String[] args) throws IOException { | |
Files.walk(Paths.get("src/com/example/testcode/")).filter(Files::isRegularFile).map(Path::toFile).filter(x -> x.getName().endsWith(".java")).forEach(Main::doJob); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : main | |
[class com.github.javaparser.ast.body.Parameter] : String[] args | |
[class com.github.javaparser.ast.type.ArrayType] : String[] | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : args | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : IOException | |
[class com.github.javaparser.ast.expr.SimpleName] : IOException | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
Files.walk(Paths.get("src/com/example/testcode/")).filter(Files::isRegularFile).map(Path::toFile).filter(x -> x.getName().endsWith(".java")).forEach(Main::doJob); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : Files.walk(Paths.get("src/com/example/testcode/")).filter(Files::isRegularFile).map(Path::toFile).filter(x -> x.getName().endsWith(".java")).forEach(Main::doJob); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : Files.walk(Paths.get("src/com/example/testcode/")).filter(Files::isRegularFile).map(Path::toFile).filter(x -> x.getName().endsWith(".java")).forEach(Main::doJob) | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : Files.walk(Paths.get("src/com/example/testcode/")).filter(Files::isRegularFile).map(Path::toFile).filter(x -> x.getName().endsWith(".java")) | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : Files.walk(Paths.get("src/com/example/testcode/")).filter(Files::isRegularFile).map(Path::toFile) | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : Files.walk(Paths.get("src/com/example/testcode/")).filter(Files::isRegularFile) | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : Files.walk(Paths.get("src/com/example/testcode/")) | |
[class com.github.javaparser.ast.expr.NameExpr] : Files | |
[class com.github.javaparser.ast.expr.SimpleName] : Files | |
[class com.github.javaparser.ast.expr.SimpleName] : walk | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : Paths.get("src/com/example/testcode/") | |
[class com.github.javaparser.ast.expr.NameExpr] : Paths | |
[class com.github.javaparser.ast.expr.SimpleName] : Paths | |
[class com.github.javaparser.ast.expr.SimpleName] : get | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "src/com/example/testcode/" | |
[class com.github.javaparser.ast.expr.SimpleName] : filter | |
[class com.github.javaparser.ast.expr.MethodReferenceExpr] : Files::isRegularFile | |
[class com.github.javaparser.ast.expr.TypeExpr] : Files | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Files | |
[class com.github.javaparser.ast.expr.SimpleName] : Files | |
[class com.github.javaparser.ast.expr.SimpleName] : map | |
[class com.github.javaparser.ast.expr.MethodReferenceExpr] : Path::toFile | |
[class com.github.javaparser.ast.expr.TypeExpr] : Path | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Path | |
[class com.github.javaparser.ast.expr.SimpleName] : Path | |
[class com.github.javaparser.ast.expr.SimpleName] : filter | |
[class com.github.javaparser.ast.expr.LambdaExpr] : x -> x.getName().endsWith(".java") | |
[class com.github.javaparser.ast.body.Parameter] : x | |
[class com.github.javaparser.ast.type.UnknownType] : | |
[class com.github.javaparser.ast.expr.SimpleName] : x | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : x.getName().endsWith(".java"); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : x.getName().endsWith(".java") | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : x.getName() | |
[class com.github.javaparser.ast.expr.NameExpr] : x | |
[class com.github.javaparser.ast.expr.SimpleName] : x | |
[class com.github.javaparser.ast.expr.SimpleName] : getName | |
[class com.github.javaparser.ast.expr.SimpleName] : endsWith | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : ".java" | |
[class com.github.javaparser.ast.expr.SimpleName] : forEach | |
[class com.github.javaparser.ast.expr.MethodReferenceExpr] : Main::doJob | |
[class com.github.javaparser.ast.expr.TypeExpr] : Main | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Main | |
[class com.github.javaparser.ast.expr.SimpleName] : Main | |
[class com.github.javaparser.ast.body.MethodDeclaration] : public static void doJob(File file) { | |
CompilationUnit cu = null; | |
try { | |
logline(); | |
log(file); | |
cu = JavaParser.parse(file); | |
} catch (FileNotFoundException e) { | |
throw new RuntimeException(e); | |
} | |
logline(); | |
cu.stream().forEach(x -> log("[" + x.getClass() + "] : " + x.toString())); | |
logline(); | |
log(getJsonString(cu)); | |
logline(); | |
cu.accept(new VoidVisitorAdapter<Void>() { | |
private int i = 0; | |
public void visit(MethodCallExpr expr, Void arg) { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
public void visit(MethodDeclaration expr, Void arg) { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
private List<String> classNames = new ArrayList<String>(); | |
private String className = ""; | |
public void visit(ClassOrInterfaceDeclaration expr, Void arg) { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
public void visit(CatchClause expr, Void arg) { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
}, null); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : doJob | |
[class com.github.javaparser.ast.body.Parameter] : File file | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : File | |
[class com.github.javaparser.ast.expr.SimpleName] : File | |
[class com.github.javaparser.ast.expr.SimpleName] : file | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
CompilationUnit cu = null; | |
try { | |
logline(); | |
log(file); | |
cu = JavaParser.parse(file); | |
} catch (FileNotFoundException e) { | |
throw new RuntimeException(e); | |
} | |
logline(); | |
cu.stream().forEach(x -> log("[" + x.getClass() + "] : " + x.toString())); | |
logline(); | |
log(getJsonString(cu)); | |
logline(); | |
cu.accept(new VoidVisitorAdapter<Void>() { | |
private int i = 0; | |
public void visit(MethodCallExpr expr, Void arg) { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
public void visit(MethodDeclaration expr, Void arg) { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
private List<String> classNames = new ArrayList<String>(); | |
private String className = ""; | |
public void visit(ClassOrInterfaceDeclaration expr, Void arg) { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
public void visit(CatchClause expr, Void arg) { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
}, null); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : CompilationUnit cu = null; | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : CompilationUnit cu = null | |
[class com.github.javaparser.ast.body.VariableDeclarator] : cu = null | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : CompilationUnit | |
[class com.github.javaparser.ast.expr.SimpleName] : CompilationUnit | |
[class com.github.javaparser.ast.expr.SimpleName] : cu | |
[class com.github.javaparser.ast.expr.NullLiteralExpr] : null | |
[class com.github.javaparser.ast.stmt.TryStmt] : try { | |
logline(); | |
log(file); | |
cu = JavaParser.parse(file); | |
} catch (FileNotFoundException e) { | |
throw new RuntimeException(e); | |
} | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
logline(); | |
log(file); | |
cu = JavaParser.parse(file); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : logline(); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : logline() | |
[class com.github.javaparser.ast.expr.SimpleName] : logline | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : log(file); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : log(file) | |
[class com.github.javaparser.ast.expr.SimpleName] : log | |
[class com.github.javaparser.ast.expr.NameExpr] : file | |
[class com.github.javaparser.ast.expr.SimpleName] : file | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : cu = JavaParser.parse(file); | |
[class com.github.javaparser.ast.expr.AssignExpr] : cu = JavaParser.parse(file) | |
[class com.github.javaparser.ast.expr.NameExpr] : cu | |
[class com.github.javaparser.ast.expr.SimpleName] : cu | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : JavaParser.parse(file) | |
[class com.github.javaparser.ast.expr.NameExpr] : JavaParser | |
[class com.github.javaparser.ast.expr.SimpleName] : JavaParser | |
[class com.github.javaparser.ast.expr.SimpleName] : parse | |
[class com.github.javaparser.ast.expr.NameExpr] : file | |
[class com.github.javaparser.ast.expr.SimpleName] : file | |
[class com.github.javaparser.ast.stmt.CatchClause] : catch (FileNotFoundException e) { | |
throw new RuntimeException(e); | |
} | |
[class com.github.javaparser.ast.body.Parameter] : FileNotFoundException e | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : FileNotFoundException | |
[class com.github.javaparser.ast.expr.SimpleName] : FileNotFoundException | |
[class com.github.javaparser.ast.expr.SimpleName] : e | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
throw new RuntimeException(e); | |
} | |
[class com.github.javaparser.ast.stmt.ThrowStmt] : throw new RuntimeException(e); | |
[class com.github.javaparser.ast.expr.ObjectCreationExpr] : new RuntimeException(e) | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : RuntimeException | |
[class com.github.javaparser.ast.expr.SimpleName] : RuntimeException | |
[class com.github.javaparser.ast.expr.NameExpr] : e | |
[class com.github.javaparser.ast.expr.SimpleName] : e | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : logline(); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : logline() | |
[class com.github.javaparser.ast.expr.SimpleName] : logline | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : cu.stream().forEach(x -> log("[" + x.getClass() + "] : " + x.toString())); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : cu.stream().forEach(x -> log("[" + x.getClass() + "] : " + x.toString())) | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : cu.stream() | |
[class com.github.javaparser.ast.expr.NameExpr] : cu | |
[class com.github.javaparser.ast.expr.SimpleName] : cu | |
[class com.github.javaparser.ast.expr.SimpleName] : stream | |
[class com.github.javaparser.ast.expr.SimpleName] : forEach | |
[class com.github.javaparser.ast.expr.LambdaExpr] : x -> log("[" + x.getClass() + "] : " + x.toString()) | |
[class com.github.javaparser.ast.body.Parameter] : x | |
[class com.github.javaparser.ast.type.UnknownType] : | |
[class com.github.javaparser.ast.expr.SimpleName] : x | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : log("[" + x.getClass() + "] : " + x.toString()); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : log("[" + x.getClass() + "] : " + x.toString()) | |
[class com.github.javaparser.ast.expr.SimpleName] : log | |
[class com.github.javaparser.ast.expr.BinaryExpr] : "[" + x.getClass() + "] : " + x.toString() | |
[class com.github.javaparser.ast.expr.BinaryExpr] : "[" + x.getClass() + "] : " | |
[class com.github.javaparser.ast.expr.BinaryExpr] : "[" + x.getClass() | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "[" | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : x.getClass() | |
[class com.github.javaparser.ast.expr.NameExpr] : x | |
[class com.github.javaparser.ast.expr.SimpleName] : x | |
[class com.github.javaparser.ast.expr.SimpleName] : getClass | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "] : " | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : x.toString() | |
[class com.github.javaparser.ast.expr.NameExpr] : x | |
[class com.github.javaparser.ast.expr.SimpleName] : x | |
[class com.github.javaparser.ast.expr.SimpleName] : toString | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : logline(); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : logline() | |
[class com.github.javaparser.ast.expr.SimpleName] : logline | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : log(getJsonString(cu)); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : log(getJsonString(cu)) | |
[class com.github.javaparser.ast.expr.SimpleName] : log | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : getJsonString(cu) | |
[class com.github.javaparser.ast.expr.SimpleName] : getJsonString | |
[class com.github.javaparser.ast.expr.NameExpr] : cu | |
[class com.github.javaparser.ast.expr.SimpleName] : cu | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : logline(); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : logline() | |
[class com.github.javaparser.ast.expr.SimpleName] : logline | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : cu.accept(new VoidVisitorAdapter<Void>() { | |
private int i = 0; | |
public void visit(MethodCallExpr expr, Void arg) { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
public void visit(MethodDeclaration expr, Void arg) { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
private List<String> classNames = new ArrayList<String>(); | |
private String className = ""; | |
public void visit(ClassOrInterfaceDeclaration expr, Void arg) { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
public void visit(CatchClause expr, Void arg) { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
}, null); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : cu.accept(new VoidVisitorAdapter<Void>() { | |
private int i = 0; | |
public void visit(MethodCallExpr expr, Void arg) { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
public void visit(MethodDeclaration expr, Void arg) { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
private List<String> classNames = new ArrayList<String>(); | |
private String className = ""; | |
public void visit(ClassOrInterfaceDeclaration expr, Void arg) { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
public void visit(CatchClause expr, Void arg) { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
}, null) | |
[class com.github.javaparser.ast.expr.NameExpr] : cu | |
[class com.github.javaparser.ast.expr.SimpleName] : cu | |
[class com.github.javaparser.ast.expr.SimpleName] : accept | |
[class com.github.javaparser.ast.expr.ObjectCreationExpr] : new VoidVisitorAdapter<Void>() { | |
private int i = 0; | |
public void visit(MethodCallExpr expr, Void arg) { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
public void visit(MethodDeclaration expr, Void arg) { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
private List<String> classNames = new ArrayList<String>(); | |
private String className = ""; | |
public void visit(ClassOrInterfaceDeclaration expr, Void arg) { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
public void visit(CatchClause expr, Void arg) { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
} | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : VoidVisitorAdapter<Void> | |
[class com.github.javaparser.ast.expr.SimpleName] : VoidVisitorAdapter | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Void | |
[class com.github.javaparser.ast.expr.SimpleName] : Void | |
[class com.github.javaparser.ast.body.FieldDeclaration] : private int i = 0; | |
[class com.github.javaparser.ast.body.VariableDeclarator] : i = 0 | |
[class com.github.javaparser.ast.type.PrimitiveType] : int | |
[class com.github.javaparser.ast.expr.SimpleName] : i | |
[class com.github.javaparser.ast.expr.IntegerLiteralExpr] : 0 | |
[class com.github.javaparser.ast.body.MethodDeclaration] : public void visit(MethodCallExpr expr, Void arg) { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : visit | |
[class com.github.javaparser.ast.body.Parameter] : MethodCallExpr expr | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : MethodCallExpr | |
[class com.github.javaparser.ast.expr.SimpleName] : MethodCallExpr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.body.Parameter] : Void arg | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Void | |
[class com.github.javaparser.ast.expr.SimpleName] : Void | |
[class com.github.javaparser.ast.expr.SimpleName] : arg | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
super.visit(expr, arg); | |
if (hasForEach.test(expr)) { | |
i--; | |
} | |
} | |
[class com.github.javaparser.ast.stmt.IfStmt] : if (hasForEach.test(expr)) { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : hasForEach.test(expr) | |
[class com.github.javaparser.ast.expr.NameExpr] : hasForEach | |
[class com.github.javaparser.ast.expr.SimpleName] : hasForEach | |
[class com.github.javaparser.ast.expr.SimpleName] : test | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
i++; | |
if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : i++; | |
[class com.github.javaparser.ast.expr.UnaryExpr] : i++ | |
[class com.github.javaparser.ast.expr.NameExpr] : i | |
[class com.github.javaparser.ast.expr.SimpleName] : i | |
[class com.github.javaparser.ast.stmt.IfStmt] : if (i >= 2) { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
[class com.github.javaparser.ast.expr.BinaryExpr] : i >= 2 | |
[class com.github.javaparser.ast.expr.NameExpr] : i | |
[class com.github.javaparser.ast.expr.SimpleName] : i | |
[class com.github.javaparser.ast.expr.IntegerLiteralExpr] : 2 | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
log(expr); | |
log(getLength(expr)); | |
// log(expr.getBegin().get().line); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : log(expr); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : log(expr) | |
[class com.github.javaparser.ast.expr.SimpleName] : log | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : log(getLength(expr)); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : log(getLength(expr)) | |
[class com.github.javaparser.ast.expr.SimpleName] : log | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : getLength(expr) | |
[class com.github.javaparser.ast.expr.SimpleName] : getLength | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.comments.LineComment] : // log(expr.getBegin().get().line); | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : super.visit(expr, arg); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : super.visit(expr, arg) | |
[class com.github.javaparser.ast.expr.SuperExpr] : super | |
[class com.github.javaparser.ast.expr.SimpleName] : visit | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.NameExpr] : arg | |
[class com.github.javaparser.ast.expr.SimpleName] : arg | |
[class com.github.javaparser.ast.stmt.IfStmt] : if (hasForEach.test(expr)) { | |
i--; | |
} | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : hasForEach.test(expr) | |
[class com.github.javaparser.ast.expr.NameExpr] : hasForEach | |
[class com.github.javaparser.ast.expr.SimpleName] : hasForEach | |
[class com.github.javaparser.ast.expr.SimpleName] : test | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
i--; | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : i--; | |
[class com.github.javaparser.ast.expr.UnaryExpr] : i-- | |
[class com.github.javaparser.ast.expr.NameExpr] : i | |
[class com.github.javaparser.ast.expr.SimpleName] : i | |
[class com.github.javaparser.ast.body.MethodDeclaration] : public void visit(MethodDeclaration expr, Void arg) { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : visit | |
[class com.github.javaparser.ast.body.Parameter] : MethodDeclaration expr | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : MethodDeclaration | |
[class com.github.javaparser.ast.expr.SimpleName] : MethodDeclaration | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.body.Parameter] : Void arg | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Void | |
[class com.github.javaparser.ast.expr.SimpleName] : Void | |
[class com.github.javaparser.ast.expr.SimpleName] : arg | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
super.visit(expr, arg); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : log(className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr)) | |
[class com.github.javaparser.ast.expr.SimpleName] : log | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " + getLength(expr) | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line + " : " | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " + expr.getName().getIdentifier() + " : " + expr.getBegin().get().line | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " + expr.getName().getIdentifier() + " : " | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " + expr.getName().getIdentifier() | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " | |
[class com.github.javaparser.ast.expr.NameExpr] : className | |
[class com.github.javaparser.ast.expr.SimpleName] : className | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : " : " | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getName().getIdentifier() | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getName() | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : getName | |
[class com.github.javaparser.ast.expr.SimpleName] : getIdentifier | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : " : " | |
[class com.github.javaparser.ast.expr.FieldAccessExpr] : expr.getBegin().get().line | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getBegin().get() | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getBegin() | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : getBegin | |
[class com.github.javaparser.ast.expr.SimpleName] : get | |
[class com.github.javaparser.ast.expr.SimpleName] : line | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : " : " | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : getLength(expr) | |
[class com.github.javaparser.ast.expr.SimpleName] : getLength | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : super.visit(expr, arg); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : super.visit(expr, arg) | |
[class com.github.javaparser.ast.expr.SuperExpr] : super | |
[class com.github.javaparser.ast.expr.SimpleName] : visit | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.NameExpr] : arg | |
[class com.github.javaparser.ast.expr.SimpleName] : arg | |
[class com.github.javaparser.ast.body.FieldDeclaration] : private List<String> classNames = new ArrayList<String>(); | |
[class com.github.javaparser.ast.body.VariableDeclarator] : classNames = new ArrayList<String>() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : List<String> | |
[class com.github.javaparser.ast.expr.SimpleName] : List | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : classNames | |
[class com.github.javaparser.ast.expr.ObjectCreationExpr] : new ArrayList<String>() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : ArrayList<String> | |
[class com.github.javaparser.ast.expr.SimpleName] : ArrayList | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.body.FieldDeclaration] : private String className = ""; | |
[class com.github.javaparser.ast.body.VariableDeclarator] : className = "" | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : className | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "" | |
[class com.github.javaparser.ast.body.MethodDeclaration] : public void visit(ClassOrInterfaceDeclaration expr, Void arg) { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : visit | |
[class com.github.javaparser.ast.body.Parameter] : ClassOrInterfaceDeclaration expr | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : ClassOrInterfaceDeclaration | |
[class com.github.javaparser.ast.expr.SimpleName] : ClassOrInterfaceDeclaration | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.body.Parameter] : Void arg | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Void | |
[class com.github.javaparser.ast.expr.SimpleName] : Void | |
[class com.github.javaparser.ast.expr.SimpleName] : arg | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
String name = expr.getName().getIdentifier(); | |
classNames.add(name); | |
className = String.join(".", classNames); | |
super.visit(expr, arg); | |
classNames.remove(classNames.size() - 1); | |
className = String.join(".", classNames); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : String name = expr.getName().getIdentifier(); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : String name = expr.getName().getIdentifier() | |
[class com.github.javaparser.ast.body.VariableDeclarator] : name = expr.getName().getIdentifier() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : name | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getName().getIdentifier() | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getName() | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : getName | |
[class com.github.javaparser.ast.expr.SimpleName] : getIdentifier | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : classNames.add(name); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : classNames.add(name) | |
[class com.github.javaparser.ast.expr.NameExpr] : classNames | |
[class com.github.javaparser.ast.expr.SimpleName] : classNames | |
[class com.github.javaparser.ast.expr.SimpleName] : add | |
[class com.github.javaparser.ast.expr.NameExpr] : name | |
[class com.github.javaparser.ast.expr.SimpleName] : name | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : className = String.join(".", classNames); | |
[class com.github.javaparser.ast.expr.AssignExpr] : className = String.join(".", classNames) | |
[class com.github.javaparser.ast.expr.NameExpr] : className | |
[class com.github.javaparser.ast.expr.SimpleName] : className | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : String.join(".", classNames) | |
[class com.github.javaparser.ast.expr.NameExpr] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : join | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "." | |
[class com.github.javaparser.ast.expr.NameExpr] : classNames | |
[class com.github.javaparser.ast.expr.SimpleName] : classNames | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : super.visit(expr, arg); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : super.visit(expr, arg) | |
[class com.github.javaparser.ast.expr.SuperExpr] : super | |
[class com.github.javaparser.ast.expr.SimpleName] : visit | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.NameExpr] : arg | |
[class com.github.javaparser.ast.expr.SimpleName] : arg | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : classNames.remove(classNames.size() - 1); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : classNames.remove(classNames.size() - 1) | |
[class com.github.javaparser.ast.expr.NameExpr] : classNames | |
[class com.github.javaparser.ast.expr.SimpleName] : classNames | |
[class com.github.javaparser.ast.expr.SimpleName] : remove | |
[class com.github.javaparser.ast.expr.BinaryExpr] : classNames.size() - 1 | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : classNames.size() | |
[class com.github.javaparser.ast.expr.NameExpr] : classNames | |
[class com.github.javaparser.ast.expr.SimpleName] : classNames | |
[class com.github.javaparser.ast.expr.SimpleName] : size | |
[class com.github.javaparser.ast.expr.IntegerLiteralExpr] : 1 | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : className = String.join(".", classNames); | |
[class com.github.javaparser.ast.expr.AssignExpr] : className = String.join(".", classNames) | |
[class com.github.javaparser.ast.expr.NameExpr] : className | |
[class com.github.javaparser.ast.expr.SimpleName] : className | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : String.join(".", classNames) | |
[class com.github.javaparser.ast.expr.NameExpr] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : join | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "." | |
[class com.github.javaparser.ast.expr.NameExpr] : classNames | |
[class com.github.javaparser.ast.expr.SimpleName] : classNames | |
[class com.github.javaparser.ast.body.MethodDeclaration] : public void visit(CatchClause expr, Void arg) { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : visit | |
[class com.github.javaparser.ast.body.Parameter] : CatchClause expr | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : CatchClause | |
[class com.github.javaparser.ast.expr.SimpleName] : CatchClause | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.body.Parameter] : Void arg | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Void | |
[class com.github.javaparser.ast.expr.SimpleName] : Void | |
[class com.github.javaparser.ast.expr.SimpleName] : arg | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
super.visit(expr, arg); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : log(className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName()) | |
[class com.github.javaparser.ast.expr.SimpleName] : log | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " + expr.getParameter().getType() + " : " + expr.getParameter().getName() | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " + expr.getParameter().getType() + " : " | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " + expr.getParameter().getType() | |
[class com.github.javaparser.ast.expr.BinaryExpr] : className + " : " | |
[class com.github.javaparser.ast.expr.NameExpr] : className | |
[class com.github.javaparser.ast.expr.SimpleName] : className | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : " : " | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getParameter().getType() | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getParameter() | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : getParameter | |
[class com.github.javaparser.ast.expr.SimpleName] : getType | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : " : " | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getParameter().getName() | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getParameter() | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : getParameter | |
[class com.github.javaparser.ast.expr.SimpleName] : getName | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : super.visit(expr, arg); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : super.visit(expr, arg) | |
[class com.github.javaparser.ast.expr.SuperExpr] : super | |
[class com.github.javaparser.ast.expr.SimpleName] : visit | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.NameExpr] : arg | |
[class com.github.javaparser.ast.expr.SimpleName] : arg | |
[class com.github.javaparser.ast.expr.NullLiteralExpr] : null | |
[class com.github.javaparser.ast.body.MethodDeclaration] : private static String getJsonString(CompilationUnit cu) { | |
String json = new JsonPrinter(true).output(cu); | |
Gson gson = new GsonBuilder().setPrettyPrinting().create(); | |
JsonParser jp = new JsonParser(); | |
JsonElement je = jp.parse(json); | |
return gson.toJson(je); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : getJsonString | |
[class com.github.javaparser.ast.body.Parameter] : CompilationUnit cu | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : CompilationUnit | |
[class com.github.javaparser.ast.expr.SimpleName] : CompilationUnit | |
[class com.github.javaparser.ast.expr.SimpleName] : cu | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
String json = new JsonPrinter(true).output(cu); | |
Gson gson = new GsonBuilder().setPrettyPrinting().create(); | |
JsonParser jp = new JsonParser(); | |
JsonElement je = jp.parse(json); | |
return gson.toJson(je); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : String json = new JsonPrinter(true).output(cu); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : String json = new JsonPrinter(true).output(cu) | |
[class com.github.javaparser.ast.body.VariableDeclarator] : json = new JsonPrinter(true).output(cu) | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : json | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : new JsonPrinter(true).output(cu) | |
[class com.github.javaparser.ast.expr.ObjectCreationExpr] : new JsonPrinter(true) | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : JsonPrinter | |
[class com.github.javaparser.ast.expr.SimpleName] : JsonPrinter | |
[class com.github.javaparser.ast.expr.BooleanLiteralExpr] : true | |
[class com.github.javaparser.ast.expr.SimpleName] : output | |
[class com.github.javaparser.ast.expr.NameExpr] : cu | |
[class com.github.javaparser.ast.expr.SimpleName] : cu | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : Gson gson = new GsonBuilder().setPrettyPrinting().create(); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : Gson gson = new GsonBuilder().setPrettyPrinting().create() | |
[class com.github.javaparser.ast.body.VariableDeclarator] : gson = new GsonBuilder().setPrettyPrinting().create() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Gson | |
[class com.github.javaparser.ast.expr.SimpleName] : Gson | |
[class com.github.javaparser.ast.expr.SimpleName] : gson | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : new GsonBuilder().setPrettyPrinting().create() | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : new GsonBuilder().setPrettyPrinting() | |
[class com.github.javaparser.ast.expr.ObjectCreationExpr] : new GsonBuilder() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : GsonBuilder | |
[class com.github.javaparser.ast.expr.SimpleName] : GsonBuilder | |
[class com.github.javaparser.ast.expr.SimpleName] : setPrettyPrinting | |
[class com.github.javaparser.ast.expr.SimpleName] : create | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : JsonParser jp = new JsonParser(); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : JsonParser jp = new JsonParser() | |
[class com.github.javaparser.ast.body.VariableDeclarator] : jp = new JsonParser() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : JsonParser | |
[class com.github.javaparser.ast.expr.SimpleName] : JsonParser | |
[class com.github.javaparser.ast.expr.SimpleName] : jp | |
[class com.github.javaparser.ast.expr.ObjectCreationExpr] : new JsonParser() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : JsonParser | |
[class com.github.javaparser.ast.expr.SimpleName] : JsonParser | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : JsonElement je = jp.parse(json); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : JsonElement je = jp.parse(json) | |
[class com.github.javaparser.ast.body.VariableDeclarator] : je = jp.parse(json) | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : JsonElement | |
[class com.github.javaparser.ast.expr.SimpleName] : JsonElement | |
[class com.github.javaparser.ast.expr.SimpleName] : je | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : jp.parse(json) | |
[class com.github.javaparser.ast.expr.NameExpr] : jp | |
[class com.github.javaparser.ast.expr.SimpleName] : jp | |
[class com.github.javaparser.ast.expr.SimpleName] : parse | |
[class com.github.javaparser.ast.expr.NameExpr] : json | |
[class com.github.javaparser.ast.expr.SimpleName] : json | |
[class com.github.javaparser.ast.stmt.ReturnStmt] : return gson.toJson(je); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : gson.toJson(je) | |
[class com.github.javaparser.ast.expr.NameExpr] : gson | |
[class com.github.javaparser.ast.expr.SimpleName] : gson | |
[class com.github.javaparser.ast.expr.SimpleName] : toJson | |
[class com.github.javaparser.ast.expr.NameExpr] : je | |
[class com.github.javaparser.ast.expr.SimpleName] : je | |
[class com.github.javaparser.ast.body.MethodDeclaration] : private static int getLength(NodeWithRange expr) { | |
Optional<Position> e = expr.getEnd(); | |
Optional<Position> s = expr.getBegin(); | |
return 1 + e.get().line - s.get().line; | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : getLength | |
[class com.github.javaparser.ast.body.Parameter] : NodeWithRange expr | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : NodeWithRange | |
[class com.github.javaparser.ast.expr.SimpleName] : NodeWithRange | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.type.PrimitiveType] : int | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
Optional<Position> e = expr.getEnd(); | |
Optional<Position> s = expr.getBegin(); | |
return 1 + e.get().line - s.get().line; | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : Optional<Position> e = expr.getEnd(); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : Optional<Position> e = expr.getEnd() | |
[class com.github.javaparser.ast.body.VariableDeclarator] : e = expr.getEnd() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Optional<Position> | |
[class com.github.javaparser.ast.expr.SimpleName] : Optional | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Position | |
[class com.github.javaparser.ast.expr.SimpleName] : Position | |
[class com.github.javaparser.ast.expr.SimpleName] : e | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getEnd() | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : getEnd | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : Optional<Position> s = expr.getBegin(); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : Optional<Position> s = expr.getBegin() | |
[class com.github.javaparser.ast.body.VariableDeclarator] : s = expr.getBegin() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Optional<Position> | |
[class com.github.javaparser.ast.expr.SimpleName] : Optional | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Position | |
[class com.github.javaparser.ast.expr.SimpleName] : Position | |
[class com.github.javaparser.ast.expr.SimpleName] : s | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getBegin() | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : getBegin | |
[class com.github.javaparser.ast.stmt.ReturnStmt] : return 1 + e.get().line - s.get().line; | |
[class com.github.javaparser.ast.expr.BinaryExpr] : 1 + e.get().line - s.get().line | |
[class com.github.javaparser.ast.expr.BinaryExpr] : 1 + e.get().line | |
[class com.github.javaparser.ast.expr.IntegerLiteralExpr] : 1 | |
[class com.github.javaparser.ast.expr.FieldAccessExpr] : e.get().line | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : e.get() | |
[class com.github.javaparser.ast.expr.NameExpr] : e | |
[class com.github.javaparser.ast.expr.SimpleName] : e | |
[class com.github.javaparser.ast.expr.SimpleName] : get | |
[class com.github.javaparser.ast.expr.SimpleName] : line | |
[class com.github.javaparser.ast.expr.FieldAccessExpr] : s.get().line | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : s.get() | |
[class com.github.javaparser.ast.expr.NameExpr] : s | |
[class com.github.javaparser.ast.expr.SimpleName] : s | |
[class com.github.javaparser.ast.expr.SimpleName] : get | |
[class com.github.javaparser.ast.expr.SimpleName] : line | |
[class com.github.javaparser.ast.body.FieldDeclaration] : private static Predicate<MethodCallExpr> hasStream = hasName("stream"); | |
[class com.github.javaparser.ast.body.VariableDeclarator] : hasStream = hasName("stream") | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Predicate<MethodCallExpr> | |
[class com.github.javaparser.ast.expr.SimpleName] : Predicate | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : MethodCallExpr | |
[class com.github.javaparser.ast.expr.SimpleName] : MethodCallExpr | |
[class com.github.javaparser.ast.expr.SimpleName] : hasStream | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : hasName("stream") | |
[class com.github.javaparser.ast.expr.SimpleName] : hasName | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "stream" | |
[class com.github.javaparser.ast.body.FieldDeclaration] : private static Predicate<MethodCallExpr> hasForEach = hasName("forEach"); | |
[class com.github.javaparser.ast.body.VariableDeclarator] : hasForEach = hasName("forEach") | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Predicate<MethodCallExpr> | |
[class com.github.javaparser.ast.expr.SimpleName] : Predicate | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : MethodCallExpr | |
[class com.github.javaparser.ast.expr.SimpleName] : MethodCallExpr | |
[class com.github.javaparser.ast.expr.SimpleName] : hasForEach | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : hasName("forEach") | |
[class com.github.javaparser.ast.expr.SimpleName] : hasName | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "forEach" | |
[class com.github.javaparser.ast.body.MethodDeclaration] : private static Predicate<MethodCallExpr> hasName(String word) { | |
return expr -> expr.getName().getIdentifier().equals(word); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : hasName | |
[class com.github.javaparser.ast.body.Parameter] : String word | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : word | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Predicate<MethodCallExpr> | |
[class com.github.javaparser.ast.expr.SimpleName] : Predicate | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : MethodCallExpr | |
[class com.github.javaparser.ast.expr.SimpleName] : MethodCallExpr | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
return expr -> expr.getName().getIdentifier().equals(word); | |
} | |
[class com.github.javaparser.ast.stmt.ReturnStmt] : return expr -> expr.getName().getIdentifier().equals(word); | |
[class com.github.javaparser.ast.expr.LambdaExpr] : expr -> expr.getName().getIdentifier().equals(word) | |
[class com.github.javaparser.ast.body.Parameter] : expr | |
[class com.github.javaparser.ast.type.UnknownType] : | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : expr.getName().getIdentifier().equals(word); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getName().getIdentifier().equals(word) | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getName().getIdentifier() | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : expr.getName() | |
[class com.github.javaparser.ast.expr.NameExpr] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : expr | |
[class com.github.javaparser.ast.expr.SimpleName] : getName | |
[class com.github.javaparser.ast.expr.SimpleName] : getIdentifier | |
[class com.github.javaparser.ast.expr.SimpleName] : equals | |
[class com.github.javaparser.ast.expr.NameExpr] : word | |
[class com.github.javaparser.ast.expr.SimpleName] : word | |
[class com.github.javaparser.ast.body.MethodDeclaration] : private static void logline() { | |
log("-------------------------------------"); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : logline | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
log("-------------------------------------"); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : log("-------------------------------------"); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : log("-------------------------------------") | |
[class com.github.javaparser.ast.expr.SimpleName] : log | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "-------------------------------------" | |
[class com.github.javaparser.ast.body.MethodDeclaration] : private static void log(Object contents) { | |
System.out.println(contents); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : log | |
[class com.github.javaparser.ast.body.Parameter] : Object contents | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Object | |
[class com.github.javaparser.ast.expr.SimpleName] : Object | |
[class com.github.javaparser.ast.expr.SimpleName] : contents | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
System.out.println(contents); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : System.out.println(contents); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : System.out.println(contents) | |
[class com.github.javaparser.ast.expr.FieldAccessExpr] : System.out | |
[class com.github.javaparser.ast.expr.NameExpr] : System | |
[class com.github.javaparser.ast.expr.SimpleName] : System | |
[class com.github.javaparser.ast.expr.SimpleName] : out | |
[class com.github.javaparser.ast.expr.SimpleName] : println | |
[class com.github.javaparser.ast.expr.NameExpr] : contents | |
[class com.github.javaparser.ast.expr.SimpleName] : contents | |
------------------------------------- | |
{ | |
"type": "CompilationUnit", | |
"packageDeclaration": { | |
"type": "PackageDeclaration", | |
"name": { | |
"type": "Name", | |
"identifier": "testcode", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "example", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
}, | |
"imports": [ | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "JavaParser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "Position", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "CompilationUnit", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "ast", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "ClassOrInterfaceDeclaration", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "body", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "ast", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "MethodDeclaration", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "body", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "ast", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "MethodCallExpr", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "expr", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "ast", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "NodeWithRange", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "nodeTypes", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "ast", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "CatchClause", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "stmt", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "ast", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "VoidVisitorAdapter", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "visitor", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "ast", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "JsonPrinter", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "printer", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "javaparser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "github", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "Gson", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "gson", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "google", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "GsonBuilder", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "gson", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "google", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "JsonElement", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "gson", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "google", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "JsonParser", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "gson", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "google", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "File", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "io", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "FileNotFoundException", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "io", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "IOException", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "io", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "Files", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "file", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "nio", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "Path", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "file", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "nio", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "Paths", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "file", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "nio", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "ArrayList", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "util", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "List", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "util", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "Optional", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "util", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "Predicate", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "function", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "util", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
} | |
} | |
], | |
"types": [ | |
{ | |
"type": "ClassOrInterfaceDeclaration", | |
"isInterface": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Main" | |
}, | |
"members": [ | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "forEach" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "filter" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "map" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "filter" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "walk" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Files" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "get" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Paths" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "StringLiteralExpr", | |
"value": "src/com/example/testcode/" | |
} | |
] | |
} | |
] | |
}, | |
"arguments": [ | |
{ | |
"type": "MethodReferenceExpr", | |
"identifier": "isRegularFile", | |
"scope": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Files" | |
} | |
} | |
} | |
} | |
] | |
}, | |
"arguments": [ | |
{ | |
"type": "MethodReferenceExpr", | |
"identifier": "toFile", | |
"scope": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Path" | |
} | |
} | |
} | |
} | |
] | |
}, | |
"arguments": [ | |
{ | |
"type": "LambdaExpr", | |
"isEnclosingParameters": "false", | |
"body": { | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "endsWith" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getName" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x" | |
} | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "StringLiteralExpr", | |
"value": ".java" | |
} | |
] | |
} | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "UnknownType" | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x" | |
} | |
} | |
] | |
} | |
] | |
}, | |
"arguments": [ | |
{ | |
"type": "MethodReferenceExpr", | |
"identifier": "doJob", | |
"scope": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Main" | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "main" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ArrayType", | |
"origin": "TYPE", | |
"componentType": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "args" | |
} | |
} | |
], | |
"thrownExceptions": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "IOException" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "CompilationUnit" | |
} | |
}, | |
"initializer": { | |
"type": "NullLiteralExpr" | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "cu" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "TryStmt", | |
"tryBlock": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "logline" | |
} | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "log" | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "file" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "AssignExpr", | |
"operator": "ASSIGN", | |
"target": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "cu" | |
} | |
}, | |
"value": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "parse" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "JavaParser" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "file" | |
} | |
} | |
] | |
} | |
} | |
} | |
] | |
}, | |
"catchClauses": [ | |
{ | |
"type": "CatchClause", | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ThrowStmt", | |
"expression": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "RuntimeException" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "e" | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"parameter": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "FileNotFoundException" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "e" | |
} | |
} | |
} | |
] | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "logline" | |
} | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "forEach" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "stream" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "cu" | |
} | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "LambdaExpr", | |
"isEnclosingParameters": "false", | |
"body": { | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "log" | |
}, | |
"arguments": [ | |
{ | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "StringLiteralExpr", | |
"value": "[" | |
}, | |
"right": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getClass" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x" | |
} | |
} | |
} | |
}, | |
"right": { | |
"type": "StringLiteralExpr", | |
"value": "] : " | |
} | |
}, | |
"right": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "toString" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x" | |
} | |
} | |
} | |
} | |
] | |
} | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "UnknownType" | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x" | |
} | |
} | |
] | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "logline" | |
} | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "log" | |
}, | |
"arguments": [ | |
{ | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getJsonString" | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "cu" | |
} | |
} | |
] | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "logline" | |
} | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "accept" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "cu" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "VoidVisitorAdapter" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Void" | |
} | |
} | |
] | |
}, | |
"anonymousClassBody": [ | |
{ | |
"type": "FieldDeclaration", | |
"variables": [ | |
{ | |
"type": { | |
"type": "INT" | |
}, | |
"initializer": { | |
"type": "IntegerLiteralExpr", | |
"value": "0" | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "i" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "IfStmt", | |
"condition": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "test" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "hasForEach" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
] | |
}, | |
"thenStmt": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "UnaryExpr", | |
"operator": "POSTFIX_INCREMENT", | |
"expression": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "i" | |
} | |
} | |
} | |
}, | |
{ | |
"type": "IfStmt", | |
"condition": { | |
"type": "BinaryExpr", | |
"operator": "GREATER_EQUALS", | |
"left": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "i" | |
} | |
}, | |
"right": { | |
"type": "IntegerLiteralExpr", | |
"value": "2" | |
} | |
}, | |
"thenStmt": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "log" | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "log" | |
}, | |
"arguments": [ | |
{ | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getLength" | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
] | |
} | |
] | |
} | |
} | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "visit" | |
}, | |
"scope": { | |
"type": "SuperExpr" | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
}, | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "arg" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "IfStmt", | |
"condition": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "test" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "hasForEach" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
] | |
}, | |
"thenStmt": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "UnaryExpr", | |
"operator": "POSTFIX_DECREMENT", | |
"expression": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "i" | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "visit" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "MethodCallExpr" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
}, | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Void" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "arg" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "log" | |
}, | |
"arguments": [ | |
{ | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "className" | |
} | |
}, | |
"right": { | |
"type": "StringLiteralExpr", | |
"value": " : " | |
} | |
}, | |
"right": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getIdentifier" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getName" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"type": "StringLiteralExpr", | |
"value": " : " | |
} | |
}, | |
"right": { | |
"type": "FieldAccessExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "line" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "get" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getBegin" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"type": "StringLiteralExpr", | |
"value": " : " | |
} | |
}, | |
"right": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getLength" | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "visit" | |
}, | |
"scope": { | |
"type": "SuperExpr" | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
}, | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "arg" | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "visit" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "MethodDeclaration" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
}, | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Void" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "arg" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "FieldDeclaration", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "List" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
} | |
] | |
}, | |
"initializer": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "ArrayList" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
} | |
] | |
} | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "classNames" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "FieldDeclaration", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
}, | |
"initializer": { | |
"type": "StringLiteralExpr", | |
"value": "" | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "className" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getIdentifier" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getName" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
} | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "name" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "add" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "classNames" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "name" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "AssignExpr", | |
"operator": "ASSIGN", | |
"target": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "className" | |
} | |
}, | |
"value": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "join" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "StringLiteralExpr", | |
"value": "." | |
}, | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "classNames" | |
} | |
} | |
] | |
} | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "visit" | |
}, | |
"scope": { | |
"type": "SuperExpr" | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
}, | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "arg" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "remove" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "classNames" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "BinaryExpr", | |
"operator": "MINUS", | |
"left": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "size" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "classNames" | |
} | |
} | |
}, | |
"right": { | |
"type": "IntegerLiteralExpr", | |
"value": "1" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "AssignExpr", | |
"operator": "ASSIGN", | |
"target": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "className" | |
} | |
}, | |
"value": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "join" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "StringLiteralExpr", | |
"value": "." | |
}, | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "classNames" | |
} | |
} | |
] | |
} | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "visit" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "ClassOrInterfaceDeclaration" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
}, | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Void" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "arg" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "log" | |
}, | |
"arguments": [ | |
{ | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "className" | |
} | |
}, | |
"right": { | |
"type": "StringLiteralExpr", | |
"value": " : " | |
} | |
}, | |
"right": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getType" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getParameter" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"type": "StringLiteralExpr", | |
"value": " : " | |
} | |
}, | |
"right": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getName" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getParameter" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "visit" | |
}, | |
"scope": { | |
"type": "SuperExpr" | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
}, | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "arg" | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "visit" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "CatchClause" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
}, | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Void" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "arg" | |
} | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"type": "NullLiteralExpr" | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "doJob" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "File" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "file" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "output" | |
}, | |
"scope": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "JsonPrinter" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "BooleanLiteralExpr", | |
"value": "true" | |
} | |
] | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "cu" | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "json" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Gson" | |
} | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "create" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "setPrettyPrinting" | |
}, | |
"scope": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "GsonBuilder" | |
} | |
} | |
} | |
} | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "gson" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "JsonParser" | |
} | |
}, | |
"initializer": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "JsonParser" | |
} | |
} | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "jp" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "JsonElement" | |
} | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "parse" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "jp" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "json" | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "je" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ReturnStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "toJson" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "gson" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "je" | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getJsonString" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "CompilationUnit" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "cu" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "INT" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Optional" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Position" | |
} | |
} | |
] | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getEnd" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "e" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Optional" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Position" | |
} | |
} | |
] | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getBegin" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "s" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ReturnStmt", | |
"expression": { | |
"type": "BinaryExpr", | |
"operator": "MINUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "IntegerLiteralExpr", | |
"value": "1" | |
}, | |
"right": { | |
"type": "FieldAccessExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "line" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "get" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "e" | |
} | |
} | |
} | |
} | |
}, | |
"right": { | |
"type": "FieldAccessExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "line" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "get" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "s" | |
} | |
} | |
} | |
} | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getLength" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "NodeWithRange" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "FieldDeclaration", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Predicate" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "MethodCallExpr" | |
} | |
} | |
] | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "hasName" | |
}, | |
"arguments": [ | |
{ | |
"type": "StringLiteralExpr", | |
"value": "stream" | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "hasStream" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "FieldDeclaration", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Predicate" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "MethodCallExpr" | |
} | |
} | |
] | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "hasName" | |
}, | |
"arguments": [ | |
{ | |
"type": "StringLiteralExpr", | |
"value": "forEach" | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "hasForEach" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Predicate" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "MethodCallExpr" | |
} | |
} | |
] | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ReturnStmt", | |
"expression": { | |
"type": "LambdaExpr", | |
"isEnclosingParameters": "false", | |
"body": { | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "equals" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getIdentifier" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "getName" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "word" | |
} | |
} | |
] | |
} | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "UnknownType" | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "expr" | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "hasName" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "word" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "log" | |
}, | |
"arguments": [ | |
{ | |
"type": "StringLiteralExpr", | |
"value": "-------------------------------------" | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "logline" | |
} | |
}, | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "println" | |
}, | |
"scope": { | |
"type": "FieldAccessExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "out" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "System" | |
} | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "contents" | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "log" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Object" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "contents" | |
} | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
------------------------------------- | |
Main : main : 31 : 7 | |
Main : doJob : 39 : 57 | |
Main : FileNotFoundException : e | |
Main : visit : 57 : 14 | |
Main : visit : 72 : 4 | |
Main : visit : 80 : 8 | |
Main : visit : 89 : 4 | |
Main : getJsonString : 97 : 7 | |
Main : getLength : 105 : 5 | |
Main : hasName : 114 : 3 | |
Main : logline : 118 : 3 | |
Main : log : 122 : 3 | |
------------------------------------- | |
src/com/example/testcode/Test01.java | |
------------------------------------- | |
[class com.github.javaparser.ast.CompilationUnit] : package com.example.testcode; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* aaaaaaaaa | |
*/ | |
public class Test01 { | |
public static final String BUZZ = "buzz"; | |
public static void main(String[] args) { | |
new Test01().foo(); | |
} | |
private class Test01Child { | |
private int childMethod(int i) { | |
return i * 2; | |
} | |
} | |
public void foo() { | |
List<String> l1 = Arrays.asList("a", "b", "c"); | |
; | |
List<String> l2 = Arrays.asList("X", "Y", "Z"); | |
l1.stream().forEach(x1 -> { | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
}); | |
l2.stream().forEach(x3 -> { | |
System.out.println(x3); | |
}); | |
} | |
public int bar(String str) { | |
int ret = Integer.parseInt(str); | |
return ret; | |
} | |
} | |
[class com.github.javaparser.ast.PackageDeclaration] : package com.example.testcode; | |
[class com.github.javaparser.ast.expr.Name] : com.example.testcode | |
[class com.github.javaparser.ast.expr.Name] : com.example | |
[class com.github.javaparser.ast.expr.Name] : com | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.util.Arrays; | |
[class com.github.javaparser.ast.expr.Name] : java.util.Arrays | |
[class com.github.javaparser.ast.expr.Name] : java.util | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.ImportDeclaration] : import java.util.List; | |
[class com.github.javaparser.ast.expr.Name] : java.util.List | |
[class com.github.javaparser.ast.expr.Name] : java.util | |
[class com.github.javaparser.ast.expr.Name] : java | |
[class com.github.javaparser.ast.body.ClassOrInterfaceDeclaration] : /** | |
* aaaaaaaaa | |
*/ | |
public class Test01 { | |
public static final String BUZZ = "buzz"; | |
public static void main(String[] args) { | |
new Test01().foo(); | |
} | |
private class Test01Child { | |
private int childMethod(int i) { | |
return i * 2; | |
} | |
} | |
public void foo() { | |
List<String> l1 = Arrays.asList("a", "b", "c"); | |
; | |
List<String> l2 = Arrays.asList("X", "Y", "Z"); | |
l1.stream().forEach(x1 -> { | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
}); | |
l2.stream().forEach(x3 -> { | |
System.out.println(x3); | |
}); | |
} | |
public int bar(String str) { | |
int ret = Integer.parseInt(str); | |
return ret; | |
} | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : Test01 | |
[class com.github.javaparser.ast.body.FieldDeclaration] : public static final String BUZZ = "buzz"; | |
[class com.github.javaparser.ast.body.VariableDeclarator] : BUZZ = "buzz" | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : BUZZ | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "buzz" | |
[class com.github.javaparser.ast.body.MethodDeclaration] : public static void main(String[] args) { | |
new Test01().foo(); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : main | |
[class com.github.javaparser.ast.body.Parameter] : String[] args | |
[class com.github.javaparser.ast.type.ArrayType] : String[] | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : args | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
new Test01().foo(); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : new Test01().foo(); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : new Test01().foo() | |
[class com.github.javaparser.ast.expr.ObjectCreationExpr] : new Test01() | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : Test01 | |
[class com.github.javaparser.ast.expr.SimpleName] : Test01 | |
[class com.github.javaparser.ast.expr.SimpleName] : foo | |
[class com.github.javaparser.ast.body.ClassOrInterfaceDeclaration] : private class Test01Child { | |
private int childMethod(int i) { | |
return i * 2; | |
} | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : Test01Child | |
[class com.github.javaparser.ast.body.MethodDeclaration] : private int childMethod(int i) { | |
return i * 2; | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : childMethod | |
[class com.github.javaparser.ast.body.Parameter] : int i | |
[class com.github.javaparser.ast.type.PrimitiveType] : int | |
[class com.github.javaparser.ast.expr.SimpleName] : i | |
[class com.github.javaparser.ast.type.PrimitiveType] : int | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
return i * 2; | |
} | |
[class com.github.javaparser.ast.stmt.ReturnStmt] : return i * 2; | |
[class com.github.javaparser.ast.expr.BinaryExpr] : i * 2 | |
[class com.github.javaparser.ast.expr.NameExpr] : i | |
[class com.github.javaparser.ast.expr.SimpleName] : i | |
[class com.github.javaparser.ast.expr.IntegerLiteralExpr] : 2 | |
[class com.github.javaparser.ast.body.MethodDeclaration] : public void foo() { | |
List<String> l1 = Arrays.asList("a", "b", "c"); | |
; | |
List<String> l2 = Arrays.asList("X", "Y", "Z"); | |
l1.stream().forEach(x1 -> { | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
}); | |
l2.stream().forEach(x3 -> { | |
System.out.println(x3); | |
}); | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : foo | |
[class com.github.javaparser.ast.type.VoidType] : void | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
List<String> l1 = Arrays.asList("a", "b", "c"); | |
; | |
List<String> l2 = Arrays.asList("X", "Y", "Z"); | |
l1.stream().forEach(x1 -> { | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
}); | |
l2.stream().forEach(x3 -> { | |
System.out.println(x3); | |
}); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : List<String> l1 = Arrays.asList("a", "b", "c"); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : List<String> l1 = Arrays.asList("a", "b", "c") | |
[class com.github.javaparser.ast.body.VariableDeclarator] : l1 = Arrays.asList("a", "b", "c") | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : List<String> | |
[class com.github.javaparser.ast.expr.SimpleName] : List | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : l1 | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : Arrays.asList("a", "b", "c") | |
[class com.github.javaparser.ast.expr.NameExpr] : Arrays | |
[class com.github.javaparser.ast.expr.SimpleName] : Arrays | |
[class com.github.javaparser.ast.expr.SimpleName] : asList | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "a" | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "b" | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "c" | |
[class com.github.javaparser.ast.stmt.EmptyStmt] : ; | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : List<String> l2 = Arrays.asList("X", "Y", "Z"); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : List<String> l2 = Arrays.asList("X", "Y", "Z") | |
[class com.github.javaparser.ast.body.VariableDeclarator] : l2 = Arrays.asList("X", "Y", "Z") | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : List<String> | |
[class com.github.javaparser.ast.expr.SimpleName] : List | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : l2 | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : Arrays.asList("X", "Y", "Z") | |
[class com.github.javaparser.ast.expr.NameExpr] : Arrays | |
[class com.github.javaparser.ast.expr.SimpleName] : Arrays | |
[class com.github.javaparser.ast.expr.SimpleName] : asList | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "X" | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "Y" | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "Z" | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : l1.stream().forEach(x1 -> { | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
}); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : l1.stream().forEach(x1 -> { | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
}) | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : l1.stream() | |
[class com.github.javaparser.ast.expr.NameExpr] : l1 | |
[class com.github.javaparser.ast.expr.SimpleName] : l1 | |
[class com.github.javaparser.ast.expr.SimpleName] : stream | |
[class com.github.javaparser.ast.expr.SimpleName] : forEach | |
[class com.github.javaparser.ast.expr.LambdaExpr] : x1 -> { | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
} | |
[class com.github.javaparser.ast.body.Parameter] : x1 | |
[class com.github.javaparser.ast.type.UnknownType] : | |
[class com.github.javaparser.ast.expr.SimpleName] : x1 | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}) | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : l2.stream() | |
[class com.github.javaparser.ast.expr.NameExpr] : l2 | |
[class com.github.javaparser.ast.expr.SimpleName] : l2 | |
[class com.github.javaparser.ast.expr.SimpleName] : stream | |
[class com.github.javaparser.ast.expr.SimpleName] : forEach | |
[class com.github.javaparser.ast.expr.LambdaExpr] : x2 -> { | |
System.out.println(x1 + "," + x2); | |
} | |
[class com.github.javaparser.ast.body.Parameter] : x2 | |
[class com.github.javaparser.ast.type.UnknownType] : | |
[class com.github.javaparser.ast.expr.SimpleName] : x2 | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
System.out.println(x1 + "," + x2); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : System.out.println(x1 + "," + x2); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : System.out.println(x1 + "," + x2) | |
[class com.github.javaparser.ast.expr.FieldAccessExpr] : System.out | |
[class com.github.javaparser.ast.expr.NameExpr] : System | |
[class com.github.javaparser.ast.expr.SimpleName] : System | |
[class com.github.javaparser.ast.expr.SimpleName] : out | |
[class com.github.javaparser.ast.expr.SimpleName] : println | |
[class com.github.javaparser.ast.expr.BinaryExpr] : x1 + "," + x2 | |
[class com.github.javaparser.ast.expr.BinaryExpr] : x1 + "," | |
[class com.github.javaparser.ast.expr.NameExpr] : x1 | |
[class com.github.javaparser.ast.expr.SimpleName] : x1 | |
[class com.github.javaparser.ast.expr.StringLiteralExpr] : "," | |
[class com.github.javaparser.ast.expr.NameExpr] : x2 | |
[class com.github.javaparser.ast.expr.SimpleName] : x2 | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : l2.stream().forEach(x3 -> { | |
System.out.println(x3); | |
}); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : l2.stream().forEach(x3 -> { | |
System.out.println(x3); | |
}) | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : l2.stream() | |
[class com.github.javaparser.ast.expr.NameExpr] : l2 | |
[class com.github.javaparser.ast.expr.SimpleName] : l2 | |
[class com.github.javaparser.ast.expr.SimpleName] : stream | |
[class com.github.javaparser.ast.expr.SimpleName] : forEach | |
[class com.github.javaparser.ast.expr.LambdaExpr] : x3 -> { | |
System.out.println(x3); | |
} | |
[class com.github.javaparser.ast.body.Parameter] : x3 | |
[class com.github.javaparser.ast.type.UnknownType] : | |
[class com.github.javaparser.ast.expr.SimpleName] : x3 | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
System.out.println(x3); | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : System.out.println(x3); | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : System.out.println(x3) | |
[class com.github.javaparser.ast.expr.FieldAccessExpr] : System.out | |
[class com.github.javaparser.ast.expr.NameExpr] : System | |
[class com.github.javaparser.ast.expr.SimpleName] : System | |
[class com.github.javaparser.ast.expr.SimpleName] : out | |
[class com.github.javaparser.ast.expr.SimpleName] : println | |
[class com.github.javaparser.ast.expr.NameExpr] : x3 | |
[class com.github.javaparser.ast.expr.SimpleName] : x3 | |
[class com.github.javaparser.ast.body.MethodDeclaration] : public int bar(String str) { | |
int ret = Integer.parseInt(str); | |
return ret; | |
} | |
[class com.github.javaparser.ast.expr.SimpleName] : bar | |
[class com.github.javaparser.ast.body.Parameter] : String str | |
[class com.github.javaparser.ast.type.ClassOrInterfaceType] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : String | |
[class com.github.javaparser.ast.expr.SimpleName] : str | |
[class com.github.javaparser.ast.type.PrimitiveType] : int | |
[class com.github.javaparser.ast.stmt.BlockStmt] : { | |
int ret = Integer.parseInt(str); | |
return ret; | |
} | |
[class com.github.javaparser.ast.stmt.ExpressionStmt] : int ret = Integer.parseInt(str); | |
[class com.github.javaparser.ast.expr.VariableDeclarationExpr] : int ret = Integer.parseInt(str) | |
[class com.github.javaparser.ast.body.VariableDeclarator] : ret = Integer.parseInt(str) | |
[class com.github.javaparser.ast.type.PrimitiveType] : int | |
[class com.github.javaparser.ast.expr.SimpleName] : ret | |
[class com.github.javaparser.ast.expr.MethodCallExpr] : Integer.parseInt(str) | |
[class com.github.javaparser.ast.expr.NameExpr] : Integer | |
[class com.github.javaparser.ast.expr.SimpleName] : Integer | |
[class com.github.javaparser.ast.expr.SimpleName] : parseInt | |
[class com.github.javaparser.ast.expr.NameExpr] : str | |
[class com.github.javaparser.ast.expr.SimpleName] : str | |
[class com.github.javaparser.ast.stmt.ReturnStmt] : return ret; | |
[class com.github.javaparser.ast.expr.NameExpr] : ret | |
[class com.github.javaparser.ast.expr.SimpleName] : ret | |
------------------------------------- | |
{ | |
"type": "CompilationUnit", | |
"packageDeclaration": { | |
"type": "PackageDeclaration", | |
"name": { | |
"type": "Name", | |
"identifier": "testcode", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "example", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "com" | |
} | |
} | |
} | |
}, | |
"imports": [ | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "Arrays", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "util", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
}, | |
{ | |
"type": "ImportDeclaration", | |
"isAsterisk": "false", | |
"isStatic": "false", | |
"name": { | |
"type": "Name", | |
"identifier": "List", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "util", | |
"qualifier": { | |
"type": "Name", | |
"identifier": "java" | |
} | |
} | |
} | |
} | |
], | |
"types": [ | |
{ | |
"type": "ClassOrInterfaceDeclaration", | |
"isInterface": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Test01" | |
}, | |
"comment": { | |
"type": "JavadocComment", | |
"content": "\n * aaaaaaaaa\n " | |
}, | |
"members": [ | |
{ | |
"type": "FieldDeclaration", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
}, | |
"initializer": { | |
"type": "StringLiteralExpr", | |
"value": "buzz" | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "BUZZ" | |
} | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "foo" | |
}, | |
"scope": { | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Test01" | |
} | |
} | |
} | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "main" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ArrayType", | |
"origin": "TYPE", | |
"componentType": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "args" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "ClassOrInterfaceDeclaration", | |
"isInterface": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Test01Child" | |
}, | |
"members": [ | |
{ | |
"type": { | |
"type": "INT" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ReturnStmt", | |
"expression": { | |
"type": "BinaryExpr", | |
"operator": "MULTIPLY", | |
"left": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "i" | |
} | |
}, | |
"right": { | |
"type": "IntegerLiteralExpr", | |
"value": "2" | |
} | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "childMethod" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "INT" | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "i" | |
} | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"type": { | |
"type": "VoidType" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "List" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
} | |
] | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "asList" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Arrays" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "StringLiteralExpr", | |
"value": "a" | |
}, | |
{ | |
"type": "StringLiteralExpr", | |
"value": "b" | |
}, | |
{ | |
"type": "StringLiteralExpr", | |
"value": "c" | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "l1" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "EmptyStmt" | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "List" | |
}, | |
"typeArguments": [ | |
{ | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
} | |
] | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "asList" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Arrays" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "StringLiteralExpr", | |
"value": "X" | |
}, | |
{ | |
"type": "StringLiteralExpr", | |
"value": "Y" | |
}, | |
{ | |
"type": "StringLiteralExpr", | |
"value": "Z" | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "l2" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "forEach" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "stream" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "l1" | |
} | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "LambdaExpr", | |
"isEnclosingParameters": "false", | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "forEach" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "stream" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "l2" | |
} | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "LambdaExpr", | |
"isEnclosingParameters": "false", | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "println" | |
}, | |
"scope": { | |
"type": "FieldAccessExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "out" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "System" | |
} | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "BinaryExpr", | |
"operator": "PLUS", | |
"left": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x1" | |
} | |
}, | |
"right": { | |
"type": "StringLiteralExpr", | |
"value": "," | |
} | |
}, | |
"right": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x2" | |
} | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "UnknownType" | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x2" | |
} | |
} | |
] | |
} | |
] | |
} | |
} | |
] | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "UnknownType" | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x1" | |
} | |
} | |
] | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "forEach" | |
}, | |
"scope": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "stream" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "l2" | |
} | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "LambdaExpr", | |
"isEnclosingParameters": "false", | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "println" | |
}, | |
"scope": { | |
"type": "FieldAccessExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "out" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "System" | |
} | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x3" | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "UnknownType" | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "x3" | |
} | |
} | |
] | |
} | |
] | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "foo" | |
} | |
}, | |
{ | |
"type": { | |
"type": "INT" | |
}, | |
"body": { | |
"type": "BlockStmt", | |
"statements": [ | |
{ | |
"type": "ExpressionStmt", | |
"expression": { | |
"type": "VariableDeclarationExpr", | |
"variables": [ | |
{ | |
"type": { | |
"type": "INT" | |
}, | |
"initializer": { | |
"type": "MethodCallExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "parseInt" | |
}, | |
"scope": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "Integer" | |
} | |
}, | |
"arguments": [ | |
{ | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "str" | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "ret" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ReturnStmt", | |
"expression": { | |
"type": "NameExpr", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "ret" | |
} | |
} | |
} | |
] | |
}, | |
"name": { | |
"type": "SimpleName", | |
"identifier": "bar" | |
}, | |
"parameters": [ | |
{ | |
"type": { | |
"type": "ClassOrInterfaceType", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "String" | |
} | |
}, | |
"isVarArgs": "false", | |
"name": { | |
"type": "SimpleName", | |
"identifier": "str" | |
} | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
------------------------------------- | |
Test01 : main : 13 : 3 | |
Test01.Test01Child : childMethod : 19 : 3 | |
Test01 : foo : 24 : 18 | |
l2.stream().forEach(x2 -> { | |
System.out.println(x1 + "," + x2); | |
}) | |
3 | |
Test01 : bar : 43 : 4 | |
Process finished with exit code 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment