From 57c64eb3bc1112e95bd22639b374b4cc60b24eee Mon Sep 17 00:00:00 2001 From: xiaokeliu666 Date: Sun, 20 Oct 2019 02:15:37 -0400 Subject: [PATCH] Polish See gh-18665 --- .../ContextIdApplicationContextInitializer.java | 2 +- .../context/config/ConfigFileApplicationListener.java | 2 +- .../org/springframework/boot/info/InfoProperties.java | 2 +- .../boot/logging/java/JavaLoggingSystem.java | 2 +- .../java/org/springframework/boot/util/LambdaSafe.java | 10 ++++------ 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java index f8aae8e15e..f7e6e0ceee 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java @@ -72,7 +72,7 @@ public class ContextIdApplicationContextInitializer /** * The ID of a context. */ - class ContextId { + static class ContextId { private final AtomicLong children = new AtomicLong(0); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index f796359dc2..485c5fa75f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -248,7 +248,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, * {@link BeanFactoryPostProcessor} to re-order our property sources below any * {@code @PropertySource} items added by the {@link ConfigurationClassPostProcessor}. */ - private class PropertySourceOrderingPostProcessor implements BeanFactoryPostProcessor, Ordered { + private static class PropertySourceOrderingPostProcessor implements BeanFactoryPostProcessor, Ordered { private ConfigurableApplicationContext context; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/InfoProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/InfoProperties.java index 17cb796911..18e5bc951b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/InfoProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/InfoProperties.java @@ -121,7 +121,7 @@ public class InfoProperties implements Iterable { /** * Property entry. */ - public final class Entry { + public static final class Entry { private final String key; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java index 0b04ee7751..e79b751006 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java @@ -168,7 +168,7 @@ public class JavaLoggingSystem extends AbstractLoggingSystem { this.configuredLoggers.clear(); } - private final class ShutdownHandler implements Runnable { + private static final class ShutdownHandler implements Runnable { @Override public void run() { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java index cf7de8cd5a..0ddaa7c66f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java @@ -279,12 +279,10 @@ public final class LambdaSafe { * @param invoker the invoker used to invoke the callback */ public void invoke(Consumer invoker) { - this.callbackInstances.forEach((callbackInstance) -> { - invoke(callbackInstance, () -> { - invoker.accept(callbackInstance); - return null; - }); - }); + this.callbackInstances.forEach((callbackInstance) -> invoke(callbackInstance, () -> { + invoker.accept(callbackInstance); + return null; + })); } /**