Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove commons-collections dependency #9004

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions core/pom.xml
Expand Up @@ -156,10 +156,6 @@ THE SOFTWARE.
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
Comment on lines -159 to -162
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this can be removed, we should identify usages in plugins. See this guide for how to do that.

<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
Expand Down
9 changes: 7 additions & 2 deletions core/src/main/java/hudson/util/LRUStringConverter.java
Expand Up @@ -2,8 +2,8 @@

import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.commons.collections.map.LRUMap;

public class LRUStringConverter extends AbstractSingleValueConverter {

Expand All @@ -18,7 +18,12 @@
}

public LRUStringConverter(int size) {
cache = Collections.synchronizedMap(new LRUMap(size));
cache = Collections.synchronizedMap(new LinkedHashMap<>(size, 0.75f, true) {
@Override
protected boolean removeEldestEntry(Map.Entry<String, String> eldest) {
return size() > size;

Check warning on line 24 in core/src/main/java/hudson/util/LRUStringConverter.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 24 is not covered by tests
}
});
}

@Override
Expand Down