Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}

dependencies {
compile group: 'com.github.javaparser', name:'javaparser-core', version: '3.2.3'
compile group: 'com.github.javaparser', name:'javaparser-core', version: '3.5.3'
compile group: 'com.google.guava', name: 'guava', version: '11.0.2'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static void main(String[] args) {
Expression expressionNode = JavaParser.parseExpression("1 + 2");

// Parse a body declaration: it could be either a field or a method or an inner class
BodyDeclaration methodNode = JavaParser.parseClassBodyDeclaration(
BodyDeclaration methodNode = JavaParser.parseBodyDeclaration(
"boolean invert(boolean aFlag) { return !p; }");

// Parse the code of an entire source file, a.k.a. a Compilation Unit
Expand Down
17 changes: 7 additions & 10 deletions src/main/java/me/tomassetti/examples/StatementsLinesExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ public static void statementsByLine(File projectDir) {
System.out.println(path);
System.out.println(Strings.repeat("=", path.length()));
try {
new NodeIterator(new NodeIterator.NodeHandler() {
@Override
public boolean handle(Node node) {
if (node instanceof Statement) {
System.out.println(" [Lines " + node.getBegin().get().line
+ " - " + node.getEnd().get().line + " ] " + node);
return false;
} else {
return true;
}
new NodeIterator(node -> {
if (node instanceof Statement) {
System.out.println(" [Lines " + node.getBegin().get().line
+ " - " + node.getEnd().get().line + " ] " + node);
return false;
} else {
return true;
}
}).explore(JavaParser.parse(file));
System.out.println(); // empty line
Expand Down