removal of a not used argument
This commit is contained in:
@@ -29,6 +29,7 @@ public class Main {
|
||||
private static final List<String> TARGET_ANNOTATIONS = List.of("EnableStateMachineFactory", "EnableStateMachine");
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
AstFileFinder finder = new AstFileFinder();
|
||||
List<Path> javaFiles = FileUtils.findFilesWithExtension(Paths.get(START_DIR), EXTENSION);
|
||||
|
||||
// List of output handlers
|
||||
@@ -40,7 +41,6 @@ public class Main {
|
||||
|
||||
for (Path javaFile : javaFiles) {
|
||||
String source = Files.readString(javaFile);
|
||||
AstFileFinder finder = new AstFileFinder(source);
|
||||
|
||||
if (finder.hasClassWithAnnotation(source, TARGET_ANNOTATIONS)) {
|
||||
System.out.println("Found annotation in: " + javaFile.toAbsolutePath());
|
||||
|
||||
@@ -6,17 +6,17 @@ import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class AstFileFinder {
|
||||
private final CompilationUnit cu;
|
||||
private final ASTParser parser;
|
||||
|
||||
public AstFileFinder(String source) {
|
||||
ASTParser parser = ASTParser.newParser(AST.getJLSLatest());
|
||||
public AstFileFinder() {
|
||||
this.parser = ASTParser.newParser(AST.getJLSLatest());
|
||||
parser.setKind(ASTParser.K_COMPILATION_UNIT);
|
||||
parser.setResolveBindings(false);
|
||||
parser.setSource(source.toCharArray());
|
||||
this.cu = (CompilationUnit) parser.createAST(null);
|
||||
}
|
||||
|
||||
public boolean hasClassWithAnnotation(String source, List<String> annotationNames) {
|
||||
parser.setSource(source.toCharArray());
|
||||
CompilationUnit cu = (CompilationUnit) parser.createAST(null);
|
||||
AtomicBoolean found = new AtomicBoolean(false);
|
||||
cu.accept(new ASTVisitor() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user