Skip to content

Commit 69e96c6

Browse files
committed
Polish
1 parent 97f15d6 commit 69e96c6

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,17 @@ private Method getFactoryMethod(ConfigurableListableBeanFactory beanFactory,
138138
.getBeanDefinition(definition.getFactoryBeanName());
139139
Class<?> factoryClass = ClassUtils.forName(factoryDefinition.getBeanClassName(),
140140
beanFactory.getBeanClassLoader());
141+
return getFactoryMethod(definition, factoryClass);
142+
}
143+
144+
private Method getFactoryMethod(BeanDefinition definition, Class<?> factoryClass) {
141145
Method uniqueMethod = null;
142146
for (Method candidate : getCandidateFactoryMethods(definition, factoryClass)) {
143147
if (candidate.getName().equals(definition.getFactoryMethodName())) {
144148
if (uniqueMethod == null) {
145149
uniqueMethod = candidate;
146150
}
147-
else if (!matchingArguments(candidate, uniqueMethod)) {
151+
else if (!hasMatchingParameterTypes(candidate, uniqueMethod)) {
148152
return null;
149153
}
150154
}
@@ -164,7 +168,7 @@ private boolean shouldConsiderNonPublicMethods(BeanDefinition definition) {
164168
&& ((AbstractBeanDefinition) definition).isNonPublicAccessAllowed();
165169
}
166170

167-
private boolean matchingArguments(Method candidate, Method current) {
171+
private boolean hasMatchingParameterTypes(Method candidate, Method current) {
168172
return Arrays.equals(candidate.getParameterTypes(), current.getParameterTypes());
169173
}
170174

spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,10 @@ private class FilePool {
246246
public RandomAccessFile acquire() throws IOException {
247247
this.available.acquireUninterruptibly();
248248
RandomAccessFile file = this.files.poll();
249-
return (file == null
250-
? new RandomAccessFile(RandomAccessDataFile.this.file, "r") : file);
249+
if (file != null) {
250+
return file;
251+
}
252+
return new RandomAccessFile(RandomAccessDataFile.this.file, "r");
251253
}
252254

253255
public void release(RandomAccessFile file) {

spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
6464
/**
6565
* Add maven resources to the classpath directly, this allows live in-place editing of
6666
* resources. Duplicate resources are removed from {@code target/classes} to prevent
67-
* them to appear twice if {@code ClassLoader.getResources()} is called. Please consider
68-
* adding {@code spring-boot-devtools} to your project instead as it provides this feature
69-
* and many more.
67+
* them to appear twice if {@code ClassLoader.getResources()} is called. Please
68+
* consider adding {@code spring-boot-devtools} to your project instead as it provides
69+
* this feature and many more.
7070
* @since 1.0
7171
*/
7272
@Parameter(property = "run.addResources", defaultValue = "false")
@@ -90,8 +90,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
9090
/**
9191
* JVM arguments that should be associated with the forked process used to run the
9292
* application. On command line, make sure to wrap multiple values between quotes.
93-
* NOTE: the use of JVM arguments means that processes will be started by forking
94-
* a new JVM.
93+
* NOTE: the use of JVM arguments means that processes will be started by forking a
94+
* new JVM.
9595
* @since 1.1
9696
*/
9797
@Parameter(property = "run.jvmArguments")
@@ -214,10 +214,10 @@ private void findAgent() {
214214
private void run(String startClassName)
215215
throws MojoExecutionException, MojoFailureException {
216216
findAgent();
217-
boolean forkEnabled = isFork();
217+
boolean fork = isFork();
218218
this.project.getProperties().setProperty("_spring.boot.fork.enabled",
219-
Boolean.toString(forkEnabled));
220-
if (forkEnabled) {
219+
Boolean.toString(fork));
220+
if (fork) {
221221
doRunWithForkedJvm(startClassName);
222222
}
223223
else {

spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ private boolean isForked() {
103103
if (this.fork != null) {
104104
return this.fork;
105105
}
106-
String property = this.project.getProperties().getProperty("_spring.boot.fork.enabled");
106+
String property = this.project.getProperties()
107+
.getProperty("_spring.boot.fork.enabled");
107108
return Boolean.valueOf(property);
108109
}
109110

0 commit comments

Comments
 (0)