Skip to content

Commit

Permalink
GEODE-7768: remove redundant null checks (apache#4701)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkevo authored Feb 19, 2020
1 parent d6c1497 commit bf3e280
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,9 @@ public boolean equals(Object obj) {
return true;
}

if (obj == null || !(obj instanceof BootstrappingFunction)) {
if (!(obj instanceof BootstrappingFunction)) {
return false;
}

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public RemoteApplicationVM(RemoteGfManagerAgent agent, InternalDistributedMember

@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof RemoteApplicationVM)) {
if (!(obj instanceof RemoteApplicationVM)) {
return false;
} else {
RemoteApplicationVM vm = (RemoteApplicationVM) obj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public Number getValue() {
@Override
public boolean equals(Object object) {

if (object == null || !(object instanceof DummyStatisticInfoImpl)) {
if (!(object instanceof DummyStatisticInfoImpl)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void setStatisticsTypeName(String statisticsType) {
@Override
public boolean equals(Object object) {

if (object == null || !(object instanceof StatisticInfoImpl)) {
if (!(object instanceof StatisticInfoImpl)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ public boolean entryRequiresOldValue(Object key) {

private void sendProfileOperation(Long clientID, operationType opType, Object interest,
boolean updatesAsInvalidates) {
if (this.region == null || !(this.region instanceof PartitionedRegion)) {
if (!(this.region instanceof PartitionedRegion)) {
return;
}
OperationMessage msg = new OperationMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ public static Bucket getProxyBucketRegion(Cache cache, String fullPath, boolean
} finally {
LocalRegion.setThreadInitLevelRequirement(oldLevel);
}
if (region == null || !(region instanceof PartitionedRegion)) {
if (!(region instanceof PartitionedRegion)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ public int compareTo(Object o) {

@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof FarSideEntryOp)) {
if (!(o instanceof FarSideEntryOp)) {
return false;
}
return compareTo(o) == 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,7 @@ public int compareTo(Object o) {

@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof TxEntryEventImpl))
if (!(o instanceof TxEntryEventImpl))
return false;
return compareTo(o) == 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ public int compareTo(Object o) {

@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof TXEntryStateWithRegionAndKey))
if (!(o instanceof TXEntryStateWithRegionAndKey))
return false;
return compareTo(o) == 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void setHAContainer(Map container) {
*/
@Override
public boolean equals(Object other) {
if (other == null || !(other instanceof HAEventWrapper)) {
if (!(other instanceof HAEventWrapper)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ public synchronized boolean sameAs(RegionVersionHolder<T> other) {

@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof RegionVersionHolder)) {
if (!(obj instanceof RegionVersionHolder)) {
return false;
}
return sameAs((RegionVersionHolder) obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public boolean equals(Object other) {
if (other == this) {
return true;
}
if (other == null || !(other instanceof PdxField)) {
if (!(other instanceof PdxField)) {
return false;
}
PdxField otherVFT = (PdxField) other;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public boolean equals(Object other) {
if (other == this) {
return true;
}
if (other == null || !(other instanceof PdxType)) {
if (!(other instanceof PdxType)) {
return false;
}
// Note: do not compare type id in equals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ public static InternalCache getCache() {
}

public static InternalLocator getLocator() {
if (memberStarter == null || !(memberStarter instanceof LocatorStarterRule)) {
if (!(memberStarter instanceof LocatorStarterRule)) {
return null;
}
return ((LocatorStarterRule) memberStarter).getLocator();
}

public static CacheServer getServer() {
if (memberStarter == null || !(memberStarter instanceof ServerStarterRule)) {
if (!(memberStarter instanceof ServerStarterRule)) {
return null;
}
return ((ServerStarterRule) memberStarter).getServer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ResultModel describeMember(@CliOption(key = CliStrings.DESCRIBE_MEMBER__I
ArrayList<?> output = (ArrayList<?>) rc.getResult();
Object obj = output.get(0);

if (obj == null || !(obj instanceof MemberInformation)) {
if (!(obj instanceof MemberInformation)) {
return ResultModel.createInfo(String.format(
CliStrings.DESCRIBE_MEMBER__MSG__INFO_FOR__0__COULD_NOT_BE_RETRIEVED, memberNameOrId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public String toString() {

@Override
public boolean equals(Object other) {
if (other == null || !(other instanceof DeltaTestImpl)) {
if (!(other instanceof DeltaTestImpl)) {
return false;
}
DeltaTestImpl delta = (DeltaTestImpl) other;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public boolean equals(Object p) {
if (this == p) {
return true;
}
if (p == null || !(p instanceof PortfolioData)) {
if (!(p instanceof PortfolioData)) {
return false;
}
PortfolioData pd = (PortfolioData) p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public int getVmPid() {
@Override
public boolean equals(Object obj) {
// GemStone fix for 29125
if ((obj == null) || !(obj instanceof GMSMemberData)) {
if (!(obj instanceof GMSMemberData)) {
return false;
}
return compareTo((GMSMemberData) obj) == 0;
Expand Down

0 comments on commit bf3e280

Please sign in to comment.