LANG-1279: Update Java requirement from Java 6 to 7

replace usage of deprecated ObjectUtils#equals with Objects#equals
This commit is contained in:
pascalschumacher 2016-10-28 18:33:40 +02:00
parent 9b481a9701
commit cfdc3f767c
4 changed files with 11 additions and 14 deletions

View File

@ -16,7 +16,7 @@
*/ */
package org.apache.commons.lang3.concurrent; package org.apache.commons.lang3.concurrent;
import org.apache.commons.lang3.ObjectUtils; import java.util.Objects;
/** /**
* <p> * <p>
@ -100,7 +100,6 @@ public class ConstantInitializer<T> implements ConcurrentInitializer<T> {
* @param obj the object to compare to * @param obj the object to compare to
* @return a flag whether the objects are equal * @return a flag whether the objects are equal
*/ */
@SuppressWarnings( "deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (this == obj) { if (this == obj) {
@ -111,7 +110,7 @@ public class ConstantInitializer<T> implements ConcurrentInitializer<T> {
} }
final ConstantInitializer<?> c = (ConstantInitializer<?>) obj; final ConstantInitializer<?> c = (ConstantInitializer<?>) obj;
return ObjectUtils.equals(getObject(), c.getObject()); return Objects.equals(getObject(), c.getObject());
} }
/** /**

View File

@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
@ -1570,9 +1571,8 @@ public class TypeUtils {
* @return boolean * @return boolean
* @since 3.2 * @since 3.2
*/ */
@SuppressWarnings( "deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
public static boolean equals(final Type t1, final Type t2) { public static boolean equals(final Type t1, final Type t2) {
if (ObjectUtils.equals(t1, t2)) { if (Objects.equals(t1, t2)) {
return true; return true;
} }
if (t1 instanceof ParameterizedType) { if (t1 instanceof ParameterizedType) {

View File

@ -18,8 +18,8 @@ package org.apache.commons.lang3.tuple;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.builder.CompareToBuilder; import org.apache.commons.lang3.builder.CompareToBuilder;
/** /**
@ -124,7 +124,6 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
* @param obj the object to compare to, null returns false * @param obj the object to compare to, null returns false
* @return true if the elements of the pair are equal * @return true if the elements of the pair are equal
*/ */
@SuppressWarnings( "deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (obj == this) { if (obj == this) {
@ -132,8 +131,8 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L,
} }
if (obj instanceof Map.Entry<?, ?>) { if (obj instanceof Map.Entry<?, ?>) {
final Map.Entry<?, ?> other = (Map.Entry<?, ?>) obj; final Map.Entry<?, ?> other = (Map.Entry<?, ?>) obj;
return ObjectUtils.equals(getKey(), other.getKey()) return Objects.equals(getKey(), other.getKey())
&& ObjectUtils.equals(getValue(), other.getValue()); && Objects.equals(getValue(), other.getValue());
} }
return false; return false;
} }

View File

@ -17,8 +17,8 @@
package org.apache.commons.lang3.tuple; package org.apache.commons.lang3.tuple;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.builder.CompareToBuilder; import org.apache.commons.lang3.builder.CompareToBuilder;
/** /**
@ -104,7 +104,6 @@ public abstract class Triple<L, M, R> implements Comparable<Triple<L, M, R>>, Se
* @param obj the object to compare to, null returns false * @param obj the object to compare to, null returns false
* @return true if the elements of the triple are equal * @return true if the elements of the triple are equal
*/ */
@SuppressWarnings( "deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (obj == this) { if (obj == this) {
@ -112,9 +111,9 @@ public abstract class Triple<L, M, R> implements Comparable<Triple<L, M, R>>, Se
} }
if (obj instanceof Triple<?, ?, ?>) { if (obj instanceof Triple<?, ?, ?>) {
final Triple<?, ?, ?> other = (Triple<?, ?, ?>) obj; final Triple<?, ?, ?> other = (Triple<?, ?, ?>) obj;
return ObjectUtils.equals(getLeft(), other.getLeft()) return Objects.equals(getLeft(), other.getLeft())
&& ObjectUtils.equals(getMiddle(), other.getMiddle()) && Objects.equals(getMiddle(), other.getMiddle())
&& ObjectUtils.equals(getRight(), other.getRight()); && Objects.equals(getRight(), other.getRight());
} }
return false; return false;
} }