sebastien-doyon commented on code in PR #1220: URL: https://github.com/apache/maven/pull/1220#discussion_r1315813792
########## maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java: ########## @@ -152,14 +150,15 @@ private ClassRealm createRealm( List<String> parentImports, Map<String, ClassLoader> foreignImports, List<Artifact> artifacts) { - Set<String> artifactIds = new LinkedHashSet<>(); + Set<String> artifactIds = new LinkedHashSet<>(artifacts == null ? 0 : artifacts.size()); + List<ClassRealmConstituent> constituents = new ArrayList<>(artifacts == null ? 0 : artifacts.size()); - List<ClassRealmConstituent> constituents = new ArrayList<>(); - - if (artifacts != null) { + if (artifacts != null && !artifacts.isEmpty()) { for (Artifact artifact : artifacts) { if (!isProvidedArtifact(artifact)) { - artifactIds.add(getId(artifact)); + if (logger.isDebugEnabled()) { + artifactIds.add(getId(artifact)); + } Review Comment: I made a commit with the proposed changes (direct link [here](https://github.com/apache/maven/pull/1220/commits/9fd8b54a045a8b98fd7edad3bea010242a37340c)), please comment. This is reducing the number of isDebugEnabled() blocks and the collections used only for logging informations. The business logic is unchanged and the logged information is the same. -- 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