From 6a9e7c2b6cb0d18e3bd9c387d7918968d92ee885 Mon Sep 17 00:00:00 2001 From: sarps Date: Fri, 3 May 2024 16:50:19 +0200 Subject: [PATCH] Remove all Main methods, since there might be multiple main methods in a java file, given different classes etc. --- src/main/java/de/tum/in/test/api/ast/model/JavaFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/tum/in/test/api/ast/model/JavaFile.java b/src/main/java/de/tum/in/test/api/ast/model/JavaFile.java index 7b95b9c5..a5b7c619 100644 --- a/src/main/java/de/tum/in/test/api/ast/model/JavaFile.java +++ b/src/main/java/de/tum/in/test/api/ast/model/JavaFile.java @@ -41,7 +41,7 @@ private static void excludeMainMethod(CompilationUnit javaFileAST) { .filter(method -> method.isStatic() && method.getNameAsString().equals("main") && method.getParameters().size() == 1 && method.getType().isVoidType() && method.getParameter(0).getTypeAsString().equals("String[]")) - .findAny().ifPresent(Node::remove); + .forEach(Node::remove); } public Path getJavaFilePath() {