desruisseaux commented on code in PR #3392:
URL: https://github.com/apache/maven-surefire/pull/3392#discussion_r3613562792


##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java:
##########
@@ -184,6 +187,16 @@ File createArgsFile(
                         .append('"')
                         .append(NL);
 
+                // Check for module-info-patch.args generated by 
maven-compiler-plugin 4.x
+                File patchArgs = findModuleInfoPatchArgs(patchFile);
+                if (patchArgs != null) {
+                    // Merge the file's directives, except 
--add-reads/--add-modules
+                    // which surefire manages itself (see 
appendModuleInfoPatchArgs)
+                    appendModuleInfoPatchArgs(args, patchArgs, moduleName);
+                }
+
+                // Always auto-generate --add-opens for test packages (JUnit 
needs reflection access).
+                // module-info-patch.maven cannot use ALL-UNNAMED in 
add-opens, so surefire handles this.

Review Comment:
   Correction: Surefire would still need to generate `--add-exports` for each 
non-exported package to JUnit. These `--add-exports` are not present in the 
`module-info-patch.args` file because they were not needed for compilation, but 
they are needed for execution.
   
   If the test methods are public, `--add-exports` are sufficient. If the test 
methods are private, `--add-exports` need to be replaced by `--add-opens` (I'm 
not sure that we need both, let's try if we can provide only one of these 
options). The use of `--add-exports` versus `--add-opens` could be controlled 
by the configuration option suggested in above comment.



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

Reply via email to