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
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_ANONYMOUSLY.equals(attribute.getAttribute()))) {
return true;
}
else {
return false;
}
|| IS_AUTHENTICATED_ANONYMOUSLY.equals(attribute.getAttribute()));
}
/**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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