Skip to content

Commit

Permalink
Merge pull request #43741 from Ladicek/arc-arquillian-deployment-cl-j…
Browse files Browse the repository at this point in the history
…avadoc

ArC: add javadoc to Arquillian DeploymentClassLoader
  • Loading branch information
mkouba authored Oct 7, 2024
2 parents 1a98bdf + 66fae15 commit 60019a5
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import io.quarkus.arc.ComponentsProvider;

/**
* Loads the test classes and ArC-generated classes for an Arquillian test. There's one
* {@code DeploymentClassLoader} for each test, which is closed at the end.
* <p>
* The delegation model of this class loader is "child first". That is, this class loader
* attempts to find the requested class on its own (which succeeds for the test classes and
* ArC-generated classes) and it only delegates to the parent if it fails. This makes sure
* that the ArC-generated classes have package-level visibility into test classes, which
* would not be the case if the test classes were loaded by the parent.
*/
final class DeploymentClassLoader extends URLClassLoader {
static {
ClassLoader.registerAsParallelCapable();
Expand All @@ -34,8 +43,7 @@ private static URL[] findUrls(DeploymentDir deploymentDir) throws IOException {
result.add(deploymentDir.generatedClasses.toUri().toURL());

try (Stream<Path> stream = Files.walk(deploymentDir.appLibraries)) {
List<Path> jars = stream.filter(p -> p.toString().endsWith(".jar")).collect(Collectors.toList());
for (Path jar : jars) {
for (Path jar : stream.filter(p -> p.toString().endsWith(".jar")).toList()) {
result.add(jar.toUri().toURL());
}
}
Expand Down

0 comments on commit 60019a5

Please sign in to comment.