gnodet commented on code in PR #1220:
URL: https://github.com/apache/maven/pull/1220#discussion_r1321137864


##########
maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java:
##########
@@ -152,16 +149,15 @@ private ClassRealm createRealm(
             List<String> parentImports,
             Map<String, ClassLoader> foreignImports,
             List<Artifact> artifacts) {
-        Set<String> artifactIds = new LinkedHashSet<>();
-
-        List<ClassRealmConstituent> constituents = new ArrayList<>();
+        List<ClassRealmConstituent> constituents = new ArrayList<>(artifacts 
== null ? 0 : artifacts.size());
 
-        if (artifacts != null) {
+        if (artifacts != null && !artifacts.isEmpty()) {
             for (Artifact artifact : artifacts) {
                 if (!isProvidedArtifact(artifact)) {
-                    artifactIds.add(getId(artifact));
                     if (artifact.getFile() != null) {
                         constituents.add(new 
ArtifactClassRealmConstituent(artifact));
+                    } else if (logger.isDebugEnabled()) {
+                        logger.debug("  Excluded: {}", getId(artifact));

Review Comment:
   Re-reading this PR before merging, I think this is slightly wrong.
   I think artifacts should be considered excluded and logged if 
`isProvidedArtifact` returns `true`, which I think is the main reason for the 
exclusion, as they kinda are supposed to always point to a file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to