sanjana2505006 commented on code in PR #270:
URL:
https://github.com/apache/maven-dependency-analyzer/pull/270#discussion_r3003341066
##########
src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java:
##########
@@ -260,13 +259,16 @@ private static boolean includedInJDK(Artifact artifact) {
return false;
}
- private static Artifact findArtifactForClassName(Map<Artifact,
Set<String>> artifactClassMap, String className) {
+ private static Map<String, Artifact> buildClassToArtifactMap(Map<Artifact,
Set<String>> artifactClassMap) {
+ Map<String, Artifact> classToArtifactMap = new HashMap<>();
+
for (Map.Entry<Artifact, Set<String>> entry :
artifactClassMap.entrySet()) {
- if (entry.getValue().contains(className)) {
- return entry.getKey();
+ Artifact artifact = entry.getKey();
+ for (String className : entry.getValue()) {
+ classToArtifactMap.put(className, artifact);
Review Comment:
I've updated it to `putIfAbsent` in the latest commit to preserve the
original first-match-wins semantics. Thank you for flagging this,
@slawekjaranowski!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]