Fix checkstyle ternary issues
Fix checkstyle issues with ternary expressions following the spring-javaformat upgrade. See gh-13932
This commit is contained in:
@@ -119,7 +119,7 @@ public class SpringBootExtension {
|
||||
|
||||
private String determineArtifactBaseName() {
|
||||
Jar artifactTask = findArtifactTask();
|
||||
return (artifactTask != null ? artifactTask.getBaseName() : null);
|
||||
return (artifactTask != null) ? artifactTask.getBaseName() : null;
|
||||
}
|
||||
|
||||
private Jar findArtifactTask() {
|
||||
|
||||
@@ -162,9 +162,9 @@ final class JavaPluginAction implements PluginApplicationAction {
|
||||
}
|
||||
|
||||
private boolean hasConfigurationProcessorOnClasspath(JavaCompile compile) {
|
||||
Set<File> files = (compile.getOptions().getAnnotationProcessorPath() != null
|
||||
Set<File> files = (compile.getOptions().getAnnotationProcessorPath() != null)
|
||||
? compile.getOptions().getAnnotationProcessorPath().getFiles()
|
||||
: compile.getClasspath().getFiles());
|
||||
: compile.getClasspath().getFiles();
|
||||
return files.stream().map(File::getName).anyMatch(
|
||||
(name) -> name.startsWith("spring-boot-configuration-processor"));
|
||||
}
|
||||
|
||||
@@ -53,17 +53,14 @@ public class BuildInfo extends ConventionTask {
|
||||
@TaskAction
|
||||
public void generateBuildProperties() {
|
||||
try {
|
||||
new BuildPropertiesWriter(
|
||||
new File(getDestinationDir(), "build-info.properties"))
|
||||
.writeBuildProperties(new ProjectDetails(
|
||||
this.properties.getGroup(),
|
||||
this.properties.getArtifact() != null
|
||||
? this.properties.getArtifact()
|
||||
: "unspecified",
|
||||
this.properties.getVersion(),
|
||||
this.properties.getName(), this.properties.getTime(),
|
||||
coerceToStringValues(
|
||||
this.properties.getAdditional())));
|
||||
new BuildPropertiesWriter(new File(getDestinationDir(),
|
||||
"build-info.properties")).writeBuildProperties(new ProjectDetails(
|
||||
this.properties.getGroup(),
|
||||
(this.properties.getArtifact() != null)
|
||||
? this.properties.getArtifact() : "unspecified",
|
||||
this.properties.getVersion(), this.properties.getName(),
|
||||
this.properties.getTime(),
|
||||
coerceToStringValues(this.properties.getAdditional())));
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new TaskExecutionException(this, ex);
|
||||
@@ -77,8 +74,8 @@ public class BuildInfo extends ConventionTask {
|
||||
*/
|
||||
@OutputDirectory
|
||||
public File getDestinationDir() {
|
||||
return (this.destinationDir != null ? this.destinationDir
|
||||
: getProject().getBuildDir());
|
||||
return (this.destinationDir != null) ? this.destinationDir
|
||||
: getProject().getBuildDir();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,8 +58,8 @@ public class BootJar extends Jar implements BootArchive {
|
||||
|
||||
private Action<CopySpec> classpathFiles(Spec<File> filter) {
|
||||
return (copySpec) -> copySpec
|
||||
.from((Callable<Iterable<File>>) () -> (this.classpath != null
|
||||
? this.classpath.filter(filter) : Collections.emptyList()));
|
||||
.from((Callable<Iterable<File>>) () -> (this.classpath != null)
|
||||
? this.classpath.filter(filter) : Collections.emptyList());
|
||||
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class BootJar extends Jar implements BootArchive {
|
||||
public void classpath(Object... classpath) {
|
||||
FileCollection existingClasspath = this.classpath;
|
||||
this.classpath = getProject().files(
|
||||
existingClasspath != null ? existingClasspath : Collections.emptyList(),
|
||||
(existingClasspath != null) ? existingClasspath : Collections.emptyList(),
|
||||
classpath);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ public class BootWar extends War implements BootArchive {
|
||||
public BootWar() {
|
||||
getWebInf().into("lib-provided",
|
||||
(copySpec) -> copySpec.from(
|
||||
(Callable<Iterable<File>>) () -> (this.providedClasspath != null
|
||||
? this.providedClasspath : Collections.emptyList())));
|
||||
(Callable<Iterable<File>>) () -> (this.providedClasspath != null)
|
||||
? this.providedClasspath : Collections.emptyList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,7 +127,7 @@ public class BootWar extends War implements BootArchive {
|
||||
public void providedClasspath(Object... classpath) {
|
||||
FileCollection existingClasspath = this.providedClasspath;
|
||||
this.providedClasspath = getProject().files(
|
||||
existingClasspath != null ? existingClasspath : Collections.emptyList(),
|
||||
(existingClasspath != null) ? existingClasspath : Collections.emptyList(),
|
||||
classpath);
|
||||
}
|
||||
|
||||
|
||||
@@ -283,8 +283,8 @@ class BootZipCopyAction implements CopyAction {
|
||||
}
|
||||
|
||||
private long getTime(FileCopyDetails details) {
|
||||
return (this.preserveFileTimestamps ? details.getLastModified()
|
||||
: CONSTANT_TIME_FOR_ZIP_ENTRIES);
|
||||
return this.preserveFileTimestamps ? details.getLastModified()
|
||||
: CONSTANT_TIME_FOR_ZIP_ENTRIES;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user