|
2 | 2 |
|
3 | 3 |
|
4 | 4 | import com.github.javaparser.JavaParser; |
5 | | -import com.github.javaparser.ParseProblemException; |
6 | 5 | import com.github.javaparser.ParseResult; |
7 | 6 | import com.github.javaparser.ParserConfiguration; |
8 | 7 | import com.github.javaparser.ast.CompilationUnit; |
|
45 | 44 |
|
46 | 45 | import java.io.File; |
47 | 46 | import java.io.IOException; |
48 | | -import java.nio.file.FileVisitOption; |
49 | 47 | import java.nio.file.Files; |
50 | 48 | import java.nio.file.Path; |
51 | | -import java.util.Arrays; |
| 49 | +import java.util.Collection; |
52 | 50 | import java.util.Comparator; |
53 | 51 | import java.util.List; |
| 52 | +import java.util.Set; |
54 | 53 | import java.util.stream.Collectors; |
55 | 54 |
|
56 | 55 | /** |
@@ -96,7 +95,7 @@ public class ModifyEE9ToEE8 |
96 | 95 | * this is a list of String to not translate if starting with |
97 | 96 | */ |
98 | 97 | @Parameter |
99 | | - protected List<String> notTranslateStartsWith = Arrays.asList("https://jakarta.ee/xml/ns/", "http://jakarta.ee/xml/ns/"); |
| 98 | + protected Set<String> notTranslateStartsWith = Set.of("https://jakarta.ee/xml/ns/", "http://jakarta.ee/xml/ns/"); |
100 | 99 |
|
101 | 100 |
|
102 | 101 | public void execute() |
@@ -376,7 +375,7 @@ public Visitable visit(ClassOrInterfaceType n, Void arg) { |
376 | 375 | File ee8Directory = new File(outputDirectory, "org/eclipse/jetty/ee8"); |
377 | 376 | FileUtils.moveDirectory(ee9Directory, ee8Directory); |
378 | 377 | List<Path> pathsEndedJakarta = Files.walk(ee8Directory.toPath()) |
379 | | - .filter(path -> Files.isDirectory(path)) |
| 378 | + .filter(Files::isDirectory) |
380 | 379 | .filter(path -> path.getFileName().endsWith("jakarta")) |
381 | 380 | .collect(Collectors.toList()); |
382 | 381 | pathsEndedJakarta.forEach(path -> { |
@@ -447,8 +446,8 @@ public static String changeEE9TypeToEE8(String currentType) { |
447 | 446 | return null; |
448 | 447 | } |
449 | 448 |
|
450 | | - private boolean startsWith(String str, List<String> startList) { |
451 | | - return startList.stream().filter(s -> str.startsWith(s)).findAny().isPresent(); |
| 449 | + private boolean startsWith(String str, Collection<String> startList) { |
| 450 | + return startList.stream().anyMatch(str::startsWith); |
452 | 451 | } |
453 | 452 |
|
454 | 453 | protected void setSourceProjectLocation(File sourceProjectLocation) { |
|
0 commit comments