remove unnecessary null check before instance of (#4321)
Signed-off-by: jimin.jm <slievrly@163.com>
This commit is contained in:
parent
041a6addc1
commit
81e61cc5c3
|
|
@ -237,12 +237,12 @@ public final class JavaBeanSerializeUtil {
|
|||
for (Map.Entry<Object, Object> entry : beanDescriptor) {
|
||||
Object key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (key != null && key instanceof JavaBeanDescriptor) {
|
||||
if (key instanceof JavaBeanDescriptor) {
|
||||
JavaBeanDescriptor keyDescriptor = (JavaBeanDescriptor) entry.getKey();
|
||||
key = instantiateForDeserialize(keyDescriptor, loader, cache);
|
||||
deserializeInternal(key, keyDescriptor, loader, cache);
|
||||
}
|
||||
if (value != null && value instanceof JavaBeanDescriptor) {
|
||||
if (value instanceof JavaBeanDescriptor) {
|
||||
JavaBeanDescriptor valueDescriptor = (JavaBeanDescriptor) entry.getValue();
|
||||
value = instantiateForDeserialize(valueDescriptor, loader, cache);
|
||||
deserializeInternal(value, valueDescriptor, loader, cache);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class JSONArray implements JSONNode {
|
|||
*/
|
||||
public boolean getBoolean(int index, boolean def) {
|
||||
Object tmp = mArray.get(index);
|
||||
return tmp != null && tmp instanceof Boolean ? ((Boolean) tmp).booleanValue() : def;
|
||||
return tmp instanceof Boolean ? ((Boolean) tmp).booleanValue() : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,7 +59,7 @@ public class JSONArray implements JSONNode {
|
|||
*/
|
||||
public int getInt(int index, int def) {
|
||||
Object tmp = mArray.get(index);
|
||||
return tmp != null && tmp instanceof Number ? ((Number) tmp).intValue() : def;
|
||||
return tmp instanceof Number ? ((Number) tmp).intValue() : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -71,7 +71,7 @@ public class JSONArray implements JSONNode {
|
|||
*/
|
||||
public long getLong(int index, long def) {
|
||||
Object tmp = mArray.get(index);
|
||||
return tmp != null && tmp instanceof Number ? ((Number) tmp).longValue() : def;
|
||||
return tmp instanceof Number ? ((Number) tmp).longValue() : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -83,7 +83,7 @@ public class JSONArray implements JSONNode {
|
|||
*/
|
||||
public float getFloat(int index, float def) {
|
||||
Object tmp = mArray.get(index);
|
||||
return tmp != null && tmp instanceof Number ? ((Number) tmp).floatValue() : def;
|
||||
return tmp instanceof Number ? ((Number) tmp).floatValue() : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -95,7 +95,7 @@ public class JSONArray implements JSONNode {
|
|||
*/
|
||||
public double getDouble(int index, double def) {
|
||||
Object tmp = mArray.get(index);
|
||||
return tmp != null && tmp instanceof Number ? ((Number) tmp).doubleValue() : def;
|
||||
return tmp instanceof Number ? ((Number) tmp).doubleValue() : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class JSONObject implements JSONNode {
|
|||
*/
|
||||
public boolean getBoolean(String key, boolean def) {
|
||||
Object tmp = mMap.get(key);
|
||||
return tmp != null && tmp instanceof Boolean ? (Boolean) tmp : def;
|
||||
return tmp instanceof Boolean ? (Boolean) tmp : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,7 +59,7 @@ public class JSONObject implements JSONNode {
|
|||
*/
|
||||
public int getInt(String key, int def) {
|
||||
Object tmp = mMap.get(key);
|
||||
return tmp != null && tmp instanceof Number ? ((Number) tmp).intValue() : def;
|
||||
return tmp instanceof Number ? ((Number) tmp).intValue() : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -71,7 +71,7 @@ public class JSONObject implements JSONNode {
|
|||
*/
|
||||
public long getLong(String key, long def) {
|
||||
Object tmp = mMap.get(key);
|
||||
return tmp != null && tmp instanceof Number ? ((Number) tmp).longValue() : def;
|
||||
return tmp instanceof Number ? ((Number) tmp).longValue() : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -83,7 +83,7 @@ public class JSONObject implements JSONNode {
|
|||
*/
|
||||
public float getFloat(String key, float def) {
|
||||
Object tmp = mMap.get(key);
|
||||
return tmp != null && tmp instanceof Number ? ((Number) tmp).floatValue() : def;
|
||||
return tmp instanceof Number ? ((Number) tmp).floatValue() : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -95,7 +95,7 @@ public class JSONObject implements JSONNode {
|
|||
*/
|
||||
public double getDouble(String key, double def) {
|
||||
Object tmp = mMap.get(key);
|
||||
return tmp != null && tmp instanceof Number ? ((Number) tmp).doubleValue() : def;
|
||||
return tmp instanceof Number ? ((Number) tmp).doubleValue() : def;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public class ProviderInvokerWrapper<T> implements Invoker {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null || !(o instanceof ProviderInvokerWrapper)) {
|
||||
if (!(o instanceof ProviderInvokerWrapper)) {
|
||||
return false;
|
||||
}
|
||||
ProviderInvokerWrapper other = (ProviderInvokerWrapper) o;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ final class NettyHelper {
|
|||
|
||||
public static void setNettyLoggerFactory() {
|
||||
InternalLoggerFactory factory = InternalLoggerFactory.getDefaultFactory();
|
||||
if (factory == null || !(factory instanceof DubboLoggerFactory)) {
|
||||
if (!(factory instanceof DubboLoggerFactory)) {
|
||||
InternalLoggerFactory.setDefaultFactory(new DubboLoggerFactory());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ public class DubboTelnetDecodeTest {
|
|||
}
|
||||
|
||||
private static boolean checkTelnetDecoded(Object msg) {
|
||||
if (msg != null && msg instanceof String && !msg.toString().contains("Unsupported command:")) {
|
||||
if (msg instanceof String && !msg.toString().contains("Unsupported command:")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue