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-lang.git
The following commit(s) were added to refs/heads/master by this push:
new cfe934e Better private method name.
cfe934e is described below
commit cfe934e2d057072e29cabb0a1c9db93a85ac5d63
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jul 10 10:25:48 2021 -0400
Better private method name.
---
.../commons/lang3/exception/ExceptionUtils.java | 24 +++++++++++-----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git
a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
index 0041341..1913a3b 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
@@ -69,6 +69,17 @@ public class ExceptionUtils {
static final String WRAPPED_MARKER = " [wrapped] ";
/**
+ * Claims a Throwable is another Exception type using type erasure. This
+ * hides a checked exception from the Java compiler, allowing a checked
+ * exception to be thrown without having the exception in the method's
throw
+ * clause.
+ */
+ @SuppressWarnings("unchecked")
+ private static <R, T extends Throwable> R eraseType(final Throwable
throwable) throws T {
+ throw (T) throwable;
+ }
+
+ /**
* Introspects the {@code Throwable} to obtain the cause.
*
* <p>The method searches for methods with specific names that return a
@@ -753,7 +764,7 @@ public class ExceptionUtils {
*/
public static <R> R rethrow(final Throwable throwable) {
// claim that the typeErasure invocation throws a RuntimeException
- return ExceptionUtils.<R, RuntimeException>typeErasure(throwable);
+ return ExceptionUtils.<R, RuntimeException>eraseType(throwable);
}
/**
@@ -886,17 +897,6 @@ public class ExceptionUtils {
}
/**
- * Claims a Throwable is another Exception type using type erasure. This
- * hides a checked exception from the Java compiler, allowing a checked
- * exception to be thrown without having the exception in the method's
throw
- * clause.
- */
- @SuppressWarnings("unchecked")
- private static <R, T extends Throwable> R typeErasure(final Throwable
throwable) throws T {
- throw (T) throwable;
- }
-
- /**
* Throws a checked exception without adding the exception to the throws
* clause of the calling method. For checked exceptions, this method throws
* an UndeclaredThrowableException wrapping the checked exception. For