You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/02/22 13:09:49 UTC

[GitHub] [maven-dependency-analyzer] michael-o commented on a change in pull request #52: [MSHARED-1036] Analyze project classes only once

michael-o commented on a change in pull request #52:
URL: https://github.com/apache/maven-dependency-analyzer/pull/52#discussion_r811928151



##########
File path: src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java
##########
@@ -201,48 +206,26 @@ else if ( file != null && file.isDirectory() )
         return artifactClassMap;
     }
 
-    private Set<String> buildTestDependencyClasses( MavenProject project ) throws IOException
+    private Set<String> buildTestOnlyDependencyClasses( Set<String> mainDependencyClasses,
+                                                        Set<String> testDependencyClasses )
     {
-        Set<String> testOnlyDependencyClasses = new HashSet<>();
-
-        String outputDirectory = project.getBuild().getOutputDirectory();
-        Set<String> nonTestDependencyClasses = new HashSet<>( buildDependencyClasses( outputDirectory ) );
-
-        String testOutputDirectory = project.getBuild().getTestOutputDirectory();
-        Set<String> testDependencyClasses = new HashSet<>( buildDependencyClasses( testOutputDirectory ) );
-
-        for ( String testString : testDependencyClasses )
-        {
-            if ( !nonTestDependencyClasses.contains( testString ) )
-            {
-                testOnlyDependencyClasses.add( testString );
-            }
-        }
-
-        return testOnlyDependencyClasses;
+        return testDependencyClasses.stream()
+            .filter( klass -> !mainDependencyClasses.contains( klass ) )

Review comment:
       True, `clazz` is more common




-- 
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-unsubscribe@maven.apache.org

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