Skip to content

Commit

Permalink
Honor parentFirst in QuarkusClassLoader#getElementsWithResource()
Browse files Browse the repository at this point in the history
For whatever reason, we weren't honoring parentFirst in this method
which looks like an oversight and un undesirable behavior.
  • Loading branch information
gsmet committed Aug 16, 2024
1 parent e37e940 commit add0e8f
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -602,15 +602,21 @@ public List<ClassPathElement> getElementsWithResource(String name) {
public List<ClassPathElement> getElementsWithResource(String name, boolean localOnly) {
ensureOpen(name);

boolean parentFirst = parentFirst(name, getClassPathResourceIndex());

List<ClassPathElement> ret = new ArrayList<>();
if (parent instanceof QuarkusClassLoader && !localOnly) {

if (parentFirst && !localOnly && parent instanceof QuarkusClassLoader) {
ret.addAll(((QuarkusClassLoader) parent).getElementsWithResource(name));
}

List<ClassPathElement> classPathElements = getClassPathResourceIndex().getClassPathElements(name);
if (classPathElements.isEmpty()) {
return ret;
}
ret.addAll(classPathElements);

if (!parentFirst && !localOnly && parent instanceof QuarkusClassLoader) {
ret.addAll(((QuarkusClassLoader) parent).getElementsWithResource(name));
}

return ret;
}

Expand Down

0 comments on commit add0e8f

Please sign in to comment.