diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundrySecurityInterceptor.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundrySecurityInterceptor.java index ea379d6dbd..73c0b00a01 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundrySecurityInterceptor.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundrySecurityInterceptor.java @@ -46,7 +46,8 @@ class CloudFoundrySecurityInterceptor { private final String applicationId; - private static Mono SUCCESS = Mono.just(SecurityResponse.success()); + private static final Mono SUCCESS = Mono + .just(SecurityResponse.success()); CloudFoundrySecurityInterceptor(ReactiveTokenValidator tokenValidator, ReactiveCloudFoundrySecurityService cloudFoundrySecurityService, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java index c5ccc3fcd2..bfbacbf481 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ import org.springframework.util.StringUtils; public class JndiConnectionFactoryAutoConfiguration { // Keep these in sync with the condition below - private static String[] JNDI_LOCATIONS = { "java:/JmsXA", + private static final String[] JNDI_LOCATIONS = { "java:/JmsXA", "java:/XAConnectionFactory" }; private final JmsProperties properties; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java index 95978c115f..cec1e7a70d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ public class HibernateJpaAutoConfiguration { @Order(Ordered.HIGHEST_PRECEDENCE + 20) static class HibernateEntityManagerCondition extends SpringBootCondition { - private static String[] CLASS_NAMES = { + private static final String[] CLASS_NAMES = { "org.hibernate.ejb.HibernateEntityManager", "org.hibernate.jpa.HibernateEntityManager" }; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java index 9d5f2094c4..3269ed3f4a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,10 +46,10 @@ import org.springframework.util.StringUtils; */ public class WebConversionService extends DefaultFormattingConversionService { - private static final boolean jsr354Present = ClassUtils.isPresent( + private static final boolean JSR_354_PRESENT = ClassUtils.isPresent( "javax.money.MonetaryAmount", WebConversionService.class.getClassLoader()); - private static final boolean jodaTimePresent = ClassUtils.isPresent( + private static final boolean JODA_TIME_PRESENT = ClassUtils.isPresent( "org.joda.time.LocalDate", WebConversionService.class.getClassLoader()); private final String dateFormat; @@ -72,14 +72,14 @@ public class WebConversionService extends DefaultFormattingConversionService { private void addFormatters() { addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory()); - if (jsr354Present) { + if (JSR_354_PRESENT) { addFormatter(new CurrencyUnitFormatter()); addFormatter(new MonetaryAmountFormatter()); addFormatterForFieldAnnotation( new Jsr354NumberFormatAnnotationFormatterFactory()); } registerJsr310(); - if (jodaTimePresent) { + if (JODA_TIME_PRESENT) { registerJodaTime(); } registerJavaDate(); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/encodepassword/EncodePasswordCommand.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/encodepassword/EncodePasswordCommand.java index 226116a033..15d1219ba0 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/encodepassword/EncodePasswordCommand.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/encodepassword/EncodePasswordCommand.java @@ -48,7 +48,7 @@ import org.springframework.util.StringUtils; */ public class EncodePasswordCommand extends OptionParsingCommand { - private static Map> ENCODERS; + private static final Map> ENCODERS; static { Map> encoders = new LinkedHashMap<>(); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GenericBomAstTransformation.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GenericBomAstTransformation.java index 2e2ecd6368..938a61a77f 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GenericBomAstTransformation.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GenericBomAstTransformation.java @@ -54,7 +54,7 @@ import org.springframework.core.Ordered; public abstract class GenericBomAstTransformation implements SpringBootAstTransformation, Ordered { - private static ClassNode BOM = ClassHelper.make(DependencyManagementBom.class); + private static final ClassNode BOM = ClassHelper.make(DependencyManagementBom.class); @Override public void visit(ASTNode[] nodes, SourceUnit source) { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizer.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizer.java index fae49d5922..b28c26a8ad 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizer.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -105,9 +105,9 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi } private void addFilters(ConfigurableMockMvcBuilder builder) { - ServletContextInitializerBeans Initializers = new ServletContextInitializerBeans( + ServletContextInitializerBeans initializers = new ServletContextInitializerBeans( this.context); - for (ServletContextInitializer initializer : Initializers) { + for (ServletContextInitializer initializer : initializers) { if (initializer instanceof FilterRegistrationBean) { addFilter(builder, (FilterRegistrationBean) initializer); } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandler.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandler.java index f54e67a40b..136475ea83 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandler.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/LocalHostUriTemplateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,12 +34,12 @@ import org.springframework.web.util.UriTemplateHandler; */ public class LocalHostUriTemplateHandler extends RootUriTemplateHandler { + private static final String PREFIX = "server.servlet."; + private final Environment environment; private final String scheme; - private final String prefix = "server.servlet."; - /** * Create a new {@code LocalHostUriTemplateHandler} that will generate {@code http} * URIs using the given {@code environment} to determine the context path and port. @@ -68,8 +68,7 @@ public class LocalHostUriTemplateHandler extends RootUriTemplateHandler { @Override public String getRootUri() { String port = this.environment.getProperty("local.server.port", "8080"); - String contextPath = this.environment.getProperty(this.prefix + "context-path", - ""); + String contextPath = this.environment.getProperty(PREFIX + "context-path", ""); return this.scheme + "://localhost:" + port + contextPath; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java index f039ef88fe..5e555365a7 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ class Tree extends ReflectionWrapper { private final Method acceptMethod = findMethod("accept", this.treeVisitorType, Object.class); - private final Method GET_CLASS_TREE_MEMBERS = findMethod( + private final Method getClassTreeMembers = findMethod( findClass("com.sun.source.tree.ClassTree"), "getMembers"); Tree(Object instance) { @@ -65,7 +65,7 @@ class Tree extends ReflectionWrapper { throws Throwable { if (method.getName().equals("visitClass")) { if ((Integer) args[1] == 0) { - Iterable members = (Iterable) Tree.this.GET_CLASS_TREE_MEMBERS + Iterable members = (Iterable) Tree.this.getClassTreeMembers .invoke(args[0]); for (Object member : members) { if (member != null) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java index f1ca2c6993..4cbb54c5e5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ import org.springframework.boot.loader.data.RandomAccessData; */ class CentralDirectoryParser { - private int CENTRAL_DIRECTORY_HEADER_BASE_SIZE = 46; + private static final int CENTRAL_DIRECTORY_HEADER_BASE_SIZE = 46; private final List visitors = new ArrayList<>(); @@ -67,7 +67,7 @@ class CentralDirectoryParser { for (int i = 0; i < endRecord.getNumberOfRecords(); i++) { fileHeader.load(bytes, dataOffset, null, 0, null); visitFileHeader(dataOffset, fileHeader); - dataOffset += this.CENTRAL_DIRECTORY_HEADER_BASE_SIZE + dataOffset += CENTRAL_DIRECTORY_HEADER_BASE_SIZE + fileHeader.getName().length() + fileHeader.getComment().length() + fileHeader.getExtra().length; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java index e1a585cc0f..feeb2b5c27 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ import java.util.Set; */ class SpringBootExceptionHandler implements UncaughtExceptionHandler { - private static Set LOG_CONFIGURATION_MESSAGES; + private static final Set LOG_CONFIGURATION_MESSAGES; static { Set messages = new HashSet<>(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java index df029d6ecb..c7ba0c283d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextApplicationContextInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ public class ParentContextApplicationContextInitializer implements private static class EventPublisher implements ApplicationListener, Ordered { - private static EventPublisher INSTANCE = new EventPublisher(); + private static final EventPublisher INSTANCE = new EventPublisher(); @Override public int getOrder() { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java index beb202d5b3..aeab13099e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java @@ -110,7 +110,7 @@ public class LoggingApplicationListener implements GenericApplicationListener { */ public static final String LOGGING_SYSTEM_BEAN_NAME = "springBootLoggingSystem"; - private static MultiValueMap LOG_LEVEL_LOGGERS; + private static final MultiValueMap LOG_LEVEL_LOGGERS; private static AtomicBoolean shutdownHookRegistered = new AtomicBoolean(false); @@ -125,11 +125,11 @@ public class LoggingApplicationListener implements GenericApplicationListener { LOG_LEVEL_LOGGERS.add(LogLevel.DEBUG, "org.hibernate.SQL"); } - private static Class[] EVENT_TYPES = { ApplicationStartingEvent.class, + private static final Class[] EVENT_TYPES = { ApplicationStartingEvent.class, ApplicationEnvironmentPreparedEvent.class, ApplicationPreparedEvent.class, ContextClosedEvent.class, ApplicationFailedEvent.class }; - private static Class[] SOURCE_TYPES = { SpringApplication.class, + private static final Class[] SOURCE_TYPES = { SpringApplication.class, ApplicationContext.class }; private final Log logger = LogFactory.getLog(getClass());