mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Polish 'Simplify conditionals'
See gh-39259
This commit is contained in:
parent
65a1ff84e6
commit
ddb769bf7f
@ -68,7 +68,10 @@ class OperationMethodParameter implements OperationParameter {
|
||||
if (!ObjectUtils.isEmpty(this.parameter.getAnnotationsByType(Nullable.class))) {
|
||||
return false;
|
||||
}
|
||||
return !jsr305Present || new Jsr305().isMandatory(this.parameter);
|
||||
if (jsr305Present) {
|
||||
return new Jsr305().isMandatory(this.parameter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,8 +55,12 @@ public class ClassLoaderFile implements Serializable {
|
||||
*/
|
||||
public ClassLoaderFile(Kind kind, long lastModified, byte[] contents) {
|
||||
Assert.notNull(kind, "Kind must not be null");
|
||||
Assert.isTrue((kind != Kind.DELETED) == (contents != null),
|
||||
() -> "Contents must " + ((kind != Kind.DELETED) ? "not " : "") + "be null");
|
||||
if (kind == Kind.DELETED) {
|
||||
Assert.isTrue(contents == null, "Contents must be null");
|
||||
}
|
||||
else {
|
||||
Assert.isTrue(contents != null, "Contents must not be null");
|
||||
}
|
||||
this.kind = kind;
|
||||
this.lastModified = lastModified;
|
||||
this.contents = contents;
|
||||
|
@ -44,7 +44,7 @@ class OverrideAutoConfigurationContextCustomizerFactory implements ContextCustom
|
||||
}
|
||||
OverrideAutoConfiguration overrideAutoConfiguration = TestContextAnnotationUtils.findMergedAnnotation(testClass,
|
||||
OverrideAutoConfiguration.class);
|
||||
boolean enabled = overrideAutoConfiguration == null || overrideAutoConfiguration.enabled();
|
||||
boolean enabled = (overrideAutoConfiguration == null) || overrideAutoConfiguration.enabled();
|
||||
return !enabled ? new DisableAutoConfigurationContextCustomizer() : null;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ final class JarUrlConnection extends java.net.JarURLConnection {
|
||||
|
||||
@Override
|
||||
public boolean getAllowUserInteraction() {
|
||||
return this.jarFileConnection != null && this.jarFileConnection.getAllowUserInteraction();
|
||||
return (this.jarFileConnection != null) && this.jarFileConnection.getAllowUserInteraction();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -219,7 +219,7 @@ final class JarUrlConnection extends java.net.JarURLConnection {
|
||||
|
||||
@Override
|
||||
public boolean getUseCaches() {
|
||||
return this.jarFileConnection == null || this.jarFileConnection.getUseCaches();
|
||||
return (this.jarFileConnection == null) || this.jarFileConnection.getUseCaches();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -231,7 +231,7 @@ final class JarUrlConnection extends java.net.JarURLConnection {
|
||||
|
||||
@Override
|
||||
public boolean getDefaultUseCaches() {
|
||||
return this.jarFileConnection == null || this.jarFileConnection.getDefaultUseCaches();
|
||||
return (this.jarFileConnection == null) || this.jarFileConnection.getDefaultUseCaches();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,7 +127,7 @@ class DefaultBindConstructorProvider implements BindConstructorProvider {
|
||||
return true;
|
||||
}
|
||||
Class<?> userClass = ClassUtils.getUserClass(type);
|
||||
return userClass != type && isAutowiredPresent(userClass);
|
||||
return (userClass != type) && isAutowiredPresent(userClass);
|
||||
}
|
||||
|
||||
private static Constructor<?>[] getCandidateConstructors(Class<?> type) {
|
||||
|
@ -53,7 +53,7 @@ final class SpringProfileArbiter implements Arbiter {
|
||||
|
||||
@Override
|
||||
public boolean isCondition() {
|
||||
return this.environment != null && this.environment.acceptsProfiles(this.profiles);
|
||||
return (this.environment != null) && this.environment.acceptsProfiles(this.profiles);
|
||||
}
|
||||
|
||||
@PluginBuilderFactory
|
||||
|
@ -124,7 +124,7 @@ class NestedJarResourceSet extends AbstractSingleArchiveResourceSet {
|
||||
// JarFile.isMultiRelease() is final so we must go to the manifest
|
||||
Manifest manifest = getManifest();
|
||||
Attributes attributes = (manifest != null) ? manifest.getMainAttributes() : null;
|
||||
this.multiRelease = attributes != null && attributes.containsKey(MULTI_RELEASE);
|
||||
this.multiRelease = (attributes != null) && attributes.containsKey(MULTI_RELEASE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user