elharo opened a new issue, #516:
URL: https://github.com/apache/maven-ear-plugin/issues/516
## Description
In `AbstractEarModule.java:240-251`, the getters `getBundleDir()` and
`getLibDir()` silently mutate instance state:
```java
public String getBundleDir() {
bundleDir = cleanArchivePath(bundleDir); // modifies field
return bundleDir;
}
public String getLibDir() {
libDirectory = cleanArchivePath(libDirectory);
return libDirectory;
}
```
Getters modifying instance fields is surprising and makes debugging harder.
While `cleanArchivePath` is idempotent, the side-effect could cause subtle bugs
if a subclass overrides `getBundleDir()` while the parent field gets modified
elsewhere.
## Expected behavior
Use a local variable instead of assigning to the field:
```java
public String getBundleDir() {
return cleanArchivePath(bundleDir);
}
```
--
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]