Simplify boolean returns

Simplify boolean returns of the form:

	if (b) {
		return true;
	} else {
		return false;
	}

to:

	return b;

Issue gh-8945
This commit is contained in:
Phillip Webb 2020-07-27 20:22:28 -07:00 committed by Rob Winch
parent b69825d925
commit 9a3fa6e812
8 changed files with 8 additions and 44 deletions

View File

@ -68,14 +68,9 @@ public class AuthenticatedVoter implements AccessDecisionVoter<Object> {
@Override @Override
public boolean supports(ConfigAttribute attribute) { public boolean supports(ConfigAttribute attribute) {
if ((attribute.getAttribute() != null) && (IS_AUTHENTICATED_FULLY.equals(attribute.getAttribute()) return (attribute.getAttribute() != null) && (IS_AUTHENTICATED_FULLY.equals(attribute.getAttribute())
|| IS_AUTHENTICATED_REMEMBERED.equals(attribute.getAttribute()) || IS_AUTHENTICATED_REMEMBERED.equals(attribute.getAttribute())
|| IS_AUTHENTICATED_ANONYMOUSLY.equals(attribute.getAttribute()))) { || IS_AUTHENTICATED_ANONYMOUSLY.equals(attribute.getAttribute()));
return true;
}
else {
return false;
}
} }
/** /**

View File

@ -68,12 +68,7 @@ public class RoleVoter implements AccessDecisionVoter<Object> {
@Override @Override
public boolean supports(ConfigAttribute attribute) { public boolean supports(ConfigAttribute attribute) {
if ((attribute.getAttribute() != null) && attribute.getAttribute().startsWith(getRolePrefix())) { return (attribute.getAttribute() != null) && attribute.getAttribute().startsWith(getRolePrefix());
return true;
}
else {
return false;
}
} }
/** /**

View File

@ -76,12 +76,7 @@ public class UserAttribute {
} }
public boolean isValid() { public boolean isValid() {
if ((this.password != null) && (this.authorities.size() > 0)) { return (this.password != null) && (this.authorities.size() > 0);
return true;
}
else {
return false;
}
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {

View File

@ -37,12 +37,7 @@ public class DenyAgainVoter implements AccessDecisionVoter<Object> {
@Override @Override
public boolean supports(ConfigAttribute attribute) { public boolean supports(ConfigAttribute attribute) {
if ("DENY_AGAIN_FOR_SURE".equals(attribute.getAttribute())) { return "DENY_AGAIN_FOR_SURE".equals(attribute.getAttribute());
return true;
}
else {
return false;
}
} }
@Override @Override

View File

@ -39,12 +39,7 @@ public class DenyVoter implements AccessDecisionVoter<Object> {
@Override @Override
public boolean supports(ConfigAttribute attribute) { public boolean supports(ConfigAttribute attribute) {
if ("DENY_FOR_SURE".equals(attribute.getAttribute())) { return "DENY_FOR_SURE".equals(attribute.getAttribute());
return true;
}
else {
return false;
}
} }
@Override @Override

View File

@ -3,7 +3,6 @@
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd"> "https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions> <suppressions>
<suppress files=".*" checks="SimplifyBooleanReturn" />
<suppress files=".*" checks="SpringAvoidStaticImport" /> <suppress files=".*" checks="SpringAvoidStaticImport" />
<suppress files=".*" checks="SpringCatch" /> <suppress files=".*" checks="SpringCatch" />
<suppress files=".*" checks="SpringHeader" /> <suppress files=".*" checks="SpringHeader" />

View File

@ -220,12 +220,7 @@ public class ChannelDecisionManagerImplTests {
@Override @Override
public boolean supports(ConfigAttribute attribute) { public boolean supports(ConfigAttribute attribute) {
if (attribute.getAttribute().equals(this.configAttribute)) { return attribute.getAttribute().equals(this.configAttribute);
return true;
}
else {
return false;
}
} }
} }

View File

@ -170,12 +170,7 @@ public class ChannelProcessingFilterTests {
@Override @Override
public boolean supports(ConfigAttribute attribute) { public boolean supports(ConfigAttribute attribute) {
if (attribute.getAttribute().equals(this.supportAttribute)) { return attribute.getAttribute().equals(this.supportAttribute);
return true;
}
else {
return false;
}
} }
} }