Created
November 30, 2016 19:15
-
-
Save josejuan/6b63f1d77e292af9884ac3a8df6e99b6 to your computer and use it in GitHub Desktop.
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
try(FileInputStream is = new FileInputStream("bla/bla/src/main/java/FooBarBad.java")) { | |
CompilationUnit cu = JavaParser.parse(is); | |
(new VoidVisitorAdapter() { | |
@Override | |
public void visit(final FieldDeclaration f, Object arg) { | |
super.visit(f, arg); | |
(new VoidVisitorAdapter() { | |
@Override | |
public void visit(VariableDeclaratorId v, Object arg) { | |
super.visit(v, arg); | |
System.out.printf("%s: %s >> remove code: %s\n", f.getType(), v.getName(), f.getRange()); | |
} | |
}).visit(f, null); | |
} | |
}).visit(cu, null); | |
} | |
/* | |
double: foo >> remove code: (line 2,col 5)-(line 2,col 23) | |
int: bar >> remove code: (line 3,col 5)-(line 3,col 20) | |
String: bad >> remove code: (line 4,col 5)-(line 4,col 23) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment