ccorsi commented on a change in pull request #36:
URL: 
https://github.com/apache/maven-compiler-plugin/pull/36#discussion_r546706179



##########
File path: src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
##########
@@ -319,7 +352,42 @@ else if ( Double.valueOf( getTarget() ) < Double.valueOf( 
MODULE_INFO_TARGET ) )
         if ( testModuleDescriptor != null )
         {
             modulepathElements = testPath;
-            classpathElements = Collections.emptyList();
+            classpathElements = null;
+            for ( String path : modulepathElements )
+            {
+                File file = new File( path );
+                if ( file.exists() && ! file.isDirectory() && 
file.getName().endsWith( ".jar" ) )
+                {
+                    // check if the jar file contains the module-info.class
+                    try
+                    {
+                        JarFile jarFile = new JarFile( file );
+                        if ( jarFile.getJarEntry( "module-info.class" ) == 
null )
+                        {
+                            if ( getLog().isDebugEnabled() )
+                            {
+                                getLog().debug( "Add non-module jar dependency 
" + path
+                                        + " to class path." );
+                            }
+                            if ( classpathElements ==  null )
+                            {
+                                classpathElements = new ArrayList<String>();
+                            }
+                            // add the path to the classpathElements list.
+                            classpathElements.add( path );
+                        }

Review comment:
       Not sure exactly how you want me to refactor this code.  The build 
checkstyle definition forced me into this code style.  I did combine the debug 
statement within a single line.  The only other option is to extract this set 
of code and create a private method.  That would reduce the indentation.  Is 
this what you were thinking?




----------------------------------------------------------------
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.

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


Reply via email to