Resolved or documented deprecation warnings for suppression

This commit is contained in:
Collin Smith
2020-12-02 11:57:06 -08:00
parent 0410eb2505
commit 659e812e83
4 changed files with 13 additions and 13 deletions

View File

@ -4,9 +4,9 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.exception.ExceptionUtils;
@ -55,7 +55,7 @@ public class Cvar<T> implements SuggestionProvider {
@Override
public String toString() {
return ObjectUtils.toString(value);
return Objects.toString(value);
}
@NonNull
@ -101,7 +101,7 @@ public class Cvar<T> implements SuggestionProvider {
public void set(@Nullable T value) {
final T prev = this.value;
if (ObjectUtils.equals(prev, value)) {
if (Objects.equals(prev, value)) {
return;
}
@ -144,7 +144,7 @@ public class Cvar<T> implements SuggestionProvider {
}
public void reset() {
if (!ObjectUtils.equals(value, DEFAULT_VALUE)) {
if (!Objects.equals(value, DEFAULT_VALUE)) {
T prev = value;
value = DEFAULT_VALUE;
for (StateListener<T> l : STATE_LISTENERS) l.onChanged(this, prev, value);

View File

@ -2,15 +2,13 @@ package com.riiablo.cvar;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Objects;
import java.util.SortedMap;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.collections4.Trie;
import org.apache.commons.collections4.trie.PatriciaTrie;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Collection;
import java.util.Iterator;
import java.util.SortedMap;
public class CvarManager implements Cvar.StateListener, Iterable<Cvar> {
@ -30,7 +28,7 @@ public class CvarManager implements Cvar.StateListener, Iterable<Cvar> {
public boolean add(@NonNull Cvar cvar) {
String alias = cvar.ALIAS.toLowerCase();
Cvar queriedCvar = CVARS.get(alias);
if (ObjectUtils.equals(queriedCvar, cvar)) {
if (Objects.equals(queriedCvar, cvar)) {
return false;
} else if (queriedCvar != null) {
throw new CvarManagerException("A Cvar with the alias %s has already been added.", queriedCvar.ALIAS);
@ -45,7 +43,7 @@ public class CvarManager implements Cvar.StateListener, Iterable<Cvar> {
if (cvar == null) return false;
String alias = cvar.ALIAS.toLowerCase();
Cvar queriedCvar = CVARS.get(alias);
return ObjectUtils.equals(queriedCvar, cvar) && CVARS.remove(alias) != null;
return Objects.equals(queriedCvar, cvar) && CVARS.remove(alias) != null;
}
@SuppressWarnings("unchecked")
@ -65,7 +63,7 @@ public class CvarManager implements Cvar.StateListener, Iterable<Cvar> {
if (cvar == null) return false;
String alias = cvar.ALIAS.toLowerCase();
Cvar queriedCvar = CVARS.get(alias);
return ObjectUtils.equals(queriedCvar, cvar);
return Objects.equals(queriedCvar, cvar);
}
public boolean isManaging(String alias) {

View File

@ -86,6 +86,7 @@ public class CharData implements ItemData.UpdateListener, Pool.Poolable {
}
/** Constructs an unmanaged instance. Used for remote players with complete save data. */
@SuppressWarnings("deprecation") // d2s writer not implemented yet -- stub deprecated to avoid usage
public static CharData loadFromBuffer(int diff, ByteBuffer buffer) {
byte[] bytes = BufferUtils.readRemaining(buffer);
ByteInput in = ByteInput.wrap(bytes);

View File

@ -36,6 +36,7 @@ public enum D2SReader {
}
// TODO: rewrite this function without stubbing serialization
@SuppressWarnings("deprecation")
public D2S readD2S(FileHandle handle) {
byte[] bytes = handle.readBytes();
D2S d2s = readD2S(ByteInput.wrap(bytes));