Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unnecessary null check before instance of #4321

Merged
merged 1 commit into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ private static void deserializeInternal(Object result, JavaBeanDescriptor beanDe
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Object get(int index) {
*/
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;
}

/**
Expand All @@ -59,7 +59,7 @@ public boolean getBoolean(int index, boolean def) {
*/
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;
}

/**
Expand All @@ -71,7 +71,7 @@ public int getInt(int index, int def) {
*/
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;
}

/**
Expand All @@ -83,7 +83,7 @@ public long getLong(int index, long def) {
*/
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;
}

/**
Expand All @@ -95,7 +95,7 @@ public float getFloat(int index, float def) {
*/
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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Object get(String key) {
*/
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;
}

/**
Expand All @@ -59,7 +59,7 @@ public boolean getBoolean(String key, boolean def) {
*/
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;
}

/**
Expand All @@ -71,7 +71,7 @@ public int getInt(String key, int def) {
*/
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;
}

/**
Expand All @@ -83,7 +83,7 @@ public long getLong(String key, long def) {
*/
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;
}

/**
Expand All @@ -95,7 +95,7 @@ public float getFloat(String key, float def) {
*/
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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void setReg(boolean reg) {

@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof ProviderInvokerWrapper)) {
if (!(o instanceof ProviderInvokerWrapper)) {
return false;
}
ProviderInvokerWrapper other = (ProviderInvokerWrapper) o;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ private ByteBuf createDubboByteBuf() throws IOException {
}

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;
Expand Down