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;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
/**
* <p>
@ -100,7 +100,6 @@ public int hashCode() {
* @param obj the object to compare to
* @return a flag whether the objects are equal
*/
@SuppressWarnings( "deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Override
public boolean equals(final Object obj) {
if (this == obj) {
@ -111,7 +110,7 @@ public boolean equals(final Object 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.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.apache.commons.lang3.ArrayUtils;
@ -1570,9 +1571,8 @@ public static GenericArrayType genericArrayType(final Type componentType) {
* @return boolean
* @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) {
if (ObjectUtils.equals(t1, t2)) {
if (Objects.equals(t1, t2)) {
return true;
}
if (t1 instanceof ParameterizedType) {

View File

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

View File

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