Created
March 3, 2020 17:03
-
-
Save mauricioaniche/b289cd6e3f523d0512251bb2d88c0844 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public static void main(String[] args) throws FileNotFoundException { | |
CompilationUnit cu = StaticJavaParser.parse(new FileInputStream("/Users/mauricioaniche/workspace/logremoval/fixture/A.java")); | |
cu.accept(new ModifierVisitor<Void>() { | |
@Override | |
public Visitable visit(final MethodCallExpr n, Void arg) { | |
boolean isALogClass = n.getScope().isPresent() && (logClasses.stream().anyMatch(x -> n.getScope().get().toString().startsWith(x))); | |
boolean isALogMethod = logMethods.contains(n.getName().asString()); | |
if(isALogClass && isALogMethod) { | |
System.out.println("log call!"); | |
n.getScope().get().remove(); | |
} | |
return super.visit(n, arg); | |
} | |
}, null); | |
System.out.println(cu.toString()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment