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/02/11 19:25:15 UTC
[commons-lang] branch master updated: Use final.
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 110ab39 Use final.
110ab39 is described below
commit 110ab39cb236fd7e6f517c8dc3b389fa215c0020
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Feb 11 14:25:09 2021 -0500
Use final.
---
.../java/org/apache/commons/lang3/function/Objects.java | 12 ++++++------
.../org/apache/commons/lang3/function/ObjectsTest.java | 16 ++++++++--------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/function/Objects.java b/src/main/java/org/apache/commons/lang3/function/Objects.java
index 5831a73..0ba8361 100755
--- a/src/main/java/org/apache/commons/lang3/function/Objects.java
+++ b/src/main/java/org/apache/commons/lang3/function/Objects.java
@@ -71,7 +71,7 @@ public class Objects {
* @throws NullPointerException The input value was null.
* @see java.util.Objects#requireNonNull(Object)
*/
- public static <T> @Nonnull T requireNonNull(@Nullable T value) throws NullPointerException {
+ public static <T> @Nonnull T requireNonNull(@Nullable final T value) throws NullPointerException {
return requireNonNull(value, "The value must not be null.");
}
@@ -86,7 +86,7 @@ public class Objects {
* @return The given input value, if it was found to be non-null.
* @see java.util.Objects#requireNonNull(Object)
*/
- public static <T> @Nonnull T requireNonNull(@Nullable T value, @Nonnull T defaultValue) throws NullPointerException {
+ public static <T> @Nonnull T requireNonNull(@Nullable final T value, @Nonnull final T defaultValue) throws NullPointerException {
return value == null ? requireNonNull(defaultValue) : value;
}
@@ -102,7 +102,7 @@ public class Objects {
* @see java.util.Objects#requireNonNull(Object, String)
* @see #requireNonNull(Object, Supplier)
*/
- public static <T> @Nonnull T requireNonNull(@Nullable T value, @Nonnull String msg) throws NullPointerException {
+ public static <T> @Nonnull T requireNonNull(@Nullable final T value, @Nonnull final String msg) throws NullPointerException {
if (value == null) {
throw new NullPointerException(msg);
}
@@ -121,7 +121,7 @@ public class Objects {
* @see java.util.Objects#requireNonNull(Object, String)
* @see #requireNonNull(Object, String)
*/
- public static <T> @Nonnull T requireNonNull(@Nullable T value, @Nonnull Supplier<String> msgSupplier) throws NullPointerException {
+ public static <T> @Nonnull T requireNonNull(@Nullable final T value, @Nonnull final Supplier<String> msgSupplier) throws NullPointerException {
if (value == null) {
throw new NullPointerException(msgSupplier.get());
}
@@ -147,13 +147,13 @@ public class Objects {
* @throws NullPointerException The default value supplier is null, or the default
* value supplier has returned null.
*/
- public static <T, E extends Throwable> @Nonnull T requireNonNull(@Nullable T value, @Nonnull FailableSupplier<T, E> defaultValueSupplier) throws NullPointerException {
+ public static <T, E extends Throwable> @Nonnull T requireNonNull(@Nullable final T value, @Nonnull final FailableSupplier<T, E> defaultValueSupplier) throws NullPointerException {
if (value == null) {
final FailableSupplier<T, ?> supplier = requireNonNull(defaultValueSupplier, "The supplier must not be null");
final T defaultValue;
try {
defaultValue = supplier.get();
- } catch (Throwable t) {
+ } catch (final Throwable t) {
throw Failable.rethrow(t);
}
return requireNonNull(defaultValue, "The supplier must not return null.");
diff --git a/src/test/java/org/apache/commons/lang3/function/ObjectsTest.java b/src/test/java/org/apache/commons/lang3/function/ObjectsTest.java
index cea1c8e..9c04c04 100755
--- a/src/test/java/org/apache/commons/lang3/function/ObjectsTest.java
+++ b/src/test/java/org/apache/commons/lang3/function/ObjectsTest.java
@@ -35,7 +35,7 @@ class ObjectsTest {
try {
Objects.requireNonNull(null);
fail("Expected Exception");
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
assertEquals("The value must not be null.", e.getMessage());
}
}
@@ -46,7 +46,7 @@ class ObjectsTest {
try {
Objects.requireNonNull(null, "bar");
fail("Expected Exception");
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
assertEquals("bar", e.getMessage());
}
}
@@ -55,7 +55,7 @@ class ObjectsTest {
private final Supplier<O> supplier;
private boolean invoked;
- TestableSupplier(Supplier<O> pSupplier) {
+ TestableSupplier(final Supplier<O> pSupplier) {
this.supplier = pSupplier;
}
@@ -78,7 +78,7 @@ class ObjectsTest {
try {
Objects.requireNonNull(null, supplier);
fail("Expected Exception");
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
assertEquals("bar", e.getMessage());
assertTrue(supplier.isInvoked());
}
@@ -88,7 +88,7 @@ class ObjectsTest {
private final FailableSupplier<O, E> supplier;
private boolean invoked;
- TestableFailableSupplier(FailableSupplier<O, E> pSupplier) {
+ TestableFailableSupplier(final FailableSupplier<O, E> pSupplier) {
this.supplier = pSupplier;
}
@@ -113,7 +113,7 @@ class ObjectsTest {
try {
Objects.requireNonNull(null, supplier);
fail("Expected Exception");
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
assertEquals("The supplier must not return null.", e.getMessage());
assertTrue(supplier.isInvoked());
}
@@ -123,7 +123,7 @@ class ObjectsTest {
try {
Objects.requireNonNull(null, supplier2);
fail("Expected Exception");
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
assertEquals("The supplier must not return null.", e.getMessage());
assertTrue(supplier2.isInvoked());
}
@@ -138,7 +138,7 @@ class ObjectsTest {
try {
Objects.requireNonNull(null, supplier4);
fail("Expected Exception");
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
assertSame(rte, e);
assertTrue(supplier4.isInvoked());
}