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 2021/07/24 23:34:57 UTC
[commons-pool] branch master updated: Inline variables when only
used once immediately in a return.
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-pool.git
The following commit(s) were added to refs/heads/master by this push:
new 74516b5 Inline variables when only used once immediately in a return.
74516b5 is described below
commit 74516b59cc36b69847ae0f60ff00e02ea5423e6a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 24 19:34:53 2021 -0400
Inline variables when only used once immediately in a return.
Remove unused import.
---
.../java/org/apache/commons/pool2/TestPoolUtils.java | 19 ++++++-------------
.../commons/pool2/impl/TestGenericObjectPool.java | 1 -
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/src/test/java/org/apache/commons/pool2/TestPoolUtils.java b/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
index 45a94d9..e365e18 100644
--- a/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
+++ b/src/test/java/org/apache/commons/pool2/TestPoolUtils.java
@@ -90,12 +90,9 @@ public class TestPoolUtils {
/** Sleep time to let the minIdle tests run CHECK_COUNT times. */
private static final int CHECK_SLEEP_PERIOD = CHECK_PERIOD * (CHECK_COUNT - 1) + CHECK_PERIOD / 2;
+ @SuppressWarnings("unchecked")
private static <T> T createProxy(final Class<T> clazz, final InvocationHandler handler) {
- @SuppressWarnings("unchecked")
- final
- T ret = (T) Proxy.newProxyInstance(
- clazz.getClassLoader(), new Class[] { clazz }, handler);
- return ret;
+ return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz }, handler);
}
private static <T> T createProxy(final Class<T> clazz, final List<String> logger) {
@@ -116,9 +113,8 @@ public class TestPoolUtils {
kop.returnObject(null, new Object());
kop.toString();
- final List<String> expectedMethods = Arrays.asList("addObject", "borrowObject", "clear", "clear", "close", "getNumActive", "getNumActive",
+ return Arrays.asList("addObject", "borrowObject", "clear", "clear", "close", "getNumActive", "getNumActive",
"getNumIdle", "getNumIdle", "invalidateObject", "returnObject", "toString");
- return expectedMethods;
}
private static <K, V> List<String> invokeEveryMethod(final KeyedPooledObjectFactory<K, V> kpof) throws Exception {
@@ -129,8 +125,7 @@ public class TestPoolUtils {
kpof.validateObject(null, null);
kpof.toString();
- final List<String> expectedMethods = Arrays.asList("activateObject", "destroyObject", "makeObject", "passivateObject", "validateObject", "toString");
- return expectedMethods;
+ return Arrays.asList("activateObject", "destroyObject", "makeObject", "passivateObject", "validateObject", "toString");
}
private static List<String> invokeEveryMethod(final ObjectPool<Object> op) throws Exception {
@@ -144,9 +139,8 @@ public class TestPoolUtils {
op.returnObject(new Object());
op.toString();
- final List<String> expectedMethods = Arrays.asList("addObject", "borrowObject", "clear", "close", "getNumActive", "getNumIdle", "invalidateObject",
+ return Arrays.asList("addObject", "borrowObject", "clear", "close", "getNumActive", "getNumIdle", "invalidateObject",
"returnObject", "toString");
- return expectedMethods;
}
private static <T> List<String> invokeEveryMethod(final PooledObjectFactory<T> pof) throws Exception {
@@ -157,8 +151,7 @@ public class TestPoolUtils {
pof.validateObject(null);
pof.toString();
- final List<String> expectedMethods = Arrays.asList("activateObject", "destroyObject", "makeObject", "passivateObject", "validateObject", "toString");
- return expectedMethods;
+ return Arrays.asList("activateObject", "destroyObject", "makeObject", "passivateObject", "validateObject", "toString");
}
@Test
diff --git a/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java b/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
index 5c66d47..7de9ec6 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
@@ -59,7 +59,6 @@ import org.apache.commons.pool2.VisitTracker;
import org.apache.commons.pool2.VisitTrackerFactory;
import org.apache.commons.pool2.Waiter;
import org.apache.commons.pool2.WaiterFactory;
-import org.apache.commons.pool2.impl.TestGenericKeyedObjectPool.SimpleFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;