From 97879a3a63b392297fb07c0aa6b7454f4d71cb60 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 26 Aug 2024 17:26:23 +0200 Subject: [PATCH] Remove a hack introduced for Liquibase that is no longer needed. With the new index, we don't need that anymore. I tested that the test introduced in this commit is still working fine (LiquibaseExtensionMigrateAtStartDirectoryChangeLogTest). Note that I fixed it as I forgot to consider the less priority elements there and I went for fixing it and then was wondering why this would be even useful. I also introduced a shortcut for empty resource. --- .../bootstrap/classloading/ClassPathResourceIndex.java | 4 ++++ .../bootstrap/classloading/QuarkusClassLoader.java | 9 --------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathResourceIndex.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathResourceIndex.java index 3e91a4b8cdce6..843c2397b1bd2 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathResourceIndex.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathResourceIndex.java @@ -152,6 +152,10 @@ public static Builder builder() { * Probably something we will have to tweak for corner cases but let's try to keep it fast. */ static String getResourceKey(String resource) { + if (resource.isEmpty()) { + return resource; + } + // we don't really care about this part, it can be slower if (resource.startsWith(META_INF_MAVEN)) { return META_INF_MAVEN; diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java index fd7c59ad37ca1..246bed37c2486 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java @@ -270,15 +270,6 @@ public Enumeration getResources(String unsanitisedName, boolean parentAlrea } } } - } else if (name.isEmpty()) { - for (int i = 0; i < normalPriorityElements.size(); i++) { - List resList = normalPriorityElements.get(i).getResources(""); - for (var res : resList) { - if (res != null) { - resources.add(res.getUrl()); - } - } - } } if (!banned) { if ((resources.isEmpty() && !parentAlreadyFoundResources) || aggregateParentResources) {