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:45 UTC
(commons-logging) branch master updated (5b35ee8 -> 50bc992)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-logging.git
from 5b35ee8 Javadoc
new ab4b5c5 Inline single use local variable
new d6ae2ef Use generics
new 5c34ad7 Use generics
new 4162141 Use generics
new 50bc992 Use generics
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../commons/logging/pathable/ChildFirstTestCase.java | 17 ++++++++---------
.../commons/logging/pathable/ParentFirstTestCase.java | 13 ++++++-------
.../commons/logging/simple/CustomConfigTestCase.java | 15 +++++++--------
3 files changed, 21 insertions(+), 24 deletions(-)
(commons-logging) 03/05: Use generics
Posted by gg...@apache.org.
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 5c34ad7d9a39befe4369b0f7cc1a66dc132cb869
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 08:38:32 2024 -0400
Use generics
---
.../org/apache/commons/logging/pathable/ChildFirstTestCase.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java b/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
index 2790d5d..4f2e6f8 100644
--- a/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
+++ b/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
@@ -109,8 +109,8 @@ public class ChildFirstTestCase 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);
@@ -168,7 +168,7 @@ public class ChildFirstTestCase extends TestCase {
// in the hierarchy of parent class loaders for this class,
// though it is accessible due to trickery in the PathableClassLoader.
final Class junitTest = contextLoader.loadClass("junit.framework.Test");
- final Set ancestorCLs = getAncestorCLs();
+ final Set<ClassLoader> ancestorCLs = getAncestorCLs();
assertFalse("Junit not loaded by ancestor class loader",
ancestorCLs.contains(junitTest.getClassLoader()));
(commons-logging) 05/05: Use generics
Posted by gg...@apache.org.
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);
(commons-logging) 01/05: Inline single use local variable
Posted by gg...@apache.org.
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 ab4b5c50d8776d33a7c3c3f1222cf7034a6a379d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 08:33:02 2024 -0400
Inline single use local variable
---
.../java/org/apache/commons/logging/pathable/ChildFirstTestCase.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java b/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
index 49262e3..e30206a 100644
--- a/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
+++ b/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
@@ -98,8 +98,7 @@ public class ChildFirstTestCase extends TestCase {
private static URL[] toURLArray(final Enumeration e) {
final ArrayList l = new ArrayList();
while (e.hasMoreElements()) {
- final URL u = (URL) e.nextElement();
- l.add(u);
+ l.add((URL) e.nextElement());
}
final URL[] tmp = new URL[l.size()];
return (URL[]) l.toArray(tmp);
(commons-logging) 04/05: Use generics
Posted by gg...@apache.org.
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 41621417cb298b51e33d9cbdf0b417ace18d881a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 08:43:01 2024 -0400
Use generics
---
.../commons/logging/simple/CustomConfigTestCase.java | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/test/java/org/apache/commons/logging/simple/CustomConfigTestCase.java b/src/test/java/org/apache/commons/logging/simple/CustomConfigTestCase.java
index 9b45fe4..1d159a3 100644
--- a/src/test/java/org/apache/commons/logging/simple/CustomConfigTestCase.java
+++ b/src/test/java/org/apache/commons/logging/simple/CustomConfigTestCase.java
@@ -70,7 +70,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
/**
* <p>The expected log records.</p>
*/
- protected List expected;
+ protected List<LogRecord> expected;
/**
* <p>The message strings that should have been logged.</p>
@@ -109,18 +109,17 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
/** Hook for subclasses */
protected void checkDecoratedDateTime() {
- assertEquals("yyyy/MM/dd HH:mm:ss:SSS zzz",
- ((DecoratedSimpleLog) log).getDateTimeFormat());
+ assertEquals("yyyy/MM/dd HH:mm:ss:SSS zzz", ((DecoratedSimpleLog) log).getDateTimeFormat());
}
// Check the actual log records against the expected ones
protected void checkExpected() {
- final List acts = ((DecoratedSimpleLog) log).getCache();
- final Iterator exps = expected.iterator();
+ final List<LogRecord> acts = ((DecoratedSimpleLog) log).getCache();
+ final Iterator<LogRecord> exps = expected.iterator();
int n = 0;
while (exps.hasNext()) {
- final LogRecord exp = (LogRecord) exps.next();
- final LogRecord act = (LogRecord) acts.get(n++);
+ final LogRecord exp = exps.next();
+ final LogRecord act = acts.get(n++);
assertEquals("Row " + n + " type", exp.type, act.type);
assertEquals("Row " + n + " message", exp.message, act.message);
assertEquals("Row " + n + " throwable", exp.t, act.t);
@@ -197,7 +196,7 @@ public class CustomConfigTestCase extends DefaultConfigTestCase {
public void setUp() throws Exception {
LogFactory.releaseAll();
setProperties();
- expected = new ArrayList();
+ expected = new ArrayList<>();
setUpFactory();
setUpLog("DecoratedLogger");
}
(commons-logging) 02/05: Use generics
Posted by gg...@apache.org.
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 d6ae2efb643f6bc8ea14d7f551d44cb89fd7b55d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 30 08:34:23 2024 -0400
Use generics
---
.../apache/commons/logging/pathable/ChildFirstTestCase.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java b/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
index e30206a..2790d5d 100644
--- a/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
+++ b/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
@@ -95,13 +95,13 @@ public class ChildFirstTestCase 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()) {
- l.add((URL) e.nextElement());
+ l.add(e.nextElement());
}
final URL[] tmp = new URL[l.size()];
- return (URL[]) l.toArray(tmp);
+ return l.toArray(tmp);
}
/**
@@ -266,7 +266,7 @@ public class ChildFirstTestCase extends TestCase {
* Test that the various flavors of ClassLoader.getResources work as expected.
*/
public void testResources() throws Exception {
- Enumeration resources;
+ Enumeration<URL> resources;
URL[] urls;
// verify the class loader hierarchy