Copilot commented on code in PR #559:
URL: https://github.com/apache/maven-ear-plugin/pull/559#discussion_r4360271973


##########
src/test/java/org/apache/maven/plugins/ear/EarMojoTest.java:
##########
@@ -54,4 +64,29 @@ void testGetEarFileWithDashPrefixedClassifier() throws 
Exception {
         File result = invokeGetEarFile("myapp", "-sources");
         assertEquals(new File(tempDir, "myapp-sources.ear"), result);
     }
+
+    @Test
+    void testRemoveFromOutdatedResourcesWithDifferentFileSystemProvider() 
throws Exception {
+        EarMojo mojo = new EarMojo(null, null, null, null, null, null);
+        Field workDirectory = 
AbstractEarMojo.class.getDeclaredField("workDirectory");
+        workDirectory.setAccessible(true);
+        workDirectory.set(mojo, tempDir);
+
+        Path archive = tempDir.toPath().resolve("module.war");
+        try (ZipOutputStream ignored = new 
ZipOutputStream(Files.newOutputStream(archive))) {
+            // Create an empty archive before mounting it as a file system.
+        }
+
+        try (FileSystem archiveFileSystem = FileSystems.newFileSystem(archive, 
null)) {

Review Comment:
   `FileSystems.newFileSystem(Path, null)` is brittle because newer JDKs expose 
multiple overloads (`(Path, Map)` and `(Path, ClassLoader)`), and an untyped 
`null` can become ambiguous depending on compile configuration. Prefer 
selecting the overload explicitly (e.g., cast `null` to `ClassLoader`) to keep 
the test compiling reliably across JDK/toolchain changes.



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