Merge pull request #8198 from izeye:logical-and

* pr/8198:
  Use logical 'and' instead of bitwise 'and'
pull/8206/merge
Stephane Nicoll 8 years ago
commit e9057354c2

@ -95,9 +95,9 @@ public class InMemoryAuditEventRepository implements AuditEventRepository {
private boolean isMatch(String principal, Date after, String type, AuditEvent event) { private boolean isMatch(String principal, Date after, String type, AuditEvent event) {
boolean match = true; boolean match = true;
match &= (principal == null || event.getPrincipal().equals(principal)); match = match && (principal == null || event.getPrincipal().equals(principal));
match &= (after == null || event.getTimestamp().compareTo(after) >= 0); match = match && (after == null || event.getTimestamp().compareTo(after) >= 0);
match &= (type == null || event.getType().equals(type)); match = match && (type == null || event.getType().equals(type));
return match; return match;
} }

@ -126,9 +126,9 @@ public class Metric<T extends Number> {
if (obj instanceof Metric) { if (obj instanceof Metric) {
Metric<?> other = (Metric<?>) obj; Metric<?> other = (Metric<?>) obj;
boolean rtn = true; boolean rtn = true;
rtn &= ObjectUtils.nullSafeEquals(this.name, other.name); rtn = rtn && ObjectUtils.nullSafeEquals(this.name, other.name);
rtn &= ObjectUtils.nullSafeEquals(this.timestamp, other.timestamp); rtn = rtn && ObjectUtils.nullSafeEquals(this.timestamp, other.timestamp);
rtn &= ObjectUtils.nullSafeEquals(this.value, other.value); rtn = rtn && ObjectUtils.nullSafeEquals(this.value, other.value);
return rtn; return rtn;
} }
return super.equals(obj); return super.equals(obj);

@ -280,8 +280,8 @@ public class EmbeddedMongoAutoConfiguration {
if (getClass() == obj.getClass()) { if (getClass() == obj.getClass()) {
ToStringFriendlyFeatureAwareVersion other = (ToStringFriendlyFeatureAwareVersion) obj; ToStringFriendlyFeatureAwareVersion other = (ToStringFriendlyFeatureAwareVersion) obj;
boolean equals = true; boolean equals = true;
equals &= this.features.equals(other.features); equals = equals && this.features.equals(other.features);
equals &= this.version.equals(other.version); equals = equals && this.version.equals(other.version);
return equals; return equals;
} }
return super.equals(obj); return super.equals(obj);

@ -125,10 +125,10 @@ public final class Dependency {
if (getClass() == obj.getClass()) { if (getClass() == obj.getClass()) {
Dependency other = (Dependency) obj; Dependency other = (Dependency) obj;
boolean result = true; boolean result = true;
result &= this.groupId.equals(other.groupId); result = result && this.groupId.equals(other.groupId);
result &= this.artifactId.equals(other.artifactId); result = result && this.artifactId.equals(other.artifactId);
result &= this.version.equals(other.version); result = result && this.version.equals(other.version);
result &= this.exclusions.equals(other.exclusions); result = result && this.exclusions.equals(other.exclusions);
return result; return result;
} }
return false; return false;
@ -187,8 +187,8 @@ public final class Dependency {
if (getClass() == obj.getClass()) { if (getClass() == obj.getClass()) {
Exclusion other = (Exclusion) obj; Exclusion other = (Exclusion) obj;
boolean result = true; boolean result = true;
result &= this.groupId.equals(other.groupId); result = result && this.groupId.equals(other.groupId);
result &= this.artifactId.equals(other.artifactId); result = result && this.artifactId.equals(other.artifactId);
return result; return result;
} }
return false; return false;

@ -59,9 +59,9 @@ class FileSnapshot {
if (obj instanceof FileSnapshot) { if (obj instanceof FileSnapshot) {
FileSnapshot other = (FileSnapshot) obj; FileSnapshot other = (FileSnapshot) obj;
boolean equals = this.file.equals(other.file); boolean equals = this.file.equals(other.file);
equals &= this.exists == other.exists; equals = equals && this.exists == other.exists;
equals &= this.length == other.length; equals = equals && this.length == other.length;
equals &= this.lastModified == other.lastModified; equals = equals && this.lastModified == other.lastModified;
return equals; return equals;
} }
return super.equals(obj); return super.equals(obj);

@ -142,17 +142,17 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
} }
AnnotationCustomizableTypeExcludeFilter other = (AnnotationCustomizableTypeExcludeFilter) obj; AnnotationCustomizableTypeExcludeFilter other = (AnnotationCustomizableTypeExcludeFilter) obj;
boolean result = true; boolean result = true;
result &= hasAnnotation() == other.hasAnnotation(); result = result && hasAnnotation() == other.hasAnnotation();
for (FilterType filterType : FilterType.values()) { for (FilterType filterType : FilterType.values()) {
result &= ObjectUtils.nullSafeEquals(getFilters(filterType), result &= ObjectUtils.nullSafeEquals(getFilters(filterType),
other.getFilters(filterType)); other.getFilters(filterType));
} }
result &= isUseDefaultFilters() == other.isUseDefaultFilters(); result = result && isUseDefaultFilters() == other.isUseDefaultFilters();
result &= ObjectUtils.nullSafeEquals(getDefaultIncludes(), result = result && ObjectUtils.nullSafeEquals(getDefaultIncludes(),
other.getDefaultIncludes()); other.getDefaultIncludes());
result &= ObjectUtils.nullSafeEquals(getComponentIncludes(), result = result && ObjectUtils.nullSafeEquals(getComponentIncludes(),
other.getComponentIncludes()); other.getComponentIncludes());
return result; return result;
}; }
} }

@ -97,11 +97,11 @@ abstract class Definition {
} }
Definition other = (Definition) obj; Definition other = (Definition) obj;
boolean result = true; boolean result = true;
result &= ObjectUtils.nullSafeEquals(this.name, other.name); result = result && ObjectUtils.nullSafeEquals(this.name, other.name);
result &= ObjectUtils.nullSafeEquals(this.reset, other.reset); result = result && ObjectUtils.nullSafeEquals(this.reset, other.reset);
result &= ObjectUtils.nullSafeEquals(this.proxyTargetAware, result = result && ObjectUtils.nullSafeEquals(this.proxyTargetAware,
other.proxyTargetAware); other.proxyTargetAware);
result &= ObjectUtils.nullSafeEquals(this.qualifier, other.qualifier); result = result && ObjectUtils.nullSafeEquals(this.qualifier, other.qualifier);
return result; return result;
} }

@ -120,10 +120,10 @@ class MockDefinition extends Definition {
} }
MockDefinition other = (MockDefinition) obj; MockDefinition other = (MockDefinition) obj;
boolean result = super.equals(obj); boolean result = super.equals(obj);
result &= ObjectUtils.nullSafeEquals(this.typeToMock, other.typeToMock); result = result && ObjectUtils.nullSafeEquals(this.typeToMock, other.typeToMock);
result &= ObjectUtils.nullSafeEquals(this.extraInterfaces, other.extraInterfaces); result = result && ObjectUtils.nullSafeEquals(this.extraInterfaces, other.extraInterfaces);
result &= ObjectUtils.nullSafeEquals(this.answer, other.answer); result = result && ObjectUtils.nullSafeEquals(this.answer, other.answer);
result &= this.serializable == other.serializable; result = result && this.serializable == other.serializable;
return result; return result;
} }

@ -65,7 +65,7 @@ class SpyDefinition extends Definition {
} }
SpyDefinition other = (SpyDefinition) obj; SpyDefinition other = (SpyDefinition) obj;
boolean result = super.equals(obj); boolean result = super.equals(obj);
result &= ObjectUtils.nullSafeEquals(this.typeToSpy, other.typeToSpy); result = result && ObjectUtils.nullSafeEquals(this.typeToSpy, other.typeToSpy);
return result; return result;
} }

@ -99,10 +99,10 @@ public final class LoggerConfiguration {
if (obj instanceof LoggerConfiguration) { if (obj instanceof LoggerConfiguration) {
LoggerConfiguration other = (LoggerConfiguration) obj; LoggerConfiguration other = (LoggerConfiguration) obj;
boolean rtn = true; boolean rtn = true;
rtn &= ObjectUtils.nullSafeEquals(this.name, other.name); rtn = rtn && ObjectUtils.nullSafeEquals(this.name, other.name);
rtn &= ObjectUtils.nullSafeEquals(this.configuredLevel, rtn = rtn && ObjectUtils.nullSafeEquals(this.configuredLevel,
other.configuredLevel); other.configuredLevel);
rtn &= ObjectUtils.nullSafeEquals(this.effectiveLevel, other.effectiveLevel); rtn = rtn && ObjectUtils.nullSafeEquals(this.effectiveLevel, other.effectiveLevel);
return rtn; return rtn;
} }
return super.equals(obj); return super.equals(obj);

@ -125,10 +125,10 @@ public class ErrorPage {
if (obj instanceof ErrorPage) { if (obj instanceof ErrorPage) {
ErrorPage other = (ErrorPage) obj; ErrorPage other = (ErrorPage) obj;
boolean rtn = true; boolean rtn = true;
rtn &= ObjectUtils.nullSafeEquals(getExceptionName(), rtn = rtn && ObjectUtils.nullSafeEquals(getExceptionName(),
other.getExceptionName()); other.getExceptionName());
rtn &= ObjectUtils.nullSafeEquals(this.path, other.path); rtn = rtn && ObjectUtils.nullSafeEquals(this.path, other.path);
rtn &= this.status == other.status; rtn = rtn && this.status == other.status;
return rtn; return rtn;
} }
return false; return false;

Loading…
Cancel
Save