You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "efegokdemir (via GitHub)" <gi...@apache.org> on 2026/09/24 06:05:32 UTC

[PR] Avoid mutating paths in EAR module getters [maven-ear-plugin]

efegokdemir opened a new pull request, #561:
URL: https://github.com/apache/maven-ear-plugin/pull/561

   ## Summary
   
   Keep `AbstractEarModule#getBundleDir()` and `getLibDir()` side-effect free. The getters still return normalized archive paths, but no longer overwrite the configured values.
   
   Added regression coverage proving repeated access does not mutate either configured field.
   
   Fixes #516
   
   ## Testing
   
   - `mvn -Dspotless.skip=true -DskipTests=false test` — passed (49 tests)
   - Checkstyle, RAT, and `git diff --check` — passed
   - `mvn -Prun-its -Dspotless.skip=true -DskipTests=false verify` — unit/build phases passed; integration tests were interrupted after the local JDK 27/Groovy incompatibility (`Unsupported class file major version 71`) appeared
   
   Spotless was skipped because the repository formatter is incompatible with the available local JDK.


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


Re: [PR] Avoid mutating paths in EAR module getters [maven-ear-plugin]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #561:
URL: https://github.com/apache/maven-ear-plugin/pull/561#discussion_r4360217902


##########
src/test/java/org/apache/maven/plugins/ear/EarModuleTest.java:
##########
@@ -40,4 +40,16 @@ void testCleanArchivePath() {
         assertEquals("", AbstractEarModule.cleanArchivePath(""));
         assertNull(AbstractEarModule.cleanArchivePath(null));
     }
+
+    @Test
+    void gettersDoNotModifyConfiguredPaths() {
+        AbstractEarModule module = new JarModule();
+        module.bundleDir = "/APP-INF/lib";
+        module.libDirectory = "/libraries";
+
+        assertEquals("APP-INF/lib/", module.getBundleDir());
+        assertEquals("/APP-INF/lib", module.bundleDir);
+        assertEquals("libraries/", module.getLibDir());
+        assertEquals("/libraries", module.libDirectory);

Review Comment:
   This test verifies getters don’t mutate configured fields after a single access, but it doesn’t exercise *repeated* access (idempotence) as described in the PR summary. Consider calling `getBundleDir()`/`getLibDir()` at least twice and asserting (1) the returned value remains stable across calls and (2) `bundleDir`/`libDirectory` remain unchanged after each call.



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


Re: [PR] Avoid mutating paths in EAR module getters [maven-ear-plugin]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #561:
URL: https://github.com/apache/maven-ear-plugin/pull/561#discussion_r4360084740


##########
src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java:
##########
@@ -238,16 +238,14 @@ public String getClassifier() {
      * @return the custom bundle directory
      */
     public String getBundleDir() {
-        bundleDir = cleanArchivePath(bundleDir);
-        return bundleDir;
+        return cleanArchivePath(bundleDir);

Review Comment:
   Why do these clean at all? Shouldn't they instead just return the field value?



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