Browse Source

Replace explicit generics with diamond operator

Where possible, explicit generic declarations to use the Java 8 diamond
operator.

See gh-9781
pull/9855/head
Emanuel Campolo 9 years ago committed by Phillip Webb
parent
commit
04fdec6f8b
  1. 2
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java
  2. 2
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpoint.java
  3. 2
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java
  4. 2
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java
  5. 4
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/CachePublicMetricsTests.java
  6. 4
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java
  7. 2
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java
  8. 6
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java
  9. 4
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java
  10. 2
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java
  11. 2
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestProperties.java
  12. 2
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java
  13. 2
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java
  14. 2
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProvider.java
  15. 3
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java
  16. 3
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java
  17. 2
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java
  18. 4
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
  19. 6
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java
  20. 3
      spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.java
  21. 2
      spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerIntegrationTests.java
  22. 2
      spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/BootRunApplicationLauncher.java
  23. 2
      spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/IdeApplicationLauncher.java
  24. 2
      spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java
  25. 2
      spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java
  26. 2
      spring-boot-test/src/main/java/org/springframework/boot/test/json/DuplicateJsonObjectContextCustomizerFactory.java
  27. 2
      spring-boot-test/src/main/java/org/springframework/boot/test/json/JacksonTester.java
  28. 4
      spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java
  29. 2
      spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java
  30. 2
      spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java
  31. 2
      spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/PomCondition.java
  32. 2
      spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/GradleBuild.java
  33. 4
      spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java
  34. 4
      spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java
  35. 2
      spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java
  36. 13
      spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/runner/classpath/ModifiedClassPathRunner.java
  37. 4
      spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java
  38. 4
      spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java
  39. 2
      spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedYamlLoader.java
  40. 6
      spring-boot/src/main/java/org/springframework/boot/jta/narayana/NarayanaProperties.java
  41. 2
      spring-boot/src/main/java/org/springframework/boot/web/context/ServerPortInfoApplicationContextInitializer.java
  42. 2
      spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java
  43. 2
      spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java
  44. 2
      spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java

2
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java

@ -169,7 +169,7 @@ public class ManagementServerProperties implements SecurityPrerequisite { @@ -169,7 +169,7 @@ public class ManagementServerProperties implements SecurityPrerequisite {
/**
* Comma-separated list of roles that can access the management endpoint.
*/
private List<String> roles = new ArrayList<String>(
private List<String> roles = new ArrayList<>(
Collections.singletonList("ACTUATOR"));
/**

2
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpoint.java

@ -89,7 +89,7 @@ public class EnvironmentEndpoint extends AbstractEndpoint<Map<String, Object>> { @@ -89,7 +89,7 @@ public class EnvironmentEndpoint extends AbstractEndpoint<Map<String, Object>> {
}
private Map<String, PropertySource<?>> getPropertySourcesAsMap() {
Map<String, PropertySource<?>> map = new LinkedHashMap<String, PropertySource<?>>();
Map<String, PropertySource<?>> map = new LinkedHashMap<>();
for (PropertySource<?> source : getPropertySources()) {
extract("", map, source);
}

2
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java

@ -40,7 +40,7 @@ public class CompositeHealthIndicator implements HealthIndicator { @@ -40,7 +40,7 @@ public class CompositeHealthIndicator implements HealthIndicator {
* @param healthAggregator the health aggregator
*/
public CompositeHealthIndicator(HealthAggregator healthAggregator) {
this(healthAggregator, new LinkedHashMap<String, HealthIndicator>());
this(healthAggregator, new LinkedHashMap<>());
}
/**

2
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java

@ -191,7 +191,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order @@ -191,7 +191,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
}
private Map<String, String[]> getParameterMapCopy(HttpServletRequest request) {
return new LinkedHashMap<String, String[]>(request.getParameterMap());
return new LinkedHashMap<>(request.getParameterMap());
}
/**

4
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/CachePublicMetricsTests.java

@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.entry; @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.entry;
*/
public class CachePublicMetricsTests {
private Map<String, CacheManager> cacheManagers = new HashMap<String, CacheManager>();
private Map<String, CacheManager> cacheManagers = new HashMap<>();
@Before
public void setup() {
@ -98,7 +98,7 @@ public class CachePublicMetricsTests { @@ -98,7 +98,7 @@ public class CachePublicMetricsTests {
private Map<String, Number> metrics(CachePublicMetrics cpm) {
Collection<Metric<?>> metrics = cpm.metrics();
assertThat(metrics).isNotNull();
Map<String, Number> result = new HashMap<String, Number>();
Map<String, Number> result = new HashMap<>();
for (Metric<?> metric : metrics) {
result.put(metric.getName(), metric.getValue());
}

4
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointSerializationTests.java

@ -435,9 +435,9 @@ public class ConfigurationPropertiesReportEndpointSerializationTests { @@ -435,9 +435,9 @@ public class ConfigurationPropertiesReportEndpointSerializationTests {
public static class InitializedMapAndListProperties extends Foo {
private Map<String, Boolean> map = new HashMap<String, Boolean>();
private Map<String, Boolean> map = new HashMap<>();
private List<String> list = new ArrayList<String>();
private List<String> list = new ArrayList<>();
public Map<String, Boolean> getMap() {
return this.map;

2
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java

@ -268,7 +268,7 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE @@ -268,7 +268,7 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
this.context = new AnnotationConfigApplicationContext();
MutablePropertySources propertySources = this.context.getEnvironment()
.getPropertySources();
Map<String, Object> source = new HashMap<String, Object>();
Map<String, Object> source = new HashMap<>();
source.put("foo", Collections.singletonMap("bar", "baz"));
propertySources.addFirst(new MapPropertySource("test", source));
this.context.register(Config.class);

6
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java

@ -142,7 +142,7 @@ public class EnvironmentMvcEndpointTests { @@ -142,7 +142,7 @@ public class EnvironmentMvcEndpointTests {
@Test
public void nestedPathWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty()
throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("my.foo", "${my.bar}");
((ConfigurableEnvironment) this.context.getEnvironment()).getPropertySources()
.addFirst(new MapPropertySource("unresolved-placeholder", map));
@ -152,7 +152,7 @@ public class EnvironmentMvcEndpointTests { @@ -152,7 +152,7 @@ public class EnvironmentMvcEndpointTests {
@Test
public void nestedPathWithSensitivePlaceholderShouldSanitize() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("my.foo", "${my.password}");
map.put("my.password", "hello");
((ConfigurableEnvironment) this.context.getEnvironment()).getPropertySources()
@ -165,7 +165,7 @@ public class EnvironmentMvcEndpointTests { @@ -165,7 +165,7 @@ public class EnvironmentMvcEndpointTests {
public void propertyWithTypeOtherThanStringShouldNotFail() throws Exception {
MutablePropertySources propertySources = ((ConfigurableEnvironment) this.context
.getEnvironment()).getPropertySources();
Map<String, Object> source = new HashMap<String, Object>();
Map<String, Object> source = new HashMap<>();
source.put("foo", Collections.singletonMap("bar", "baz"));
propertySources.addFirst(new MapPropertySource("test", source));
this.mvc.perform(get("/application/env/foo.*")).andExpect(status().isOk())

4
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java

@ -97,7 +97,7 @@ public class StatsdMetricWriterTests { @@ -97,7 +97,7 @@ public class StatsdMetricWriterTests {
@Test
public void incrementMetricWithInvalidCharsInName() throws Exception {
this.writer.increment(new Delta<Long>("counter.fo:o", 3L));
this.writer.increment(new Delta<>("counter.fo:o", 3L));
this.server.waitForMessage();
assertThat(this.server.messagesReceived().get(0))
.isEqualTo("me.counter.fo-o:3|c");
@ -105,7 +105,7 @@ public class StatsdMetricWriterTests { @@ -105,7 +105,7 @@ public class StatsdMetricWriterTests {
@Test
public void setMetricWithInvalidCharsInName() throws Exception {
this.writer.set(new Metric<Long>("gauge.f:o:o", 3L));
this.writer.set(new Metric<>("gauge.f:o:o", 3L));
this.server.waitForMessage();
assertThat(this.server.messagesReceived().get(0)).isEqualTo("me.gauge.f-o-o:3|g");
}

2
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java

@ -134,7 +134,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec @@ -134,7 +134,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
AnnotationMetadata metadata) {
MultiValueMap<Class<?>, Annotation> annotations = new LinkedMultiValueMap<>();
Class<?> source = ClassUtils.resolveClassName(metadata.getClassName(), null);
collectAnnotations(source, annotations, new HashSet<Class<?>>());
collectAnnotations(source, annotations, new HashSet<>());
return Collections.unmodifiableMap(annotations);
}

2
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestProperties.java

@ -34,7 +34,7 @@ public class JestProperties { @@ -34,7 +34,7 @@ public class JestProperties {
/**
* Comma-separated list of the Elasticsearch instances to use.
*/
private List<String> uris = new ArrayList<String>(
private List<String> uris = new ArrayList<>(
Collections.singletonList("http://localhost:9200"));
/**

2
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java

@ -73,7 +73,7 @@ public class FlywayProperties { @@ -73,7 +73,7 @@ public class FlywayProperties {
* SQL statements to execute to initialize a connection immediately after obtaining
* it.
*/
private List<String> initSqls = new ArrayList<String>();
private List<String> initSqls = new ArrayList<>();
public void setLocations(List<String> locations) {
this.locations = locations;

2
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java

@ -41,7 +41,7 @@ public class FreeMarkerTemplateAvailabilityProvider @@ -41,7 +41,7 @@ public class FreeMarkerTemplateAvailabilityProvider
static final class FreeMarkerTemplateAvailabilityProperties
extends TemplateAvailabilityProperties {
private List<String> templateLoaderPath = new ArrayList<String>(
private List<String> templateLoaderPath = new ArrayList<>(
Arrays.asList(FreeMarkerProperties.DEFAULT_TEMPLATE_LOADER_PATH));
FreeMarkerTemplateAvailabilityProperties() {

2
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProvider.java

@ -41,7 +41,7 @@ public class GroovyTemplateAvailabilityProvider @@ -41,7 +41,7 @@ public class GroovyTemplateAvailabilityProvider
static final class GroovyTemplateAvailabilityProperties
extends TemplateAvailabilityProperties {
private List<String> resourceLoaderPath = new ArrayList<String>(
private List<String> resourceLoaderPath = new ArrayList<>(
Arrays.asList(GroovyTemplateProperties.DEFAULT_RESOURCE_LOADER_PATH));
GroovyTemplateAvailabilityProperties() {

3
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java

@ -181,8 +181,7 @@ public class EmbeddedLdapAutoConfiguration { @@ -181,8 +181,7 @@ public class EmbeddedLdapAutoConfiguration {
private Map<String, Object> getLdapPorts(MutablePropertySources sources) {
PropertySource<?> propertySource = sources.get(PROPERTY_SOURCE_NAME);
if (propertySource == null) {
propertySource = new MapPropertySource(PROPERTY_SOURCE_NAME,
new HashMap<String, Object>());
propertySource = new MapPropertySource(PROPERTY_SOURCE_NAME, new HashMap<>());
sources.addFirst(propertySource);
}
return (Map<String, Object>) propertySource.getSource();

3
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java

@ -179,8 +179,7 @@ public class EmbeddedMongoAutoConfiguration { @@ -179,8 +179,7 @@ public class EmbeddedMongoAutoConfiguration {
private Map<String, Object> getMongoPorts(MutablePropertySources sources) {
PropertySource<?> propertySource = sources.get("mongo.ports");
if (propertySource == null) {
propertySource = new MapPropertySource("mongo.ports",
new HashMap<String, Object>());
propertySource = new MapPropertySource("mongo.ports", new HashMap<>());
sources.addFirst(propertySource);
}
return (Map<String, Object>) propertySource.getSource();

2
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java

@ -64,7 +64,7 @@ public class UserInfoTokenServicesTests { @@ -64,7 +64,7 @@ public class UserInfoTokenServicesTests {
public void init() {
this.resource.setClientId("foo");
given(this.template.getForEntity(any(String.class), eq(Map.class)))
.willReturn(new ResponseEntity<Map>(this.map, HttpStatus.OK));
.willReturn(new ResponseEntity<>(this.map, HttpStatus.OK));
given(this.template.getAccessToken())
.willReturn(new DefaultOAuth2AccessToken("FOO"));
given(this.template.getResource()).willReturn(this.resource);

4
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java

@ -120,7 +120,7 @@ public class ServerPropertiesTests { @@ -120,7 +120,7 @@ public class ServerPropertiesTests {
@Test
public void redirectContextRootIsNotConfiguredByDefault() throws Exception {
bind(new HashMap<String, String>());
bind(new HashMap<>());
ServerProperties.Tomcat tomcat = this.properties.getTomcat();
assertThat(tomcat.getRedirectContextRoot()).isNull();
}
@ -164,7 +164,7 @@ public class ServerPropertiesTests { @@ -164,7 +164,7 @@ public class ServerPropertiesTests {
@Test
public void testCustomizeJettyAccessLog() throws Exception {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("server.jetty.accesslog.enabled", "true");
map.put("server.jetty.accesslog.filename", "foo.txt");
map.put("server.jetty.accesslog.file-date-format", "yyyymmdd");

6
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java

@ -107,7 +107,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { @@ -107,7 +107,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
@Test
public void tomcatAccessLogFileDateFormatByDefault() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("server.tomcat.accesslog.enabled", "true");
bindProperties(map);
this.customizer.customize(factory);
@ -118,7 +118,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { @@ -118,7 +118,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
@Test
public void tomcatAccessLogFileDateFormatCanBeRedefined() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("server.tomcat.accesslog.enabled", "true");
map.put("server.tomcat.accesslog.file-date-format", "yyyy-MM-dd.HH");
bindProperties(map);
@ -397,7 +397,7 @@ public class DefaultServletWebServerFactoryCustomizerTests { @@ -397,7 +397,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
@Test
public void customTomcatDisableMaxHttpPostSize() {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("server.tomcat.max-http-post-size", "-1");
bindProperties(map);
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);

3
spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.java

@ -126,8 +126,7 @@ public class DevToolsDataSourceAutoConfiguration { @@ -126,8 +126,7 @@ public class DevToolsDataSourceAutoConfiguration {
InMemoryDatabase(String urlPrefix, String... driverClassNames) {
this.urlPrefix = urlPrefix;
this.driverClassNames = new HashSet<String>(
Arrays.asList(driverClassNames));
this.driverClassNames = new HashSet<>(Arrays.asList(driverClassNames));
}
boolean matches(DataSourceProperties properties) {

2
spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerIntegrationTests.java

@ -58,7 +58,7 @@ public abstract class AbstractEmbeddedServletContainerIntegrationTests { @@ -58,7 +58,7 @@ public abstract class AbstractEmbeddedServletContainerIntegrationTests {
private static List<Object> createParameters(String packaging, String container,
List<Class<? extends AbstractApplicationLauncher>> applicationLaunchers) {
List<Object> parameters = new ArrayList<Object>();
List<Object> parameters = new ArrayList<>();
ApplicationBuilder applicationBuilder = new ApplicationBuilder(temporaryFolder,
packaging, container);
for (Class<? extends AbstractApplicationLauncher> launcherClass : applicationLaunchers) {

2
spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/BootRunApplicationLauncher.java

@ -56,7 +56,7 @@ class BootRunApplicationLauncher extends AbstractApplicationLauncher { @@ -56,7 +56,7 @@ class BootRunApplicationLauncher extends AbstractApplicationLauncher {
if (archive.getName().endsWith(".war")) {
populateSrcMainWebapp();
}
List<String> classpath = new ArrayList<String>();
List<String> classpath = new ArrayList<>();
classpath.add(targetClasses.getAbsolutePath());
for (File dependency : dependencies.listFiles()) {
classpath.add(dependency.getAbsolutePath());

2
spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/IdeApplicationLauncher.java

@ -67,7 +67,7 @@ class IdeApplicationLauncher extends AbstractApplicationLauncher { @@ -67,7 +67,7 @@ class IdeApplicationLauncher extends AbstractApplicationLauncher {
if (archive.getName().endsWith(".war")) {
populateSrcMainWebapp();
}
List<String> classpath = new ArrayList<String>();
List<String> classpath = new ArrayList<>();
classpath.add(targetClasses.getAbsolutePath());
for (File dependency : dependencies.listFiles()) {
classpath.add(dependency.getAbsolutePath());

2
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java

@ -60,7 +60,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?> @@ -60,7 +60,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
private Map<String, Object> getProperties(Class<?> source) {
Map<String, Object> properties = new LinkedHashMap<>();
collectProperties(source, source, properties, new HashSet<Class<?>>());
collectProperties(source, source, properties, new HashSet<>());
return Collections.unmodifiableMap(properties);
}

2
spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java

@ -219,7 +219,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr @@ -219,7 +219,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
ContextConfiguration configuration) {
ContextConfigurationAttributes attributes = new ContextConfigurationAttributes(
candidateConfig.getTestClass(), configuration);
Set<Class<?>> configurationClasses = new HashSet<Class<?>>(
Set<Class<?>> configurationClasses = new HashSet<>(
Arrays.asList(attributes.getClasses()));
for (Class<?> candidate : candidateConfig.getClasses()) {
if (configurationClasses.contains(candidate)) {

2
spring-boot-test/src/main/java/org/springframework/boot/test/json/DuplicateJsonObjectContextCustomizerFactory.java

@ -60,7 +60,7 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa @@ -60,7 +60,7 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa
}
private List<URL> findJsonObjects() {
List<URL> jsonObjects = new ArrayList<URL>();
List<URL> jsonObjects = new ArrayList<>();
try {
Enumeration<URL> resources = getClass().getClassLoader()
.getResources("org/json/JSONObject.class");

2
spring-boot-test/src/main/java/org/springframework/boot/test/json/JacksonTester.java

@ -158,7 +158,7 @@ public class JacksonTester<T> extends AbstractJsonMarshalTester<T> { @@ -158,7 +158,7 @@ public class JacksonTester<T> extends AbstractJsonMarshalTester<T> {
* @return the new instance
*/
public JacksonTester<T> forView(Class<?> view) {
return new JacksonTester<T>(this.getResourceLoadClass(), this.getType(),
return new JacksonTester<>(this.getResourceLoadClass(), this.getType(),
this.objectMapper, view);
}

4
spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java

@ -46,7 +46,7 @@ class BootArchiveSupport { @@ -46,7 +46,7 @@ class BootArchiveSupport {
private static final Set<String> DEFAULT_LAUNCHER_CLASSES;
static {
Set<String> defaultLauncherClasses = new HashSet<String>();
Set<String> defaultLauncherClasses = new HashSet<>();
defaultLauncherClasses.add("org.springframework.boot.loader.JarLauncher");
defaultLauncherClasses.add("org.springframework.boot.loader.PropertiesLauncher");
defaultLauncherClasses.add("org.springframework.boot.loader.WarLauncher");
@ -121,7 +121,7 @@ class BootArchiveSupport { @@ -121,7 +121,7 @@ class BootArchiveSupport {
}
private void configureExclusions() {
Set<String> excludes = new HashSet<String>();
Set<String> excludes = new HashSet<>();
if (this.excludeDevtools) {
excludes.add("**/spring-boot-devtools-*.jar");
}

2
spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java

@ -132,7 +132,7 @@ class BootZipCopyAction implements CopyAction { @@ -132,7 +132,7 @@ class BootZipCopyAction implements CopyAction {
private Spec<FileTreeElement> writeLoaderClasses(ZipArchiveOutputStream out) {
try (ZipInputStream in = new ZipInputStream(getClass()
.getResourceAsStream("/META-INF/loader/spring-boot-loader.jar"))) {
Set<String> entries = new HashSet<String>();
Set<String> entries = new HashSet<>();
java.util.zip.ZipEntry entry;
while ((entry = in.getNextEntry()) != null) {
if (entry.isDirectory() && !entry.getName().startsWith("META-INF/")) {

2
spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java

@ -34,7 +34,7 @@ public class LaunchScriptConfiguration implements Serializable { @@ -34,7 +34,7 @@ public class LaunchScriptConfiguration implements Serializable {
private boolean included = false;
private final Map<String, String> properties = new HashMap<String, String>();
private final Map<String, String> properties = new HashMap<>();
private File script;

2
spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/PomCondition.java

@ -40,7 +40,7 @@ class PomCondition extends Condition<File> { @@ -40,7 +40,7 @@ class PomCondition extends Condition<File> {
private Set<String> notExpectedContents;
PomCondition() {
this(new HashSet<String>(), new HashSet<String>());
this(new HashSet<>(), new HashSet<>());
}
private PomCondition(Set<String> expectedContents, Set<String> notExpectedContents) {

2
spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/GradleBuild.java

@ -160,7 +160,7 @@ public class GradleBuild implements TestRule { @@ -160,7 +160,7 @@ public class GradleBuild implements TestRule {
if (this.gradleVersion != null) {
gradleRunner.withGradleVersion(this.gradleVersion);
}
List<String> allArguments = new ArrayList<String>();
List<String> allArguments = new ArrayList<>();
allArguments.add("-PpluginClasspath=" + pluginClasspath());
allArguments.add("-PbootVersion=" + getBootVersion());
allArguments.add("--stacktrace");

4
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java

@ -330,7 +330,7 @@ public class PropertiesLauncher extends Launcher { @@ -330,7 +330,7 @@ public class PropertiesLauncher extends Launcher {
@Override
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception {
Set<URL> urls = new LinkedHashSet<URL>(archives.size());
Set<URL> urls = new LinkedHashSet<>(archives.size());
for (Archive archive : archives) {
urls.add(archive.getUrl());
}
@ -522,7 +522,7 @@ public class PropertiesLauncher extends Launcher { @@ -522,7 +522,7 @@ public class PropertiesLauncher extends Launcher {
root = "";
}
EntryFilter filter = new PrefixMatchingArchiveFilter(root);
List<Archive> archives = new ArrayList<Archive>(parent.getNestedArchives(filter));
List<Archive> archives = new ArrayList<>(parent.getNestedArchives(filter));
if (("".equals(root) || ".".equals(root)) && !path.endsWith(".jar")
&& parent != this.parent) {
// You can't find the root with an entry filter so it has to be added

4
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java

@ -66,7 +66,7 @@ public abstract class SystemPropertyUtils { @@ -66,7 +66,7 @@ public abstract class SystemPropertyUtils {
if (text == null) {
return text;
}
return parseStringValue(null, text, text, new HashSet<String>());
return parseStringValue(null, text, text, new HashSet<>());
}
/**
@ -83,7 +83,7 @@ public abstract class SystemPropertyUtils { @@ -83,7 +83,7 @@ public abstract class SystemPropertyUtils {
if (text == null) {
return text;
}
return parseStringValue(properties, text, text, new HashSet<String>());
return parseStringValue(properties, text, text, new HashSet<>());
}
private static String parseStringValue(Properties properties, String value,

2
spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java

@ -266,7 +266,7 @@ public class PropertiesLauncherTests { @@ -266,7 +266,7 @@ public class PropertiesLauncherTests {
}
private List<Archive> archives() throws Exception {
List<Archive> archives = new ArrayList<Archive>();
List<Archive> archives = new ArrayList<>();
String path = System.getProperty("java.class.path");
for (String url : path.split(File.pathSeparator)) {
archives.add(archive(url));

13
spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/runner/classpath/ModifiedClassPathRunner.java

@ -100,7 +100,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { @@ -100,7 +100,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner {
}
private URL[] extractUrls(URLClassLoader classLoader) throws Exception {
List<URL> extractedUrls = new ArrayList<URL>();
List<URL> extractedUrls = new ArrayList<>();
for (URL url : classLoader.getURLs()) {
if (isSurefireBooterJar(url)) {
extractedUrls.addAll(extractUrlsFromManifestClassPath(url));
@ -117,7 +117,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { @@ -117,7 +117,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner {
}
private List<URL> extractUrlsFromManifestClassPath(URL booterJar) throws Exception {
List<URL> urls = new ArrayList<URL>();
List<URL> urls = new ArrayList<>();
for (String entry : getClassPath(booterJar)) {
urls.add(new URL(entry));
}
@ -133,7 +133,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { @@ -133,7 +133,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner {
private URL[] processUrls(URL[] urls, Class<?> testClass) throws Exception {
ClassPathEntryFilter filter = new ClassPathEntryFilter(testClass);
List<URL> processedUrls = new ArrayList<URL>();
List<URL> processedUrls = new ArrayList<>();
processedUrls.addAll(getAdditionalUrls(testClass));
for (URL url : urls) {
if (!filter.isExcluded(url)) {
@ -173,7 +173,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { @@ -173,7 +173,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner {
DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, null);
DependencyResult result = repositorySystem.resolveDependencies(session,
dependencyRequest);
List<URL> resolvedArtifacts = new ArrayList<URL>();
List<URL> resolvedArtifacts = new ArrayList<>();
for (ArtifactResult artifact : result.getArtifactResults()) {
resolvedArtifacts.add(artifact.getArtifact().getFile().toURI().toURL());
}
@ -181,7 +181,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { @@ -181,7 +181,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner {
}
private List<Dependency> createDependencies(String[] allCoordinates) {
List<Dependency> dependencies = new ArrayList<Dependency>();
List<Dependency> dependencies = new ArrayList<>();
for (String coordinate : allCoordinates) {
dependencies.add(new Dependency(new DefaultArtifact(coordinate), null));
}
@ -254,8 +254,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { @@ -254,8 +254,7 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner {
private List<FrameworkMethod> wrapFrameworkMethods(
List<FrameworkMethod> methods) {
List<FrameworkMethod> wrapped = new ArrayList<FrameworkMethod>(
methods.size());
List<FrameworkMethod> wrapped = new ArrayList<>(methods.size());
for (FrameworkMethod frameworkMethod : methods) {
wrapped.add(new ModifiedClassPathFrameworkMethod(
frameworkMethod.getMethod()));

4
spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java

@ -42,7 +42,7 @@ final class EnvironmentConverter { @@ -42,7 +42,7 @@ final class EnvironmentConverter {
private static final Set<String> SERVLET_ENVIRONMENT_SOURCE_NAMES;
static {
final Set<String> names = new HashSet<String>();
final Set<String> names = new HashSet<>();
names.add(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME);
names.add(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME);
names.add(StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME);
@ -109,7 +109,7 @@ final class EnvironmentConverter { @@ -109,7 +109,7 @@ final class EnvironmentConverter {
}
private void removeAllPropertySources(MutablePropertySources propertySources) {
Set<String> names = new HashSet<String>();
Set<String> names = new HashSet<>();
for (PropertySource<?> propertySource : propertySources) {
names.add(propertySource.getName());
}

4
spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java

@ -451,7 +451,7 @@ public final class ConfigurationPropertyName @@ -451,7 +451,7 @@ public final class ConfigurationPropertyName
if (name.length() == 0) {
return EMPTY;
}
List<CharSequence> elements = new ArrayList<CharSequence>(10);
List<CharSequence> elements = new ArrayList<>(10);
process(name, '.', (elementValue, start, end, indexed) -> {
if (elementValue.length() > 0) {
if (!indexed) {
@ -496,7 +496,7 @@ public final class ConfigurationPropertyName @@ -496,7 +496,7 @@ public final class ConfigurationPropertyName
if (name.length() == 0) {
return EMPTY;
}
List<CharSequence> elements = new ArrayList<CharSequence>(10);
List<CharSequence> elements = new ArrayList<>(10);
process(name, separator, (elementValue, start, end, indexed) -> {
elementValue = elementValueProcessor.apply(elementValue);
if (!isIndexed(elementValue)) {

2
spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedYamlLoader.java vendored

@ -78,7 +78,7 @@ class OriginTrackedYamlLoader extends YamlProcessor { @@ -78,7 +78,7 @@ class OriginTrackedYamlLoader extends YamlProcessor {
}
public Map<String, Object> load() {
final Map<String, Object> result = new LinkedHashMap<String, Object>();
final Map<String, Object> result = new LinkedHashMap<>();
process((properties, map) -> {
result.putAll(getFlattenedMap(map));
});

6
spring-boot/src/main/java/org/springframework/boot/jta/narayana/NarayanaProperties.java

@ -91,21 +91,21 @@ public class NarayanaProperties { @@ -91,21 +91,21 @@ public class NarayanaProperties {
/**
* Comma-separated list of orphan filters.
*/
private List<String> xaResourceOrphanFilters = new ArrayList<String>(Arrays.asList(
private List<String> xaResourceOrphanFilters = new ArrayList<>(Arrays.asList(
"com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter",
"com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter"));
/**
* Comma-separated list of recovery modules.
*/
private List<String> recoveryModules = new ArrayList<String>(Arrays.asList(
private List<String> recoveryModules = new ArrayList<>(Arrays.asList(
"com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule",
"com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule"));
/**
* Comma-separated list of expiry scanners.
*/
private List<String> expiryScanners = new ArrayList<String>(Collections.singletonList(
private List<String> expiryScanners = new ArrayList<>(Collections.singletonList(
"com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner"));
public String getLogDir() {

2
spring-boot/src/main/java/org/springframework/boot/web/context/ServerPortInfoApplicationContextInitializer.java

@ -88,7 +88,7 @@ public class ServerPortInfoApplicationContextInitializer @@ -88,7 +88,7 @@ public class ServerPortInfoApplicationContextInitializer
MutablePropertySources sources = environment.getPropertySources();
PropertySource<?> source = sources.get("server.ports");
if (source == null) {
source = new MapPropertySource("server.ports", new HashMap<String, Object>());
source = new MapPropertySource("server.ports", new HashMap<>());
sources.addFirst(source);
}
((Map<String, Object>) source.getSource()).put(propertyName, port);

2
spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java

@ -489,7 +489,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac @@ -489,7 +489,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac
File root = getValidDocumentRoot();
File docBase = getCanonicalDocumentRoot(root);
List<URL> metaInfResourceUrls = getUrlsOfJarsWithMetaInfResources();
List<URL> resourceJarUrls = new ArrayList<URL>();
List<URL> resourceJarUrls = new ArrayList<>();
List<ResourceManager> resourceManagers = new ArrayList<ResourceManager>();
ResourceManager rootResourceManager = docBase.isDirectory()
? new FileResourceManager(docBase, 0) : new JarResourceManager(docBase);

2
spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java

@ -444,7 +444,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { @@ -444,7 +444,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
this.context = new AnnotationConfigApplicationContext();
MutablePropertySources sources = this.context.getEnvironment()
.getPropertySources();
Map<String, Object> source = new LinkedHashMap<String, Object>();
Map<String, Object> source = new LinkedHashMap<>();
source.put("example.one", "foo");
sources.addFirst(new MapPropertySource("test-source", source));
this.context.register(PrototypePropertiesConfig.class);

2
spring-boot/src/test/java/org/springframework/boot/web/server/WebServerFactoryCustomizerBeanPostProcessorTests.java

@ -154,7 +154,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests { @@ -154,7 +154,7 @@ public class WebServerFactoryCustomizerBeanPostProcessorTests {
WebServerFactoryCustomizer<WebServerFactoryOne> one = (f) -> called.add("one");
WebServerFactoryCustomizer<WebServerFactoryTwo> two = (f) -> called.add("two");
WebServerFactoryCustomizer<WebServerFactory> all = (f) -> called.add("all");
Map<String, Object> beans = new LinkedHashMap<String, Object>();
Map<String, Object> beans = new LinkedHashMap<>();
beans.put("one", one);
beans.put("two", two);
beans.put("all", all);

Loading…
Cancel
Save