You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/06/30 14:44:50 UTC
(commons-logging) 05/05: Use generics
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git
commit 50bc992aafaf806aef57c07640647e502dd0081c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 10:44:40 2024 -0400
Use generics
---
.../commons/logging/pathable/ParentFirstTestCase.java | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java b/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java
index 77d7f67..d57f9b4 100644
--- a/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java
+++ b/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java
@@ -94,14 +94,13 @@ public class ParentFirstTestCase extends TestCase {
/**
* Utility method to convert an enumeration-of-URLs into an array of URLs.
*/
- private static URL[] toURLArray(final Enumeration e) {
- final ArrayList l = new ArrayList();
+ private static URL[] toURLArray(final Enumeration<URL> e) {
+ final ArrayList<URL> l = new ArrayList<>();
while (e.hasMoreElements()) {
- final URL u = (URL) e.nextElement();
- l.add(u);
+ l.add(e.nextElement());
}
final URL[] tmp = new URL[l.size()];
- return (URL[]) l.toArray(tmp);
+ return l.toArray(tmp);
}
/**
@@ -109,8 +108,8 @@ public class ParentFirstTestCase extends TestCase {
* parent chain starting from the one that loaded the class for
* this object instance.
*/
- private Set getAncestorCLs() {
- final Set s = new HashSet();
+ private Set<ClassLoader> getAncestorCLs() {
+ final Set<ClassLoader> s = new HashSet<>();
ClassLoader cl = this.getClass().getClassLoader();
while (cl != null) {
s.add(cl);