diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java index d8ccf9aafe..1807a12939 100644 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java +++ b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java @@ -78,7 +78,7 @@ public class EndpointDocumentation { static final File LOG_FILE = new File("target/logs/spring.log"); private static final Set SKIPPED = Collections - .unmodifiableSet(new HashSet( + .unmodifiableSet(new HashSet<>( Arrays.asList("/docs", "/logfile", "/heapdump", "/auditevents"))); @Autowired @@ -161,8 +161,8 @@ public class EndpointDocumentation { @Test public void endpoints() throws Exception { final File docs = new File("src/main/asciidoc"); - final Map model = new LinkedHashMap(); - final List endpoints = new ArrayList(); + final Map model = new LinkedHashMap<>(); + final List endpoints = new ArrayList<>(); model.put("endpoints", endpoints); for (MvcEndpoint endpoint : getEndpoints()) { final String endpointPath = (StringUtils.hasText(endpoint.getPath()) @@ -200,7 +200,7 @@ public class EndpointDocumentation { } private Collection getEndpoints() { - List endpoints = new ArrayList( + List endpoints = new ArrayList<>( this.mvcEndpoints.getEndpoints()); Collections.sort(endpoints, new Comparator() { @Override diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/LimitedEnvironmentEndpoint.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/LimitedEnvironmentEndpoint.java index 443c06cd0f..eaa2d95140 100644 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/LimitedEnvironmentEndpoint.java +++ b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/LimitedEnvironmentEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -39,8 +39,8 @@ public class LimitedEnvironmentEndpoint extends EnvironmentEndpoint { private static final MultiValueMap INCLUDES; static { - Map> includes = new LinkedHashMap>(); - List systemProperties = new ArrayList(); + Map> includes = new LinkedHashMap<>(); + List systemProperties = new ArrayList<>(); systemProperties.add("java.runtime.name"); systemProperties.add("sun.boot.library.path"); systemProperties.add("java.vendor.url"); @@ -61,14 +61,13 @@ public class LimitedEnvironmentEndpoint extends EnvironmentEndpoint { systemProperties.add("java.vendor"); systemProperties.add("file.separator"); includes.put("systemProperties", systemProperties); - List systemEnvironment = new ArrayList(); + List systemEnvironment = new ArrayList<>(); systemEnvironment.add("SHELL"); systemEnvironment.add("TMPDIR"); systemEnvironment.add("DISPLAY"); systemEnvironment.add("LOGNAME"); includes.put("systemEnvironment", systemEnvironment); - INCLUDES = new LinkedMultiValueMap( - Collections.unmodifiableMap(includes)); + INCLUDES = new LinkedMultiValueMap<>(Collections.unmodifiableMap(includes)); } @Override diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java index ae96349f10..84501c61cc 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java @@ -94,7 +94,7 @@ public class AuditEvent implements Serializable { } private static Map convert(String[] data) { - Map result = new HashMap(); + Map result = new HashMap<>(); for (String entry : data) { if (entry.contains("=")) { int index = entry.indexOf("="); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java index 5ee48dd923..2602701742 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java @@ -81,7 +81,7 @@ public class InMemoryAuditEventRepository implements AuditEventRepository { @Override public List find(String principal, Date after, String type) { - LinkedList events = new LinkedList(); + LinkedList events = new LinkedList<>(); synchronized (this.monitor) { for (int i = 0; i < this.events.length; i++) { AuditEvent event = resolveTailEvent(i); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java index 2e7b0e4eba..357dacd433 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -145,7 +145,7 @@ public class EndpointAutoConfiguration { @Bean @ConditionalOnMissingBean public MetricsEndpoint metricsEndpoint() { - List publicMetrics = new ArrayList(); + List publicMetrics = new ArrayList<>(); if (this.publicMetrics != null) { publicMetrics.addAll(this.publicMetrics); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointCorsProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointCorsProperties.java index 8f2ba01ae3..caeb45669d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointCorsProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointCorsProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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,23 +34,23 @@ public class EndpointCorsProperties { * Comma-separated list of origins to allow. '*' allows all origins. When not set, * CORS support is disabled. */ - private List allowedOrigins = new ArrayList(); + private List allowedOrigins = new ArrayList<>(); /** * Comma-separated list of methods to allow. '*' allows all methods. When not set, * defaults to GET. */ - private List allowedMethods = new ArrayList(); + private List allowedMethods = new ArrayList<>(); /** * Comma-separated list of headers to allow in a request. '*' allows all headers. */ - private List allowedHeaders = new ArrayList(); + private List allowedHeaders = new ArrayList<>(); /** * Comma-separated list of headers to include in a response. */ - private List exposedHeaders = new ArrayList(); + private List exposedHeaders = new ArrayList<>(); /** * Set whether credentials are supported. When not set, credentials are not supported. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java index b16c7e81d8..40ac3065be 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java @@ -243,7 +243,7 @@ public class EndpointWebMvcChildContextConfiguration { } private List extractMappings() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.addAll(this.beanFactory.getBeansOfType(HandlerMapping.class).values()); list.remove(this); AnnotationAwareOrderComparator.sort(list); @@ -260,7 +260,7 @@ public class EndpointWebMvcChildContextConfiguration { private List adapters; private List extractAdapters() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.addAll(this.beanFactory.getBeansOfType(HandlerAdapter.class).values()); list.remove(this); AnnotationAwareOrderComparator.sort(list); @@ -317,7 +317,7 @@ public class EndpointWebMvcChildContextConfiguration { private List resolvers; private List extractResolvers() { - List list = new ArrayList(); + List list = new ArrayList<>(); list.addAll(this.beanFactory.getBeansOfType(HandlerExceptionResolver.class) .values()); list.remove(this); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java index 531649405a..ea77499047 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.java @@ -126,8 +126,8 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { @ConditionalOnBean(DocsMvcEndpoint.class) @ConditionalOnMissingBean(CurieProvider.class) @ConditionalOnProperty(prefix = "endpoints.docs.curies", name = "enabled", matchIfMissing = false) - public DefaultCurieProvider curieProvider( - ManagementServerProperties management, DocsMvcEndpoint endpoint) { + public DefaultCurieProvider curieProvider(ManagementServerProperties management, + DocsMvcEndpoint endpoint) { String path = management.getContextPath() + endpoint.getPath() + "/#spring_boot_actuator__{rel}"; return new DefaultCurieProvider("boot", new UriTemplate(path)); @@ -229,7 +229,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { private final List handlerAdapters; - private final Map> converterCache = new ConcurrentHashMap>(); + private final Map> converterCache = new ConcurrentHashMap<>(); MvcEndpointAdvice(List handlerAdapters) { this.handlerAdapters = handlerAdapters; @@ -248,7 +248,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration { private void configureHttpMessageConverter( HttpMessageConverter messageConverter) { if (messageConverter instanceof TypeConstrainedMappingJackson2HttpMessageConverter) { - List supportedMediaTypes = new ArrayList( + List supportedMediaTypes = new ArrayList<>( messageConverter.getSupportedMediaTypes()); supportedMediaTypes.add(ActuatorMediaTypes.APPLICATION_ACTUATOR_V1_JSON); ((AbstractHttpMessageConverter) messageConverter) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java index e6855de2f7..95d7008019 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java @@ -201,7 +201,7 @@ public class HealthIndicatorAutoConfiguration { if (candidates == null) { return null; } - Map dataSources = new LinkedHashMap(); + Map dataSources = new LinkedHashMap<>(); for (Map.Entry entry : candidates.entrySet()) { if (!(entry.getValue() instanceof AbstractRoutingDataSource)) { dataSources.put(entry.getKey(), entry.getValue()); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointProperties.java index dd1650e5f9..a6b5e52537 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthMvcEndpointProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -36,7 +36,7 @@ public class HealthMvcEndpointProperties { * Mapping of health statuses to HttpStatus codes. By default, registered health * statuses map to sensible defaults (i.e. UP maps to 200). */ - private Map mapping = new HashMap(); + private Map mapping = new HashMap<>(); public Map getMapping() { return this.mapping; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaProperties.java index 95986cd437..35ab01d2e5 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,7 +34,7 @@ public class JolokiaProperties { * Jolokia settings. These are traditionally set using servlet parameters. Refer to * the documentation of Jolokia for more details. */ - private Map config = new HashMap(); + private Map config = new HashMap<>(); public Map getConfig() { return this.config; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/LinksEnhancer.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/LinksEnhancer.java index f0429137ee..2d7a0f4a5e 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/LinksEnhancer.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/LinksEnhancer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ class LinksEnhancer { resource.add(linkTo(LinksEnhancer.class).slash(this.rootPath + self) .withSelfRel()); } - MultiValueMap added = new LinkedMultiValueMap(); + MultiValueMap added = new LinkedMultiValueMap<>(); for (MvcEndpoint endpoint : this.endpoints.getEndpoints()) { if (!endpoint.getPath().equals(self)) { String rel = getRel(endpoint); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementContextConfigurationsImportSelector.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementContextConfigurationsImportSelector.java index 5ecb99599b..45466df3ab 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementContextConfigurationsImportSelector.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementContextConfigurationsImportSelector.java @@ -53,7 +53,7 @@ class ManagementContextConfigurationsImportSelector // Find all management context configuration classes, filtering duplicates List configurations = getConfigurations(); OrderComparator.sort(configurations); - List names = new ArrayList(); + List names = new ArrayList<>(); for (ManagementConfiguration configuration : configurations) { names.add(configuration.getClassName()); } @@ -63,7 +63,7 @@ class ManagementContextConfigurationsImportSelector private List getConfigurations() { SimpleMetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory( this.classLoader); - List configurations = new ArrayList(); + List configurations = new ArrayList<>(); for (String className : loadFactoryNames()) { getConfiguration(readerFactory, configurations, className); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java index babc13bc11..623a6edad7 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java @@ -295,7 +295,7 @@ public class ManagementWebSecurityAutoConfiguration { return NO_PATHS; } Set endpoints = endpointHandlerMapping.getEndpoints(); - Set paths = new LinkedHashSet(endpoints.size()); + Set paths = new LinkedHashSet<>(endpoints.size()); for (MvcEndpoint endpoint : endpoints) { if (isIncluded(endpoint)) { String path = endpointHandlerMapping.getPath(endpoint.getPath()); @@ -361,10 +361,11 @@ public class ManagementWebSecurityAutoConfiguration { private RequestMatcher createDelegate() { ServerProperties server = this.contextResolver.getApplicationContext() .getBean(ServerProperties.class); - List matchers = new ArrayList(); + List matchers = new ArrayList<>(); EndpointHandlerMapping endpointHandlerMapping = getRequiredEndpointHandlerMapping(); for (String path : this.endpointPaths.getPaths(endpointHandlerMapping)) { - matchers.add(new AntPathRequestMatcher(server.getServlet().getPath(path))); + matchers.add( + new AntPathRequestMatcher(server.getServlet().getPath(path))); } return (matchers.isEmpty() ? MATCH_NONE : new OrRequestMatcher(matchers)); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java index 0a11bfca7b..c837c79a96 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -78,7 +78,7 @@ public class MetricExportAutoConfiguration { @ConditionalOnMissingBean(name = "metricWritersMetricExporter") public SchedulingConfigurer metricWritersMetricExporter( MetricExportProperties properties) { - Map writers = new HashMap(); + Map writers = new HashMap<>(); MetricReader reader = this.endpointReader; if (reader == null && !CollectionUtils.isEmpty(this.readers)) { reader = new CompositeMetricReader( diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterProperties.java index 33bbeedef2..8f9ae456d6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterProperties.java @@ -43,9 +43,8 @@ public class MetricFilterProperties { private Set counterSubmissions; public MetricFilterProperties() { - this.gaugeSubmissions = new HashSet( - EnumSet.of(MetricsFilterSubmission.MERGED)); - this.counterSubmissions = new HashSet( + this.gaugeSubmissions = new HashSet<>(EnumSet.of(MetricsFilterSubmission.MERGED)); + this.counterSubmissions = new HashSet<>( EnumSet.of(MetricsFilterSubmission.MERGED)); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java index abfb791b09..f9a2bec5ee 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricsFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -65,7 +65,7 @@ final class MetricsFilter extends OncePerRequestFilter { private static final Set STATUS_REPLACERS; static { - Set replacements = new LinkedHashSet(); + Set replacements = new LinkedHashSet<>(); replacements.add(new PatternReplacer("\\{(.+?)(?::.+)?\\}", 0, "-$1-")); replacements.add(new PatternReplacer("**", Pattern.LITERAL, "-star-star-")); replacements.add(new PatternReplacer("*", Pattern.LITERAL, "-star-")); @@ -77,7 +77,7 @@ final class MetricsFilter extends OncePerRequestFilter { private static final Set KEY_REPLACERS; static { - Set replacements = new LinkedHashSet(); + Set replacements = new LinkedHashSet<>(); replacements.add(new PatternReplacer("/", Pattern.LITERAL, ".")); replacements.add(new PatternReplacer("..", Pattern.LITERAL, ".")); KEY_REPLACERS = Collections.unmodifiableSet(replacements); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/AbstractJmxCacheStatisticsProvider.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/AbstractJmxCacheStatisticsProvider.java index e62b66e128..418ce193ff 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/AbstractJmxCacheStatisticsProvider.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/AbstractJmxCacheStatisticsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ public abstract class AbstractJmxCacheStatisticsProvider private MBeanServer mBeanServer; - private final Map caches = new ConcurrentHashMap(); + private final Map caches = new ConcurrentHashMap<>(); @Override public CacheStatistics getCacheStatistics(CacheManager cacheManager, C cache) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/DefaultCacheStatistics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/DefaultCacheStatistics.java index d676e3690b..091ab34ccb 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/DefaultCacheStatistics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/DefaultCacheStatistics.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -37,7 +37,7 @@ public class DefaultCacheStatistics implements CacheStatistics { @Override public Collection> toMetrics(String prefix) { - Collection> result = new ArrayList>(); + Collection> result = new ArrayList<>(); addMetric(result, prefix + "size", getSize()); addMetric(result, prefix + "hit.ratio", getHitRatio()); addMetric(result, prefix + "miss.ratio", getMissRatio()); @@ -83,7 +83,7 @@ public class DefaultCacheStatistics implements CacheStatistics { private void addMetric(Collection> metrics, String name, T value) { if (value != null) { - metrics.add(new Metric(name, value)); + metrics.add(new Metric<>(name, value)); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfiguration.java index 460891dec2..4d7cc6b3df 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryActuatorAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -60,7 +60,7 @@ public class CloudFoundryActuatorAutoConfiguration { public CloudFoundryEndpointHandlerMapping cloudFoundryEndpointHandlerMapping( MvcEndpoints mvcEndpoints, RestTemplateBuilder restTemplateBuilder, Environment environment) { - Set endpoints = new LinkedHashSet( + Set endpoints = new LinkedHashSet<>( mvcEndpoints.getEndpoints(NamedMvcEndpoint.class)); HandlerInterceptor securityInterceptor = getSecurityInterceptor( restTemplateBuilder, environment); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpoint.java index a270e18a41..a409c652bf 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -48,7 +48,7 @@ class CloudFoundryDiscoveryMvcEndpoint extends AbstractMvcEndpoint { @RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Map> links(HttpServletRequest request) { - Map links = new LinkedHashMap(); + Map links = new LinkedHashMap<>(); String url = request.getRequestURL().toString(); if (url.endsWith("/")) { url = url.substring(0, url.length() - 1); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityService.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityService.java index e0b8a3a314..7f7dd85f0b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityService.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundrySecurityService.java @@ -116,7 +116,7 @@ class CloudFoundrySecurityService { } private Map extractTokenKeys(Map response) { - Map tokenKeys = new HashMap(); + Map tokenKeys = new HashMap<>(); for (Object key : (List) response.get("keys")) { Map tokenKey = (Map) key; tokenKeys.put((String) tokenKey.get("kid"), (String) tokenKey.get("value")); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java index 02af56b5bb..c4f8c8542f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -77,8 +77,8 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint { private final Report parent; public Report(ConditionEvaluationReport report) { - this.positiveMatches = new LinkedMultiValueMap(); - this.negativeMatches = new LinkedHashMap(); + this.positiveMatches = new LinkedMultiValueMap<>(); + this.negativeMatches = new LinkedHashMap<>(); this.exclusions = report.getExclusions(); for (Map.Entry entry : report .getConditionAndOutcomesBySource().entrySet()) { @@ -131,9 +131,9 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint { @JsonPropertyOrder({ "notMatched", "matched" }) public static class MessageAndConditions { - private final List notMatched = new ArrayList(); + private final List notMatched = new ArrayList<>(); - private final List matched = new ArrayList(); + private final List matched = new ArrayList<>(); public MessageAndConditions(ConditionAndOutcomes conditionAndOutcomes) { for (ConditionAndOutcome conditionAndOutcome : conditionAndOutcomes) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java index 04dedfd613..e646f4580d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java @@ -90,7 +90,7 @@ public class BeansEndpoint extends AbstractEndpoint> } private Set getContextHierarchy() { - Set contexts = new LinkedHashSet(); + Set contexts = new LinkedHashSet<>(); ApplicationContext context = this.leafContext; while (context != null) { contexts.add(asConfigurableContext(context)); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java index 25ab754826..ffb75ffa19 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/CachePublicMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -47,7 +47,7 @@ public class CachePublicMetrics implements PublicMetrics { @Override public Collection> metrics() { - Collection> metrics = new HashSet>(); + Collection> metrics = new HashSet<>(); for (Map.Entry> entry : getCacheManagerBeans() .entrySet()) { addMetrics(metrics, entry.getKey(), entry.getValue()); @@ -56,7 +56,7 @@ public class CachePublicMetrics implements PublicMetrics { } private MultiValueMap getCacheManagerBeans() { - MultiValueMap cacheManagerNamesByCacheName = new LinkedMultiValueMap(); + MultiValueMap cacheManagerNamesByCacheName = new LinkedMultiValueMap<>(); for (Map.Entry entry : this.cacheManagers.entrySet()) { for (String cacheName : entry.getValue().getCacheNames()) { cacheManagerNamesByCacheName.add(cacheName, diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java index 49e8e68b32..3558d565da 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java @@ -100,7 +100,7 @@ public class ConfigurationPropertiesReportEndpoint } private Map extract(ApplicationContext context, ObjectMapper mapper) { - Map result = new HashMap(); + Map result = new HashMap<>(); ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData( context); Map beans = getConfigurationPropertiesBeans(context, @@ -108,7 +108,7 @@ public class ConfigurationPropertiesReportEndpoint for (Map.Entry entry : beans.entrySet()) { String beanName = entry.getKey(); Object bean = entry.getValue(); - Map root = new HashMap(); + Map root = new HashMap<>(); String prefix = extractPrefix(context, beanFactoryMetaData, beanName, bean); root.put("prefix", prefix); root.put("properties", sanitize(prefix, safeSerialize(mapper, bean, prefix))); @@ -133,7 +133,7 @@ public class ConfigurationPropertiesReportEndpoint private Map getConfigurationPropertiesBeans( ApplicationContext context, ConfigurationBeanFactoryMetaData beanFactoryMetaData) { - Map beans = new HashMap(); + Map beans = new HashMap<>(); beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class)); if (beanFactoryMetaData != null) { beans.putAll(beanFactoryMetaData @@ -154,13 +154,13 @@ public class ConfigurationPropertiesReportEndpoint String prefix) { try { @SuppressWarnings("unchecked") - Map result = new HashMap( + Map result = new HashMap<>( mapper.convertValue(bean, Map.class)); return result; } catch (Exception ex) { - return new HashMap(Collections.singletonMap( - "error", "Cannot serialize '" + prefix + "'")); + return new HashMap<>(Collections.singletonMap("error", + "Cannot serialize '" + prefix + "'")); } } @@ -253,7 +253,7 @@ public class ConfigurationPropertiesReportEndpoint @SuppressWarnings("unchecked") private List sanitize(String prefix, List list) { - List sanitized = new ArrayList(); + List sanitized = new ArrayList<>(); for (Object item : list) { if (item instanceof Map) { sanitized.add(sanitize(prefix, (Map) item)); @@ -317,7 +317,7 @@ public class ConfigurationPropertiesReportEndpoint @Override public List changeProperties(SerializationConfig config, BeanDescription beanDesc, List beanProperties) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (BeanPropertyWriter writer : beanProperties) { boolean readable = isReadable(beanDesc, writer); if (readable) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java index a9d6c555f4..29b03e9686 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DataSourcePublicMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ public class DataSourcePublicMetrics implements PublicMetrics { @Autowired private Collection providers; - private final Map metadataByPrefix = new HashMap(); + private final Map metadataByPrefix = new HashMap<>(); @PostConstruct public void initialize() { @@ -72,7 +72,7 @@ public class DataSourcePublicMetrics implements PublicMetrics { @Override public Collection> metrics() { - Set> metrics = new LinkedHashSet>(); + Set> metrics = new LinkedHashSet<>(); for (Map.Entry entry : this.metadataByPrefix .entrySet()) { String prefix = entry.getKey(); @@ -87,7 +87,7 @@ public class DataSourcePublicMetrics implements PublicMetrics { private void addMetric(Set> metrics, String name, T value) { if (value != null) { - metrics.add(new Metric(name, value)); + metrics.add(new Metric<>(name, value)); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpoint.java index c21442ba03..daec0884e6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,14 +54,14 @@ public class EnvironmentEndpoint extends AbstractEndpoint> { @Override public Map invoke() { - Map result = new LinkedHashMap(); + Map result = new LinkedHashMap<>(); result.put("profiles", getEnvironment().getActiveProfiles()); for (Entry> entry : getPropertySources().entrySet()) { PropertySource source = entry.getValue(); String sourceName = entry.getKey(); if (source instanceof EnumerablePropertySource) { EnumerablePropertySource enumerable = (EnumerablePropertySource) source; - Map properties = new LinkedHashMap(); + Map properties = new LinkedHashMap<>(); for (String name : enumerable.getPropertyNames()) { properties.put(name, sanitize(name, enumerable.getProperty(name))); } @@ -75,7 +75,7 @@ public class EnvironmentEndpoint extends AbstractEndpoint> { } private Map> getPropertySources() { - Map> map = new LinkedHashMap>(); + Map> map = new LinkedHashMap<>(); MutablePropertySources sources = null; Environment environment = getEnvironment(); if (environment != null && environment instanceof ConfigurableEnvironment) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java index 8113081560..d5e33b5376 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -56,9 +56,9 @@ public class FlywayEndpoint extends AbstractEndpoint> { @Override public List invoke() { - List reports = new ArrayList(); + List reports = new ArrayList<>(); for (Map.Entry entry : this.flyways.entrySet()) { - List migrations = new ArrayList(); + List migrations = new ArrayList<>(); for (MigrationInfo info : entry.getValue().info().all()) { migrations.add(new FlywayMigration(info)); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java index 9008bab7b0..4c65fac6d3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java @@ -56,7 +56,7 @@ public class LiquibaseEndpoint extends AbstractEndpoint> { @Override public List invoke() { - List reports = new ArrayList(); + List reports = new ArrayList<>(); DatabaseFactory factory = DatabaseFactory.getInstance(); StandardChangeLogHistoryService service = new StandardChangeLogHistoryService(); for (Map.Entry entry : this.liquibases.entrySet()) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LoggersEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LoggersEndpoint.java index db730d11a7..7fe2270fef 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LoggersEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LoggersEndpoint.java @@ -59,7 +59,7 @@ public class LoggersEndpoint extends AbstractEndpoint> { if (configurations == null) { return Collections.emptyMap(); } - Map result = new LinkedHashMap(); + Map result = new LinkedHashMap<>(); result.put("levels", getLevels()); result.put("loggers", getLoggers(configurations)); return result; @@ -67,13 +67,12 @@ public class LoggersEndpoint extends AbstractEndpoint> { private NavigableSet getLevels() { Set levels = this.loggingSystem.getSupportedLogLevels(); - return new TreeSet(levels).descendingSet(); + return new TreeSet<>(levels).descendingSet(); } private Map getLoggers( Collection configurations) { - Map loggers = new LinkedHashMap( - configurations.size()); + Map loggers = new LinkedHashMap<>(configurations.size()); for (LoggerConfiguration configuration : configurations) { loggers.put(configuration.getName(), new LoggerLevels(configuration)); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricReaderPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricReaderPublicMetrics.java index 306f70b536..b68784d1c8 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricReaderPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricReaderPublicMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -43,7 +43,7 @@ public class MetricReaderPublicMetrics implements PublicMetrics { @Override public Collection> metrics() { - List> result = new ArrayList>(); + List> result = new ArrayList<>(); for (Metric metric : this.metricReader.findAll()) { result.add(metric); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpoint.java index ec54fa3f52..612cdefa8a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -54,7 +54,7 @@ public class MetricsEndpoint extends AbstractEndpoint> { public MetricsEndpoint(Collection publicMetrics) { super("metrics"); Assert.notNull(publicMetrics, "PublicMetrics must not be null"); - this.publicMetrics = new ArrayList(publicMetrics); + this.publicMetrics = new ArrayList<>(publicMetrics); AnnotationAwareOrderComparator.sort(this.publicMetrics); } @@ -69,8 +69,8 @@ public class MetricsEndpoint extends AbstractEndpoint> { @Override public Map invoke() { - Map result = new LinkedHashMap(); - List metrics = new ArrayList(this.publicMetrics); + Map result = new LinkedHashMap<>(); + List metrics = new ArrayList<>(this.publicMetrics); for (PublicMetrics publicMetric : metrics) { try { for (Metric metric : publicMetric.metrics()) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpointMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpointMetricReader.java index 3944748bce..ee1eabbc2a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpointMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/MetricsEndpointMetricReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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,20 +46,20 @@ public class MetricsEndpointMetricReader implements MetricReader { Metric metric = null; Object value = this.endpoint.invoke().get(metricName); if (value != null) { - metric = new Metric(metricName, (Number) value); + metric = new Metric<>(metricName, (Number) value); } return metric; } @Override public Iterable> findAll() { - List> metrics = new ArrayList>(); + List> metrics = new ArrayList<>(); Map values = this.endpoint.invoke(); Date timestamp = new Date(); for (Entry entry : values.entrySet()) { String name = entry.getKey(); Object value = entry.getValue(); - metrics.add(new Metric(name, (Number) value, timestamp)); + metrics.add(new Metric<>(name, (Number) value, timestamp)); } return metrics; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java index 647db74461..c7caece589 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -77,7 +77,7 @@ public class RequestMappingEndpoint extends AbstractEndpoint @Override public Map invoke() { - Map result = new LinkedHashMap(); + Map result = new LinkedHashMap<>(); extractHandlerMappings(this.handlerMappings, result); extractHandlerMappings(this.applicationContext, result); extractMethodMappings(this.methodMappings, result); @@ -94,7 +94,7 @@ public class RequestMappingEndpoint extends AbstractEndpoint @SuppressWarnings("unchecked") Map methods = bean.getValue().getHandlerMethods(); for (Entry method : methods.entrySet()) { - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); map.put("bean", bean.getKey()); map.put("method", method.getValue().toString()); result.put(method.getKey().toString(), map); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java index dc4d1d2615..970cec57d0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -42,7 +42,7 @@ public class RichGaugeReaderPublicMetrics implements PublicMetrics { @Override public Collection> metrics() { - List> result = new ArrayList>(); + List> result = new ArrayList<>(); for (RichGauge richGauge : this.richGaugeReader.findAll()) { result.addAll(convert(richGauge)); } @@ -50,15 +50,13 @@ public class RichGaugeReaderPublicMetrics implements PublicMetrics { } private List> convert(RichGauge gauge) { - List> result = new ArrayList>(6); - result.add( - new Metric(gauge.getName() + RichGauge.AVG, gauge.getAverage())); - result.add(new Metric(gauge.getName() + RichGauge.VAL, gauge.getValue())); - result.add(new Metric(gauge.getName() + RichGauge.MIN, gauge.getMin())); - result.add(new Metric(gauge.getName() + RichGauge.MAX, gauge.getMax())); - result.add( - new Metric(gauge.getName() + RichGauge.ALPHA, gauge.getAlpha())); - result.add(new Metric(gauge.getName() + RichGauge.COUNT, gauge.getCount())); + List> result = new ArrayList<>(6); + result.add(new Metric<>(gauge.getName() + RichGauge.AVG, gauge.getAverage())); + result.add(new Metric<>(gauge.getName() + RichGauge.VAL, gauge.getValue())); + result.add(new Metric<>(gauge.getName() + RichGauge.MIN, gauge.getMin())); + result.add(new Metric<>(gauge.getName() + RichGauge.MAX, gauge.getMax())); + result.add(new Metric<>(gauge.getName() + RichGauge.ALPHA, gauge.getAlpha())); + result.add(new Metric<>(gauge.getName() + RichGauge.COUNT, gauge.getCount())); return result; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java index 6b09d57fba..6a0a97ecb4 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -53,7 +53,7 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { @Override public Collection> metrics() { - Collection> result = new LinkedHashSet>(); + Collection> result = new LinkedHashSet<>(); addBasicMetrics(result); addManagementMetrics(result); return result; @@ -69,8 +69,8 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { result.add(newMemoryMetric("mem", runtime.totalMemory() + getTotalNonHeapMemoryIfPossible())); result.add(newMemoryMetric("mem.free", runtime.freeMemory())); - result.add(new Metric("processors", runtime.availableProcessors())); - result.add(new Metric("instance.uptime", + result.add(new Metric<>("processors", runtime.availableProcessors())); + result.add(new Metric<>("instance.uptime", System.currentTimeMillis() - this.timestamp)); } @@ -91,9 +91,9 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { private void addManagementMetrics(Collection> result) { try { // Add JVM up time in ms - result.add(new Metric("uptime", + result.add(new Metric<>("uptime", ManagementFactory.getRuntimeMXBean().getUptime())); - result.add(new Metric("systemload.average", + result.add(new Metric<>("systemload.average", ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage())); addHeapMetrics(result); addNonHeapMetrics(result); @@ -133,7 +133,7 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { } private Metric newMemoryMetric(String name, long bytes) { - return new Metric(name, bytes / 1024); + return new Metric<>(name, bytes / 1024); } /** @@ -142,13 +142,13 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { */ protected void addThreadMetrics(Collection> result) { ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean(); - result.add(new Metric("threads.peak", - (long) threadMxBean.getPeakThreadCount())); - result.add(new Metric("threads.daemon", + result.add( + new Metric<>("threads.peak", (long) threadMxBean.getPeakThreadCount())); + result.add(new Metric<>("threads.daemon", (long) threadMxBean.getDaemonThreadCount())); - result.add(new Metric("threads.totalStarted", + result.add(new Metric<>("threads.totalStarted", threadMxBean.getTotalStartedThreadCount())); - result.add(new Metric("threads", (long) threadMxBean.getThreadCount())); + result.add(new Metric<>("threads", (long) threadMxBean.getThreadCount())); } /** @@ -157,11 +157,11 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { */ protected void addClassLoadingMetrics(Collection> result) { ClassLoadingMXBean classLoadingMxBean = ManagementFactory.getClassLoadingMXBean(); - result.add(new Metric("classes", - (long) classLoadingMxBean.getLoadedClassCount())); - result.add(new Metric("classes.loaded", + result.add( + new Metric<>("classes", (long) classLoadingMxBean.getLoadedClassCount())); + result.add(new Metric<>("classes.loaded", classLoadingMxBean.getTotalLoadedClassCount())); - result.add(new Metric("classes.unloaded", + result.add(new Metric<>("classes.unloaded", classLoadingMxBean.getUnloadedClassCount())); } @@ -174,9 +174,9 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { .getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMxBeans) { String name = beautifyGcName(garbageCollectorMXBean.getName()); - result.add(new Metric("gc." + name + ".count", + result.add(new Metric<>("gc." + name + ".count", garbageCollectorMXBean.getCollectionCount())); - result.add(new Metric("gc." + name + ".time", + result.add(new Metric<>("gc." + name + ".time", garbageCollectorMXBean.getCollectionTime())); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java index 69daf8bd4c..72b46e4ab1 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java @@ -58,8 +58,7 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa } private Manager getManager(EmbeddedWebApplicationContext applicationContext) { - EmbeddedWebServer embeddedWebServer = applicationContext - .getEmbeddedWebServer(); + EmbeddedWebServer embeddedWebServer = applicationContext.getEmbeddedWebServer(); if (embeddedWebServer instanceof TomcatEmbeddedServletContainer) { return getManager((TomcatEmbeddedServletContainer) embeddedWebServer); } @@ -77,7 +76,7 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa } private Collection> metrics(Manager manager) { - List> metrics = new ArrayList>(2); + List> metrics = new ArrayList<>(2); if (manager instanceof ManagerBase) { addMetric(metrics, "httpsessions.max", ((ManagerBase) manager).getMaxActiveSessions()); @@ -87,7 +86,7 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa } private void addMetric(List> metrics, String name, Integer value) { - metrics.add(new Metric(name, value)); + metrics.add(new Metric<>(name, value)); } @Override diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java index fc0551a019..07114618d7 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporter.java @@ -81,7 +81,7 @@ public class EndpointMBeanExporter extends MBeanExporter private final MetadataNamingStrategy defaultNamingStrategy = new MetadataNamingStrategy( this.attributeSource); - private final Set> registeredEndpoints = new HashSet>(); + private final Set> registeredEndpoints = new HashSet<>(); private volatile boolean autoStartup = true; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointHandlerMapping.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointHandlerMapping.java index f00922087c..916ccb2eb9 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointHandlerMapping.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointHandlerMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -91,7 +91,7 @@ public abstract class AbstractEndpointHandlerMapping */ public AbstractEndpointHandlerMapping(Collection endpoints, CorsConfiguration corsConfiguration) { - this.endpoints = new HashSet(endpoints); + this.endpoints = new HashSet<>(endpoints); postProcessEndpoints(this.endpoints); this.corsConfiguration = corsConfiguration; // By default the static resource handler mapping is LOWEST_PRECEDENCE - 1 @@ -166,7 +166,7 @@ public abstract class AbstractEndpointHandlerMapping if (defaultPatterns.isEmpty()) { return new String[] { patternPrefix, patternPrefix + ".json" }; } - List patterns = new ArrayList(defaultPatterns); + List patterns = new ArrayList<>(defaultPatterns); for (int i = 0; i < patterns.size(); i++) { patterns.set(i, patternPrefix + patterns.get(i)); } @@ -205,7 +205,7 @@ public abstract class AbstractEndpointHandlerMapping } private HandlerExecutionChain addSecurityInterceptor(HandlerExecutionChain chain) { - List interceptors = new ArrayList(); + List interceptors = new ArrayList<>(); if (chain.getInterceptors() != null) { interceptors.addAll(Arrays.asList(chain.getInterceptors())); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AuditEventsMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AuditEventsMvcEndpoint.java index a30b32990b..b8661cd13c 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AuditEventsMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AuditEventsMvcEndpoint.java @@ -56,7 +56,7 @@ public class AuditEventsMvcEndpoint extends AbstractNamedMvcEndpoint { if (!isEnabled()) { return DISABLED_RESPONSE; } - Map result = new LinkedHashMap(); + Map result = new LinkedHashMap<>(); result.put("events", this.auditEventRepository.find(principal, after, type)); return ResponseEntity.ok(result); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpoint.java index 62fbed2ec9..e3d2aa74c0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpoint.java @@ -156,7 +156,7 @@ public class HalBrowserMvcEndpoint extends HalJsonMvcEndpoint throws IOException { byte[] bytes = FileCopyUtils.copyToByteArray(resource.getInputStream()); String content = new String(bytes, DEFAULT_CHARSET); - List pathSegments = new ArrayList(ServletUriComponentsBuilder + List pathSegments = new ArrayList<>(ServletUriComponentsBuilder .fromRequest(request).build().getPathSegments()); pathSegments.remove(pathSegments.size() - 1); String initial = "/" diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java index 9ebaf80d24..fc86febd32 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java @@ -60,7 +60,7 @@ public class HealthMvcEndpoint extends AbstractEndpointMvcAdapter roles; - private Map statusMapping = new HashMap(); + private Map statusMapping = new HashMap<>(); private RelaxedPropertyResolver securityPropertyResolver; @@ -101,7 +101,7 @@ public class HealthMvcEndpoint extends AbstractEndpointMvcAdapter statusMapping) { Assert.notNull(statusMapping, "StatusMapping must not be null"); - this.statusMapping = new HashMap(statusMapping); + this.statusMapping = new HashMap<>(statusMapping); } /** @@ -145,7 +145,7 @@ public class HealthMvcEndpoint extends AbstractEndpointMvcAdapter(health, status); + return new ResponseEntity<>(health, status); } return health; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoint.java index 6f2df006f3..ab208ed009 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -38,7 +38,7 @@ public interface MvcEndpoint { /** * A {@link ResponseEntity} returned for disabled endpoints. */ - ResponseEntity> DISABLED_RESPONSE = new ResponseEntity>( + ResponseEntity> DISABLED_RESPONSE = new ResponseEntity<>( Collections.singletonMap("message", "This endpoint is disabled"), HttpStatus.NOT_FOUND); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java index 3780ca36bb..fe7d82dd0d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -42,7 +42,7 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean { private ApplicationContext applicationContext; - private final Set endpoints = new HashSet(); + private final Set endpoints = new HashSet<>(); private Set> customTypes; @@ -77,7 +77,7 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean { } private Set> findEndpointClasses(Collection existing) { - Set> types = new HashSet>(); + Set> types = new HashSet<>(); for (MvcEndpoint endpoint : existing) { Class type = endpoint.getEndpointType(); if (type != null) { @@ -99,7 +99,7 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean { */ @SuppressWarnings("unchecked") public Set getEndpoints(Class type) { - Set result = new HashSet(this.endpoints.size()); + Set result = new HashSet<>(this.endpoints.size()); for (MvcEndpoint candidate : this.endpoints) { if (type.isInstance(candidate)) { result.add((E) candidate); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java index ec8fcef7d7..d3ed23610c 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java @@ -46,7 +46,7 @@ abstract class NamePatternFilter { public Map getResults(String name) { if (!isRegex(name)) { Object value = getValue(this.source, name); - Map result = new HashMap(); + Map result = new HashMap<>(); result.put(name, value); return result; } @@ -89,7 +89,7 @@ abstract class NamePatternFilter { private final Pattern pattern; - private final Map results = new LinkedHashMap(); + private final Map results = new LinkedHashMap<>(); ResultCollectingNameCallback(Pattern pattern) { this.pattern = pattern; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java index 7799fe2666..8362f8f8dd 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java @@ -45,7 +45,7 @@ public class ShutdownMvcEndpoint extends EndpointMvcAdapter { @Override public Object invoke() { if (!getDelegate().isEnabled()) { - return new ResponseEntity>( + return new ResponseEntity<>( Collections.singletonMap("message", "This endpoint is disabled"), HttpStatus.NOT_FOUND); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java index dee7888c5e..17b434cbb3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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 @@ public abstract class AbstractHealthAggregator implements HealthAggregator { @Override public final Health aggregate(Map healths) { - List statusCandidates = new ArrayList(); + List statusCandidates = new ArrayList<>(); for (Map.Entry entry : healths.entrySet()) { statusCandidates.add(entry.getValue().getStatus()); } @@ -58,7 +58,7 @@ public abstract class AbstractHealthAggregator implements HealthAggregator { * @since 1.3.1 */ protected Map aggregateDetails(Map healths) { - return new LinkedHashMap(healths); + return new LinkedHashMap<>(healths); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java index fc51568a26..7018ad18cf 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -53,7 +53,7 @@ public class CompositeHealthIndicator implements HealthIndicator { Map indicators) { Assert.notNull(healthAggregator, "HealthAggregator must not be null"); Assert.notNull(indicators, "Indicators must not be null"); - this.indicators = new LinkedHashMap(indicators); + this.indicators = new LinkedHashMap<>(indicators); this.healthAggregator = healthAggregator; } @@ -63,7 +63,7 @@ public class CompositeHealthIndicator implements HealthIndicator { @Override public Health health() { - Map healths = new LinkedHashMap(); + Map healths = new LinkedHashMap<>(); for (Map.Entry entry : this.indicators.entrySet()) { healths.put(entry.getKey(), entry.getValue().health()); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorProperties.java index c84256396d..80933f5efa 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,7 +34,7 @@ public class ElasticsearchHealthIndicatorProperties { /** * Comma-separated index names. */ - private List indices = new ArrayList(); + private List indices = new ArrayList<>(); /** * Time, in milliseconds, to wait for a response from the cluster. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Health.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Health.java index 310e500134..2264e417e1 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Health.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Health.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -182,7 +182,7 @@ public final class Health { */ public Builder() { this.status = Status.UNKNOWN; - this.details = new LinkedHashMap(); + this.details = new LinkedHashMap<>(); } /** @@ -192,7 +192,7 @@ public final class Health { public Builder(Status status) { Assert.notNull(status, "Status must not be null"); this.status = status; - this.details = new LinkedHashMap(); + this.details = new LinkedHashMap<>(); } /** @@ -205,7 +205,7 @@ public final class Health { Assert.notNull(status, "Status must not be null"); Assert.notNull(details, "Details must not be null"); this.status = status; - this.details = new LinkedHashMap(details); + this.details = new LinkedHashMap<>(details); } /** diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java index ad2e7c8170..cb1b52ade3 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java @@ -69,7 +69,7 @@ public class OrderedHealthAggregator extends AbstractHealthAggregator { @Override protected Status aggregateStatus(List candidates) { // Only sort those status instances that we know about - List filteredCandidates = new ArrayList(); + List filteredCandidates = new ArrayList<>(); for (Status candidate : candidates) { if (this.statusOrder.contains(candidate.getCode())) { filteredCandidates.add(candidate); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/Info.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/Info.java index 41e5f84b18..a27c880e62 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/Info.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/Info.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -40,7 +40,7 @@ public final class Info { private final Map details; private Info(Builder builder) { - LinkedHashMap content = new LinkedHashMap(); + LinkedHashMap content = new LinkedHashMap<>(); content.putAll(builder.content); this.details = Collections.unmodifiableMap(content); } @@ -98,7 +98,7 @@ public final class Info { private final Map content; public Builder() { - this.content = new LinkedHashMap(); + this.content = new LinkedHashMap<>(); } /** diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/MapInfoContributor.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/MapInfoContributor.java index 79c16ed6df..758bf2afc6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/MapInfoContributor.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/MapInfoContributor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ public class MapInfoContributor implements InfoContributor { private final Map info; public MapInfoContributor(Map info) { - this.info = new LinkedHashMap(info); + this.info = new LinkedHashMap<>(info); } @Override diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java index 757e061586..19d61ac178 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/Metric.java @@ -91,7 +91,7 @@ public class Metric { * @return a new {@link Metric} instance */ public Metric increment(int amount) { - return new Metric(this.getName(), + return new Metric<>(this.getName(), Long.valueOf(this.getValue().longValue() + amount)); } @@ -102,7 +102,7 @@ public class Metric { * @return a new {@link Metric} instance */ public Metric set(S value) { - return new Metric(this.getName(), value); + return new Metric<>(this.getName(), value); } @Override diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReader.java index f39c9424f8..96a3ec3680 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -107,7 +107,7 @@ public class AggregateMetricReader implements MetricReader { @Override public long count() { - Set names = new HashSet(); + Set names = new HashSet<>(); for (Metric metric : this.source.findAll()) { String name = getSourceKey(metric.getName()); if (name != null) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferCounterService.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferCounterService.java index 9462a19f7e..0ffa20dc85 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferCounterService.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferCounterService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -28,7 +28,7 @@ import org.springframework.boot.actuate.metrics.CounterService; */ public class BufferCounterService implements CounterService { - private final ConcurrentHashMap names = new ConcurrentHashMap(); + private final ConcurrentHashMap names = new ConcurrentHashMap<>(); private final CounterBuffers buffers; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferGaugeService.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferGaugeService.java index 221f51fe6e..d928cbd31f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferGaugeService.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferGaugeService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -28,7 +28,7 @@ import org.springframework.boot.actuate.metrics.GaugeService; */ public class BufferGaugeService implements GaugeService { - private final ConcurrentHashMap names = new ConcurrentHashMap(); + private final ConcurrentHashMap names = new ConcurrentHashMap<>(); private final GaugeBuffers buffers; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReader.java index 041c41c285..5ea7b957b2 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/BufferMetricReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -72,7 +72,7 @@ public class BufferMetricReader implements MetricReader, PrefixMetricReader { } private Iterable> findAll(Predicate predicate) { - final List> metrics = new ArrayList>(); + final List> metrics = new ArrayList<>(); collectMetrics(this.gaugeBuffers, predicate, metrics); collectMetrics(this.counterBuffers, predicate, metrics); return metrics; @@ -92,7 +92,7 @@ public class BufferMetricReader implements MetricReader, PrefixMetricReader { } private Metric asMetric(final String name, Buffer buffer) { - return new Metric(name, buffer.getValue(), new Date(buffer.getTimestamp())); + return new Metric<>(name, buffer.getValue(), new Date(buffer.getTimestamp())); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/Buffers.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/Buffers.java index dd7f71cdda..29cacda935 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/Buffers.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/buffer/Buffers.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -31,7 +31,7 @@ import java.util.function.Predicate; */ abstract class Buffers> { - private final ConcurrentHashMap buffers = new ConcurrentHashMap(); + private final ConcurrentHashMap buffers = new ConcurrentHashMap<>(); public void forEach(final Predicate predicate, final BiConsumer consumer) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServices.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServices.java index 98a70ad8cc..2872a8324b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServices.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServices.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,9 +59,9 @@ public class DropwizardMetricServices implements CounterService, GaugeService { private final ReservoirFactory reservoirFactory; - private final ConcurrentMap gauges = new ConcurrentHashMap(); + private final ConcurrentMap gauges = new ConcurrentHashMap<>(); - private final ConcurrentHashMap names = new ConcurrentHashMap(); + private final ConcurrentHashMap names = new ConcurrentHashMap<>(); /** * Create a new {@link DropwizardMetricServices} instance. diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java index 31d41899cd..9a93e2b0f7 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/AbstractMetricExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,7 +105,7 @@ public abstract class AbstractMetricExporter implements Exporter, Closeable, Flu private void exportGroups() { for (String group : groups()) { - Collection> values = new ArrayList>(); + Collection> values = new ArrayList<>(); for (Metric metric : next(group)) { Date timestamp = metric.getTimestamp(); if (canExportTimestamp(timestamp)) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporter.java index 1d50eabca0..5eec2cdff5 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricCopyExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -63,7 +63,7 @@ public class MetricCopyExporter extends AbstractMetricExporter { private final CounterWriter counter; - private ConcurrentMap counts = new ConcurrentHashMap(); + private ConcurrentMap counts = new ConcurrentHashMap<>(); private String[] includes = new String[0]; @@ -145,7 +145,7 @@ public class MetricCopyExporter extends AbstractMetricExporter { else { this.counts.putIfAbsent(value.getName(), delta); } - return new Delta(value.getName(), delta, value.getTimestamp()); + return new Delta<>(value.getName(), delta, value.getTimestamp()); } @Override diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExportProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExportProperties.java index d7f991ea46..39222ea745 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExportProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExportProperties.java @@ -38,7 +38,7 @@ public class MetricExportProperties extends TriggerProperties { /** * Specific trigger properties per MetricWriter bean name. */ - private Map triggers = new LinkedHashMap(); + private Map triggers = new LinkedHashMap<>(); private Aggregate aggregate = new Aggregate(); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java index 2a558514c4..fb6d06e7d2 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -40,13 +40,13 @@ public class MetricExporters implements SchedulingConfigurer, Closeable { private MetricReader reader; - private Map writers = new HashMap(); + private Map writers = new HashMap<>(); private final MetricExportProperties properties; - private final Map exporters = new HashMap(); + private final Map exporters = new HashMap<>(); - private final Set closeables = new HashSet(); + private final Set closeables = new HashSet<>(); public MetricExporters(MetricExportProperties properties) { this.properties = properties; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java index 064714ebf1..90e8a9ebe7 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -41,9 +41,9 @@ public class PrefixMetricGroupExporter extends AbstractMetricExporter { private final PrefixMetricWriter writer; - private ConcurrentMap counts = new ConcurrentHashMap(); + private ConcurrentMap counts = new ConcurrentHashMap<>(); - private Set groups = new HashSet(); + private Set groups = new HashSet<>(); /** * Create a new exporter for metrics to a writer based on an empty prefix for the @@ -112,7 +112,7 @@ public class PrefixMetricGroupExporter extends AbstractMetricExporter { else { this.counts.putIfAbsent(value.getName(), delta); } - return new Delta(value.getName(), delta, value.getTimestamp()); + return new Delta<>(value.getName(), delta, value.getTimestamp()); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/RichGaugeExporter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/RichGaugeExporter.java index fa1d261722..f996bac0f1 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/RichGaugeExporter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/RichGaugeExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -71,7 +71,7 @@ public class RichGaugeExporter extends AbstractMetricExporter { @Override protected Iterable> next(String group) { RichGauge rich = this.reader.findOne(group); - Collection> metrics = new ArrayList>(); + Collection> metrics = new ArrayList<>(); metrics.add(new Metric(group + MIN, rich.getMin())); metrics.add(new Metric(group + MAX, rich.getMax())); metrics.add(new Metric(group + COUNT, rich.getCount())); @@ -83,7 +83,7 @@ public class RichGaugeExporter extends AbstractMetricExporter { @Override protected Iterable groups() { - Collection names = new HashSet(); + Collection names = new HashSet<>(); for (RichGauge rich : this.reader.findAll()) { names.add(rich.getName()); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReader.java index dab8e7a778..cb3bffb186 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/integration/SpringIntegrationMetricReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,16 +52,16 @@ public class SpringIntegrationMetricReader implements MetricReader { @Override public Iterable> findAll() { - List> result = new ArrayList>(); + List> result = new ArrayList<>(); String[] channelNames = this.configurer.getChannelNames(); String[] handlerNames = this.configurer.getHandlerNames(); String[] sourceNames = this.configurer.getSourceNames(); addChannelMetrics(result, channelNames); addHandlerMetrics(result, handlerNames); addSourceMetrics(result, sourceNames); - result.add(new Metric("integration.handlerCount", handlerNames.length)); - result.add(new Metric("integration.channelCount", channelNames.length)); - result.add(new Metric("integration.sourceCount", sourceNames.length)); + result.add(new Metric<>("integration.handlerCount", handlerNames.length)); + result.add(new Metric<>("integration.channelCount", channelNames.length)); + result.add(new Metric<>("integration.sourceCount", sourceNames.length)); return result; } @@ -75,10 +75,10 @@ public class SpringIntegrationMetricReader implements MetricReader { MessageChannelMetrics metrics) { String prefix = "integration.channel." + name; result.addAll(getStatistics(prefix + ".errorRate", metrics.getErrorRate())); - result.add(new Metric(prefix + ".sendCount", metrics.getSendCountLong())); + result.add(new Metric<>(prefix + ".sendCount", metrics.getSendCountLong())); result.addAll(getStatistics(prefix + ".sendRate", metrics.getSendRate())); if (metrics instanceof PollableChannelManagement) { - result.add(new Metric(prefix + ".receiveCount", + result.add(new Metric<>(prefix + ".receiveCount", ((PollableChannelManagement) metrics).getReceiveCountLong())); } } @@ -94,7 +94,7 @@ public class SpringIntegrationMetricReader implements MetricReader { String prefix = "integration.handler." + name; result.addAll(getStatistics(prefix + ".duration", metrics.getDuration())); long activeCount = metrics.getActiveCountLong(); - result.add(new Metric(prefix + ".activeCount", activeCount)); + result.add(new Metric<>(prefix + ".activeCount", activeCount)); } private void addSourceMetrics(List> result, String[] names) { @@ -106,17 +106,17 @@ public class SpringIntegrationMetricReader implements MetricReader { private void addSourceMetrics(List> result, String name, MessageSourceMetrics sourceMetrics) { String prefix = "integration.source." + name; - result.add(new Metric(prefix + ".messageCount", + result.add(new Metric<>(prefix + ".messageCount", sourceMetrics.getMessageCountLong())); } private Collection> getStatistics(String name, Statistics stats) { - List> metrics = new ArrayList>(); - metrics.add(new Metric(name + ".mean", stats.getMean())); - metrics.add(new Metric(name + ".max", stats.getMax())); - metrics.add(new Metric(name + ".min", stats.getMin())); - metrics.add(new Metric(name + ".stdev", stats.getStandardDeviation())); - metrics.add(new Metric(name + ".count", stats.getCountLong())); + List> metrics = new ArrayList<>(); + metrics.add(new Metric<>(name + ".mean", stats.getMean())); + metrics.add(new Metric<>(name + ".max", stats.getMax())); + metrics.add(new Metric<>(name + ".min", stats.getMin())); + metrics.add(new Metric<>(name + ".stdev", stats.getStandardDeviation())); + metrics.add(new Metric<>(name + ".count", stats.getCountLong())); return metrics; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jmx/DefaultMetricNamingStrategy.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jmx/DefaultMetricNamingStrategy.java index 7f454c9bf3..45ddd1e36d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jmx/DefaultMetricNamingStrategy.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jmx/DefaultMetricNamingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -44,7 +44,7 @@ public class DefaultMetricNamingStrategy implements ObjectNamingStrategy { throws MalformedObjectNameException { ObjectName objectName = this.namingStrategy.getObjectName(managedBean, beanKey); String domain = objectName.getDomain(); - Hashtable table = new Hashtable( + Hashtable table = new Hashtable<>( objectName.getKeyPropertyList()); String name = objectName.getKeyProperty("name"); if (name != null) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jmx/JmxMetricWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jmx/JmxMetricWriter.java index f72d79b0ec..9a0f271ea9 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jmx/JmxMetricWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jmx/JmxMetricWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ public class JmxMetricWriter implements MetricWriter { private static final Log logger = LogFactory.getLog(JmxMetricWriter.class); - private final ConcurrentMap values = new ConcurrentHashMap(); + private final ConcurrentMap values = new ConcurrentHashMap<>(); private final MBeanExporter exporter; @@ -72,7 +72,7 @@ public class JmxMetricWriter implements MetricWriter { @ManagedOperation public void increment(String name, long value) { - increment(new Delta(name, value)); + increment(new Delta<>(name, value)); } @Override @@ -83,7 +83,7 @@ public class JmxMetricWriter implements MetricWriter { @ManagedOperation public void set(String name, double value) { - set(new Metric(name, value)); + set(new Metric<>(name, value)); } @Override diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/DefaultOpenTsdbNamingStrategy.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/DefaultOpenTsdbNamingStrategy.java index 53aaaecd82..abdd76fc99 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/DefaultOpenTsdbNamingStrategy.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/DefaultOpenTsdbNamingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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,9 +52,9 @@ public class DefaultOpenTsdbNamingStrategy implements OpenTsdbNamingStrategy { * Tags to apply to every metric. Open TSDB requires at least one tag, so a "prefix" * tag is added for you by default. */ - private Map tags = new LinkedHashMap(); + private Map tags = new LinkedHashMap<>(); - private Map cache = new HashMap(); + private Map cache = new HashMap<>(); public DefaultOpenTsdbNamingStrategy() { this.tags.put(DOMAIN_KEY, "org.springframework.metrics"); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbGaugeWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbGaugeWriter.java index ffad29c0d0..576ffa20f5 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbGaugeWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbGaugeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -74,8 +74,7 @@ public class OpenTsdbGaugeWriter implements GaugeWriter { */ private MediaType mediaType = MediaType.APPLICATION_JSON; - private final List buffer = new ArrayList( - this.bufferSize); + private final List buffer = new ArrayList<>(this.bufferSize); private OpenTsdbNamingStrategy namingStrategy = new DefaultOpenTsdbNamingStrategy(); @@ -149,7 +148,7 @@ public class OpenTsdbGaugeWriter implements GaugeWriter { headers.setAccept(Arrays.asList(this.mediaType)); headers.setContentType(this.mediaType); ResponseEntity response = this.restTemplate.postForEntity(this.url, - new HttpEntity>(snapshot, headers), Map.class); + new HttpEntity<>(snapshot, headers), Map.class); if (!response.getStatusCode().is2xxSuccessful()) { logger.warn("Cannot write metrics (discarded " + snapshot.size() + " values): " + response.getBody()); @@ -161,7 +160,7 @@ public class OpenTsdbGaugeWriter implements GaugeWriter { if (this.buffer.isEmpty()) { return Collections.emptyList(); } - List snapshot = new ArrayList(this.buffer); + List snapshot = new ArrayList<>(this.buffer); this.buffer.clear(); return snapshot; } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbName.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbName.java index e949de4742..682f69912f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbName.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbName.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -29,7 +29,7 @@ public class OpenTsdbName { private String metric; - private Map tags = new LinkedHashMap(); + private Map tags = new LinkedHashMap<>(); protected OpenTsdbName() { } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/CompositeMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/CompositeMetricReader.java index a52a1ca191..1a8cb8fa4f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/CompositeMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/CompositeMetricReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -29,7 +29,7 @@ import org.springframework.boot.actuate.metrics.Metric; */ public class CompositeMetricReader implements MetricReader { - private final List readers = new ArrayList(); + private final List readers = new ArrayList<>(); public CompositeMetricReader(MetricReader... readers) { Collections.addAll(this.readers, readers); @@ -48,7 +48,7 @@ public class CompositeMetricReader implements MetricReader { @Override public Iterable> findAll() { - List> values = new ArrayList>((int) count()); + List> values = new ArrayList<>((int) count()); for (MetricReader delegate : this.readers) { Iterable> all = delegate.findAll(); for (Metric value : all) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java index 5d1de4b18d..ae7f04d151 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReader.java @@ -57,13 +57,13 @@ public class MetricRegistryMetricReader implements MetricReader, MetricRegistryL private static final Log logger = LogFactory.getLog(MetricRegistryMetricReader.class); - private static final Map, Set> numberKeys = new ConcurrentHashMap, Set>(); + private static final Map, Set> numberKeys = new ConcurrentHashMap<>(); private final Object monitor = new Object(); - private final Map names = new ConcurrentHashMap(); + private final Map names = new ConcurrentHashMap<>(); - private final MultiValueMap reverse = new LinkedMultiValueMap(); + private final MultiValueMap reverse = new LinkedMultiValueMap<>(); private final MetricRegistry registry; @@ -89,7 +89,7 @@ public class MetricRegistryMetricReader implements MetricReader, MetricRegistryL if (metric instanceof Gauge) { Object value = ((Gauge) metric).getValue(); if (value instanceof Number) { - return new Metric(metricName, (Number) value); + return new Metric<>(metricName, (Number) value); } if (logger.isDebugEnabled()) { logger.debug("Ignoring gauge '" + name + "' (" + metric @@ -105,10 +105,10 @@ public class MetricRegistryMetricReader implements MetricReader, MetricRegistryL value = TimeUnit.MILLISECONDS.convert(value.longValue(), TimeUnit.NANOSECONDS); } - return new Metric(metricName, value); + return new Metric<>(metricName, value); } } - return new Metric(metricName, getMetric(metric, metricName)); + return new Metric<>(metricName, getMetric(metric, metricName)); } @Override @@ -116,7 +116,7 @@ public class MetricRegistryMetricReader implements MetricReader, MetricRegistryL return new Iterable>() { @Override public Iterator> iterator() { - Set> metrics = new HashSet>(); + Set> metrics = new HashSet<>(); for (String name : MetricRegistryMetricReader.this.names.keySet()) { Metric metric = findOne(name); if (metric != null) { @@ -236,7 +236,7 @@ public class MetricRegistryMetricReader implements MetricReader, MetricRegistryL private static Set getNumberKeys(Object metric) { Set result = numberKeys.get(metric.getClass()); if (result == null) { - result = new HashSet(); + result = new HashSet<>(); } if (result.isEmpty()) { for (PropertyDescriptor descriptor : BeanUtils diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java index 95f454daa8..d4e8d66a33 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 org.springframework.boot.actuate.metrics.writer.Delta; */ public class InMemoryMetricRepository implements MetricRepository { - private final SimpleInMemoryRepository> metrics = new SimpleInMemoryRepository>(); + private final SimpleInMemoryRepository> metrics = new SimpleInMemoryRepository<>(); public void setValues(ConcurrentNavigableMap> values) { this.metrics.setValues(values); @@ -48,10 +48,10 @@ public class InMemoryMetricRepository implements MetricRepository { @Override public Metric modify(Metric current) { if (current != null) { - return new Metric(metricName, - current.increment(amount).getValue(), timestamp); + return new Metric<>(metricName, current.increment(amount).getValue(), + timestamp); } - return new Metric(metricName, (long) amount, timestamp); + return new Metric<>(metricName, (long) amount, timestamp); } }); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMultiMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMultiMetricRepository.java index 73a048d59f..ed82b152d5 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMultiMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/InMemoryMultiMetricRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -35,7 +35,7 @@ public class InMemoryMultiMetricRepository implements MultiMetricRepository { private final InMemoryMetricRepository repository; - private final Collection groups = new HashSet(); + private final Collection groups = new HashSet<>(); /** * Create a new {@link InMemoryMetricRepository} backed by a new diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java index 10648dd665..be77aec59a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -124,7 +124,7 @@ public class RedisMetricRepository implements MetricRepository { Set keys = this.zSetOperations.range(0, -1); Iterator keysIt = keys.iterator(); - List> result = new ArrayList>(keys.size()); + List> result = new ArrayList<>(keys.size()); List values = this.redisOperations.opsForValue().multiGet(keys); for (String v : values) { String key = keysIt.next(); @@ -149,7 +149,7 @@ public class RedisMetricRepository implements MetricRepository { trackMembership(key); double value = this.zSetOperations.incrementScore(key, delta.getValue().doubleValue()); - String raw = serialize(new Metric(name, value, delta.getTimestamp())); + String raw = serialize(new Metric<>(name, value, delta.getTimestamp())); this.redisOperations.opsForValue().set(key, raw); } @@ -176,7 +176,7 @@ public class RedisMetricRepository implements MetricRepository { return null; } Date timestamp = new Date(Long.valueOf(v)); - return new Metric(nameFor(redisKey), value, timestamp); + return new Metric<>(nameFor(redisKey), value, timestamp); } private String serialize(Metric entity) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java index c12e5ca042..aeeadee271 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -76,7 +76,7 @@ public class RedisMultiMetricRepository implements MultiMetricRepository { Set keys = zSetOperations.range(0, -1); Iterator keysIt = keys.iterator(); - List> result = new ArrayList>(keys.size()); + List> result = new ArrayList<>(keys.size()); List values = this.redisOperations.opsForValue().multiGet(keys); for (String v : values) { String key = keysIt.next(); @@ -109,14 +109,14 @@ public class RedisMultiMetricRepository implements MultiMetricRepository { String key = keyFor(delta.getName()); double value = zSetOperations.incrementScore(key, delta.getValue().doubleValue()); String raw = serialize( - new Metric(delta.getName(), value, delta.getTimestamp())); + new Metric<>(delta.getName(), value, delta.getTimestamp())); this.redisOperations.opsForValue().set(key, raw); } @Override public Iterable groups() { Set range = this.zSetOperations.range(0, -1); - Collection result = new ArrayList(); + Collection result = new ArrayList<>(); for (String key : range) { result.add(key.substring(this.prefix.length())); } @@ -145,7 +145,7 @@ public class RedisMultiMetricRepository implements MultiMetricRepository { private Metric deserialize(String group, String redisKey, String v, Double value) { Date timestamp = new Date(Long.valueOf(v)); - return new Metric(nameFor(redisKey), value, timestamp); + return new Metric<>(nameFor(redisKey), value, timestamp); } private String serialize(Metric entity) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisUtils.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisUtils.java index 67694b2c2d..44ddfe5518 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisUtils.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/redis/RedisUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -35,9 +35,9 @@ final class RedisUtils { static RedisTemplate createRedisTemplate( RedisConnectionFactory connectionFactory, Class valueClass) { - RedisTemplate redisTemplate = new RedisTemplate(); + RedisTemplate redisTemplate = new RedisTemplate<>(); redisTemplate.setKeySerializer(new StringRedisSerializer()); - redisTemplate.setValueSerializer(new GenericToStringSerializer(valueClass)); + redisTemplate.setValueSerializer(new GenericToStringSerializer<>(valueClass)); // avoids proxy redisTemplate.setExposeConnection(true); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepository.java index 34ca47fc42..b1aff342a5 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepository.java @@ -33,7 +33,7 @@ import org.springframework.boot.actuate.metrics.writer.MetricWriter; */ public class InMemoryRichGaugeRepository implements RichGaugeRepository { - private final SimpleInMemoryRepository repository = new SimpleInMemoryRepository(); + private final SimpleInMemoryRepository repository = new SimpleInMemoryRepository<>(); @Override public void increment(final Delta delta) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReader.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReader.java index d42fd7c80e..66abf8b96e 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReader.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReader.java @@ -73,7 +73,7 @@ public class MultiMetricRichGaugeReader implements RichGaugeReader { @Override public Iterable findAll() { - List result = new ArrayList(); + List result = new ArrayList<>(); for (String name : this.repository.groups()) { result.add(findOne(name)); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java index c6a43002f8..69f536111d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java @@ -32,9 +32,9 @@ import java.util.concurrent.ConcurrentSkipListMap; */ public class SimpleInMemoryRepository { - private ConcurrentNavigableMap values = new ConcurrentSkipListMap(); + private ConcurrentNavigableMap values = new ConcurrentSkipListMap<>(); - private final ConcurrentMap locks = new ConcurrentHashMap(); + private final ConcurrentMap locks = new ConcurrentHashMap<>(); public T update(String name, Callback callback) { Object lock = getLock(name); @@ -75,7 +75,7 @@ public class SimpleInMemoryRepository { } public Iterable findAll() { - return new ArrayList(this.values.values()); + return new ArrayList<>(this.values.values()); } public Iterable findAllWithPrefix(String prefix) { @@ -85,7 +85,7 @@ public class SimpleInMemoryRepository { if (!prefix.endsWith(".")) { prefix = prefix + "."; } - return new ArrayList( + return new ArrayList<>( this.values.subMap(prefix, false, prefix + "~", true).values()); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CompositeMetricWriter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CompositeMetricWriter.java index bb35e5a90e..18ef8f6ad9 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CompositeMetricWriter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/CompositeMetricWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -31,7 +31,7 @@ import org.springframework.boot.actuate.metrics.Metric; */ public class CompositeMetricWriter implements MetricWriter, Iterable { - private final List writers = new ArrayList(); + private final List writers = new ArrayList<>(); public CompositeMetricWriter(MetricWriter... writers) { Collections.addAll(this.writers, writers); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterService.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterService.java index 20b8183fac..2151705f76 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterService.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultCounterService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -29,7 +29,7 @@ public class DefaultCounterService implements CounterService { private final MetricWriter writer; - private final ConcurrentHashMap names = new ConcurrentHashMap(); + private final ConcurrentHashMap names = new ConcurrentHashMap<>(); /** * Create a {@link DefaultCounterService} instance. @@ -41,12 +41,12 @@ public class DefaultCounterService implements CounterService { @Override public void increment(String metricName) { - this.writer.increment(new Delta(wrap(metricName), 1L)); + this.writer.increment(new Delta<>(wrap(metricName), 1L)); } @Override public void decrement(String metricName) { - this.writer.increment(new Delta(wrap(metricName), -1L)); + this.writer.increment(new Delta<>(wrap(metricName), -1L)); } @Override diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeService.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeService.java index dd90e6f422..daecc2b97b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeService.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/DefaultGaugeService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ public class DefaultGaugeService implements GaugeService { private final MetricWriter writer; - private final ConcurrentHashMap names = new ConcurrentHashMap(); + private final ConcurrentHashMap names = new ConcurrentHashMap<>(); /** * Create a {@link DefaultGaugeService} instance. @@ -42,7 +42,7 @@ public class DefaultGaugeService implements GaugeService { @Override public void submit(String metricName, double value) { - this.writer.set(new Metric(wrap(metricName), value)); + this.writer.set(new Metric<>(wrap(metricName), value)); } private String wrap(String metricName) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthenticationAuditListener.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthenticationAuditListener.java index a4660cbc8d..328ef92416 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthenticationAuditListener.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthenticationAuditListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -74,7 +74,7 @@ public class AuthenticationAuditListener extends AbstractAuthenticationAuditList } private void onAuthenticationFailureEvent(AbstractAuthenticationFailureEvent event) { - Map data = new HashMap(); + Map data = new HashMap<>(); data.put("type", event.getException().getClass().getName()); data.put("message", event.getException().getMessage()); if (event.getAuthentication().getDetails() != null) { @@ -85,7 +85,7 @@ public class AuthenticationAuditListener extends AbstractAuthenticationAuditList } private void onAuthenticationSuccessEvent(AuthenticationSuccessEvent event) { - Map data = new HashMap(); + Map data = new HashMap<>(); if (event.getAuthentication().getDetails() != null) { data.put("details", event.getAuthentication().getDetails()); } @@ -99,7 +99,7 @@ public class AuthenticationAuditListener extends AbstractAuthenticationAuditList AbstractAuthenticationEvent input) { if (listener != null) { AuthenticationSwitchUserEvent event = (AuthenticationSwitchUserEvent) input; - Map data = new HashMap(); + Map data = new HashMap<>(); if (event.getAuthentication().getDetails() != null) { data.put("details", event.getAuthentication().getDetails()); } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java index 324f703eb4..44202adad0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/AuthorizationAuditListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ public class AuthorizationAuditListener extends AbstractAuthorizationAuditListen private void onAuthenticationCredentialsNotFoundEvent( AuthenticationCredentialsNotFoundEvent event) { - Map data = new HashMap(); + Map data = new HashMap<>(); data.put("type", event.getCredentialsNotFoundException().getClass().getName()); data.put("message", event.getCredentialsNotFoundException().getMessage()); publish(new AuditEvent("", @@ -58,7 +58,7 @@ public class AuthorizationAuditListener extends AbstractAuthorizationAuditListen } private void onAuthorizationFailureEvent(AuthorizationFailureEvent event) { - Map data = new HashMap(); + Map data = new HashMap<>(); data.put("type", event.getAccessDeniedException().getClass().getName()); data.put("message", event.getAccessDeniedException().getMessage()); if (event.getAuthentication().getDetails() != null) { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/InMemoryTraceRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/InMemoryTraceRepository.java index 86a73d9d5b..1d585ef9bb 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/InMemoryTraceRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/InMemoryTraceRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -35,7 +35,7 @@ public class InMemoryTraceRepository implements TraceRepository { private boolean reverse = true; - private final List traces = new LinkedList(); + private final List traces = new LinkedList<>(); /** * Flag to say that the repository lists traces in reverse order. @@ -60,7 +60,7 @@ public class InMemoryTraceRepository implements TraceRepository { @Override public List findAll() { synchronized (this.traces) { - return Collections.unmodifiableList(new ArrayList(this.traces)); + return Collections.unmodifiableList(new ArrayList<>(this.traces)); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/TraceProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/TraceProperties.java index 9129372700..a5c53091e1 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/TraceProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/TraceProperties.java @@ -38,7 +38,7 @@ public class TraceProperties { private static final Set DEFAULT_INCLUDES; static { - Set defaultIncludes = new LinkedHashSet(); + Set defaultIncludes = new LinkedHashSet<>(); defaultIncludes.add(Include.REQUEST_HEADERS); defaultIncludes.add(Include.RESPONSE_HEADERS); defaultIncludes.add(Include.COOKIES); @@ -50,7 +50,7 @@ public class TraceProperties { * Items to be included in the trace. Defaults to request/response headers (including * cookies) and errors. */ - private Set include = new HashSet(DEFAULT_INCLUDES); + private Set include = new HashSet<>(DEFAULT_INCLUDES); public Set getInclude() { return this.include; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java index 853135680e..ba822b3349 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java @@ -120,8 +120,8 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order Throwable exception = (Throwable) request .getAttribute("javax.servlet.error.exception"); Principal userPrincipal = request.getUserPrincipal(); - Map trace = new LinkedHashMap(); - Map headers = new LinkedHashMap(); + Map trace = new LinkedHashMap<>(); + Map headers = new LinkedHashMap<>(); trace.put("method", request.getMethod()); trace.put("path", request.getRequestURI()); trace.put("headers", headers); @@ -152,7 +152,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order } private Map getRequestHeaders(HttpServletRequest request) { - Map headers = new LinkedHashMap(); + Map headers = new LinkedHashMap<>(); Set excludedHeaders = getExcludeHeaders(); Enumeration names = request.getHeaderNames(); while (names.hasMoreElements()) { @@ -166,7 +166,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order } private Set getExcludeHeaders() { - Set excludedHeaders = new HashSet(); + Set excludedHeaders = new HashSet<>(); if (!isIncluded(Include.COOKIES)) { excludedHeaders.add("cookie"); } @@ -204,7 +204,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order } private Map getResponseHeaders(HttpServletResponse response) { - Map headers = new LinkedHashMap(); + Map headers = new LinkedHashMap<>(); for (String header : response.getHeaderNames()) { String value = response.getHeader(header); headers.put(header, value); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java index a4aa8d298f..f9ed23c02b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -102,7 +102,7 @@ public class InMemoryAuditEventRepositoryTests { Calendar calendar = Calendar.getInstance(); calendar.set(2000, 1, 1, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); - Map data = new HashMap(); + Map data = new HashMap<>(); InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository(); repository.add(new AuditEvent(calendar.getTime(), "dave", "a", data)); calendar.add(Calendar.DAY_OF_YEAR, 1); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CacheStatisticsAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CacheStatisticsAutoConfigurationTests.java index eb4e1f4ed2..287ed24f16 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CacheStatisticsAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CacheStatisticsAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -217,7 +217,7 @@ public class CacheStatisticsAutoConfigurationTests { javax.cache.CacheManager cacheManager = Caching .getCachingProvider(HazelcastCachingProvider.class.getName()) .getCacheManager(); - MutableConfiguration config = new MutableConfiguration(); + MutableConfiguration config = new MutableConfiguration<>(); config.setStatisticsEnabled(true); cacheManager.createCache("books", config); cacheManager.createCache("speakers", config); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java index 1010d900fd..0c2b398feb 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -278,7 +278,7 @@ public class EndpointAutoConfigurationTests { return new PublicMetrics() { @Override public Collection> metrics() { - Metric metric = new Metric("foo", 1); + Metric metric = new Metric<>("foo", 1); return Collections.>singleton(metric); } }; @@ -310,7 +310,7 @@ public class EndpointAutoConfigurationTests { private static class GitFullInfoContributor implements InfoContributor { - private Map content = new LinkedHashMap(); + private Map content = new LinkedHashMap<>(); GitFullInfoContributor(Resource location) throws BindException, IOException { if (location.exists()) { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java index dddff4bcca..f05a0b03fb 100755 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java @@ -117,7 +117,7 @@ public class EndpointWebMvcAutoConfigurationTests { private final AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext(); - private static ThreadLocal ports = new ThreadLocal(); + private static ThreadLocal ports = new ThreadLocal<>(); @Before public void setUp() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesNoSecurityTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesNoSecurityTests.java index 166071a619..d45e1af59e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesNoSecurityTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesNoSecurityTests.java @@ -66,5 +66,4 @@ public class ManagementServerPropertiesNoSecurityTests { } - } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java index 9d416b5e21..77ab9fd0e9 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java @@ -116,8 +116,7 @@ public class ManagementWebSecurityAutoConfigurationTests { this.context.register(WebConfiguration.class); this.context.refresh(); UserDetails user = getUser(); - ArrayList authorities = new ArrayList( - user.getAuthorities()); + ArrayList authorities = new ArrayList<>(user.getAuthorities()); assertThat(authorities).containsAll(AuthorityUtils .commaSeparatedStringToAuthorityList("ROLE_USER,ROLE_ACTUATOR")); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java index 3065435d3d..152de6052b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java @@ -505,14 +505,14 @@ public class MetricFilterAutoConfigurationTests { @RequestMapping("create") public DeferredResult> create() { - final DeferredResult> result = new DeferredResult>(); + final DeferredResult> result = new DeferredResult<>(); new Thread(new Runnable() { @Override public void run() { try { MetricFilterTestController.this.latch.await(); result.setResult( - new ResponseEntity("Done", HttpStatus.CREATED)); + new ResponseEntity<>("Done", HttpStatus.CREATED)); } catch (InterruptedException ex) { } @@ -523,7 +523,7 @@ public class MetricFilterAutoConfigurationTests { @RequestMapping("createFailure") public DeferredResult> createFailure() { - final DeferredResult> result = new DeferredResult>(); + final DeferredResult> result = new DeferredResult<>(); new Thread(new Runnable() { @Override public void run() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java index 1b477f11ed..0835033e2b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java @@ -142,9 +142,8 @@ public class MvcEndpointPathConfigurationTests { @Configuration @ImportAutoConfiguration({ EndpointAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - AuditAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class, - JolokiaAutoConfiguration.class }) + HttpMessageConvertersAutoConfiguration.class, AuditAutoConfiguration.class, + EndpointWebMvcAutoConfiguration.class, JolokiaAutoConfiguration.class }) protected static class TestConfiguration { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java index 27c2f4dd14..ef8664a277 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -110,12 +110,12 @@ public class PublicMetricsAutoConfigurationTests { Collection> metrics = publicMetrics.metrics(); assertThat(metrics).isNotNull(); assertThat(6).isEqualTo(metrics.size()); - assertHasMetric(metrics, new Metric("bar.val", 3.7d)); - assertHasMetric(metrics, new Metric("bar.avg", 3.7d)); - assertHasMetric(metrics, new Metric("bar.min", 3.7d)); - assertHasMetric(metrics, new Metric("bar.max", 3.7d)); - assertHasMetric(metrics, new Metric("bar.alpha", -1.d)); - assertHasMetric(metrics, new Metric("bar.count", 1L)); + assertHasMetric(metrics, new Metric<>("bar.val", 3.7d)); + assertHasMetric(metrics, new Metric<>("bar.avg", 3.7d)); + assertHasMetric(metrics, new Metric<>("bar.min", 3.7d)); + assertHasMetric(metrics, new Metric<>("bar.max", 3.7d)); + assertHasMetric(metrics, new Metric<>("bar.alpha", -1.d)); + assertHasMetric(metrics, new Metric<>("bar.count", 1L)); context.close(); } @@ -227,7 +227,7 @@ public class PublicMetricsAutoConfigurationTests { } private void assertMetrics(Collection> metrics, String... keys) { - Map content = new HashMap(); + Map content = new HashMap<>(); for (Metric metric : metrics) { content.put(metric.getName(), metric.getValue()); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpointTests.java index ab105964bd..0d7b49255e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -44,7 +44,7 @@ public class CloudFoundryDiscoveryMvcEndpointTests { @Before public void setup() { NamedMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("a")); - this.endpoints = new LinkedHashSet(); + this.endpoints = new LinkedHashSet<>(); this.endpoints.add(endpoint); this.endpoint = new CloudFoundryDiscoveryMvcEndpoint(this.endpoints); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/SkipSslVerificationHttpRequestFactoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/SkipSslVerificationHttpRequestFactoryTests.java index ba538010d5..c46be09569 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/SkipSslVerificationHttpRequestFactoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/SkipSslVerificationHttpRequestFactoryTests.java @@ -67,8 +67,7 @@ public class SkipSslVerificationHttpRequestFactoryTests { 0); factory.setSsl(getSsl("password", "classpath:test.jks")); EmbeddedWebServer container = factory.getEmbeddedServletContainer( - new ServletRegistrationBean(new ExampleServlet(), - "/hello")); + new ServletRegistrationBean<>(new ExampleServlet(), "/hello")); container.start(); return "https://localhost:" + container.getPort() + "/hello"; } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java index 73e0e76ee8..4e33792526 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -110,7 +110,7 @@ public abstract class AbstractEndpointTests> { @Test public void isSensitiveOverrideWithGlobal() throws Exception { this.context = new AnnotationConfigApplicationContext(); - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("endpoint.sensitive", this.sensitive); properties.put(this.property + ".sensitive", String.valueOf(!this.sensitive)); PropertySource propertySource = new MapPropertySource("test", properties); @@ -163,7 +163,7 @@ public abstract class AbstractEndpointTests> { @Test public void isOptIn() throws Exception { this.context = new AnnotationConfigApplicationContext(); - Map source = new HashMap(); + Map source = new HashMap<>(); source.put("endpoints.enabled", false); source.put(this.property + ".enabled", true); PropertySource propertySource = new MapPropertySource("test", source); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java index a866e79fa6..3c124362a4 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java @@ -266,13 +266,13 @@ public class ConfigurationPropertiesReportEndpointTests private Boolean mixedBoolean = true; - private Map secrets = new HashMap(); + private Map secrets = new HashMap<>(); private Hidden hidden = new Hidden(); - private List listItems = new ArrayList(); + private List listItems = new ArrayList<>(); - private List> listOfListItems = new ArrayList>(); + private List> listOfListItems = new ArrayList<>(); public TestProperties() { this.secrets.put("mine", "myPrivateThing"); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricReaderPublicMetricsTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricReaderPublicMetricsTests.java index 87e7ff673e..1f6652811c 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricReaderPublicMetricsTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricReaderPublicMetricsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -37,7 +37,7 @@ public class MetricReaderPublicMetricsTests { @Test public void exposesMetrics() { - List> metrics = new ArrayList>(); + List> metrics = new ArrayList<>(); metrics.add(mock(Metric.class)); metrics.add(mock(Metric.class)); MetricReader reader = mock(MetricReader.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java index 38819cd6ae..200d8a3d63 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/MetricsEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -42,11 +42,11 @@ import static org.assertj.core.api.Assertions.assertThat; */ public class MetricsEndpointTests extends AbstractEndpointTests { - private Metric metric1 = new Metric("a", 1); + private Metric metric1 = new Metric<>("a", 1); - private Metric metric2 = new Metric("b", 2); + private Metric metric2 = new Metric<>("b", 2); - private Metric metric3 = new Metric("c", 3); + private Metric metric3 = new Metric<>("c", 3); public MetricsEndpointTests() { super(Config.class, MetricsEndpoint.class, "metrics", true, "endpoints.metrics"); @@ -59,7 +59,7 @@ public class MetricsEndpointTests extends AbstractEndpointTests @Test public void ordered() { - List publicMetrics = new ArrayList(); + List publicMetrics = new ArrayList<>(); publicMetrics .add(new TestPublicMetrics(2, this.metric2, this.metric2, this.metric3)); publicMetrics.add(new TestPublicMetrics(1, this.metric1)); @@ -100,7 +100,7 @@ public class MetricsEndpointTests extends AbstractEndpointTests @Bean public MetricsEndpoint endpoint() { - final Metric metric = new Metric("a", 0.5f); + final Metric metric = new Metric<>("a", 0.5f); PublicMetrics metrics = new PublicMetrics() { @Override public Collection> metrics() { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetricsTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetricsTests.java index 710d5fcb64..356b5d7334 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetricsTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/RichGaugeReaderPublicMetricsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -38,13 +38,13 @@ public class RichGaugeReaderPublicMetricsTests { public void testMetrics() throws Exception { InMemoryRichGaugeRepository repository = new InMemoryRichGaugeRepository(); - repository.set(new Metric("a", 0.d, new Date())); - repository.set(new Metric("a", 0.5d, new Date())); + repository.set(new Metric<>("a", 0.d, new Date())); + repository.set(new Metric<>("a", 0.5d, new Date())); RichGaugeReaderPublicMetrics metrics = new RichGaugeReaderPublicMetrics( repository); - Map> results = new HashMap>(); + Map> results = new HashMap<>(); for (Metric metric : metrics.metrics()) { results.put(metric.getName(), metric); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java index 92b7579bef..085cb1c43b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -35,7 +35,7 @@ public class SystemPublicMetricsTests { @Test public void testSystemMetrics() throws Exception { SystemPublicMetrics publicMetrics = new SystemPublicMetrics(); - Map> results = new HashMap>(); + Map> results = new HashMap<>(); for (Metric metric : publicMetrics.metrics()) { results.put(metric.getName(), metric); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporterTests.java index 09ecc318bd..e52666df67 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/EndpointMBeanExporterTests.java @@ -155,7 +155,7 @@ public class EndpointMBeanExporterTests { @Test public void testRegistrationWithDifferentDomainAndIdentity() throws Exception { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("domain", "test-domain"); properties.put("ensureUniqueRuntimeObjectNames", true); this.context = new GenericApplicationContext(); @@ -174,7 +174,7 @@ public class EndpointMBeanExporterTests { @Test public void testRegistrationWithDifferentDomainAndIdentityAndStaticNames() throws Exception { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("domain", "test-domain"); properties.put("ensureUniqueRuntimeObjectNames", true); Properties staticNames = new Properties(); @@ -342,7 +342,7 @@ public class EndpointMBeanExporterTests { @Override public Map invoke() { - Map result = new LinkedHashMap(); + Map result = new LinkedHashMap<>(); result.put("date", new Date()); return result; } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointHandlerMappingTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointHandlerMappingTests.java index 768ad901ad..a34aa19268 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointHandlerMappingTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointHandlerMappingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -44,7 +44,7 @@ public abstract class AbstractEndpointHandlerMappingTests { public void securityInterceptorShouldBePresentForNonCorsRequest() throws Exception { HandlerInterceptor securityInterceptor = mock(HandlerInterceptor.class); TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("a")); - AbstractEndpointHandlerMapping mapping = new TestEndpointHandlerMapping( + AbstractEndpointHandlerMapping mapping = new TestEndpointHandlerMapping<>( Collections.singletonList(endpoint)); mapping.setApplicationContext(this.context); mapping.setSecurityInterceptor(securityInterceptor); @@ -56,7 +56,7 @@ public abstract class AbstractEndpointHandlerMappingTests { @Test public void securityInterceptorIfNullShouldNotBeAdded() throws Exception { TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("a")); - AbstractEndpointHandlerMapping mapping = new TestEndpointHandlerMapping( + AbstractEndpointHandlerMapping mapping = new TestEndpointHandlerMapping<>( Collections.singletonList(endpoint)); mapping.setApplicationContext(this.context); mapping.afterPropertiesSet(); @@ -68,7 +68,7 @@ public abstract class AbstractEndpointHandlerMappingTests { throws Exception { HandlerInterceptor securityInterceptor = mock(HandlerInterceptor.class); TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("a")); - AbstractEndpointHandlerMapping mapping = new TestEndpointHandlerMapping( + AbstractEndpointHandlerMapping mapping = new TestEndpointHandlerMapping<>( Collections.singletonList(endpoint)); mapping.setApplicationContext(this.context); mapping.setSecurityInterceptor(securityInterceptor); @@ -84,7 +84,7 @@ public abstract class AbstractEndpointHandlerMappingTests { public void pathNotMappedWhenGetPathReturnsNull() throws Exception { TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("a")); TestActionEndpoint other = new TestActionEndpoint(new TestEndpoint("b")); - AbstractEndpointHandlerMapping mapping = new TestEndpointHandlerMapping( + AbstractEndpointHandlerMapping mapping = new TestEndpointHandlerMapping<>( Arrays.asList(endpoint, other)); mapping.setApplicationContext(this.context); mapping.afterPropertiesSet(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java index 3d90689c91..62af6e7854 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java @@ -128,7 +128,7 @@ public class EnvironmentMvcEndpointTests { @Test public void regex() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("food", null); ((ConfigurableEnvironment) this.context.getEnvironment()).getPropertySources() .addFirst(new MapPropertySource("null-value", map)); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java index 4781db490c..96003d610a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointVanillaIntegrationTests.java @@ -119,8 +119,8 @@ public class HalBrowserMvcEndpointVanillaIntegrationTests { @Test public void endpointsEachHaveSelf() throws Exception { - Set collections = new HashSet(Arrays.asList("/trace", "/beans", - "/dump", "/heapdump", "/loggers", "/auditevents")); + Set collections = new HashSet<>(Arrays.asList("/trace", "/beans", "/dump", + "/heapdump", "/loggers", "/auditevents")); for (MvcEndpoint endpoint : this.mvcEndpoints.getEndpoints()) { String path = endpoint.getPath(); if (collections.contains(path)) { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java index 961984fe88..10f09d31f2 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/InfoMvcEndpointTests.java @@ -114,7 +114,7 @@ public class InfoMvcEndpointTests { @Override public void contribute(Info.Builder builder) { - Map content = new LinkedHashMap(); + Map content = new LinkedHashMap<>(); content.put("key11", "value11"); content.put("key12", "value12"); builder.withDetail("beanName1", content); @@ -127,7 +127,7 @@ public class InfoMvcEndpointTests { return new InfoContributor() { @Override public void contribute(Info.Builder builder) { - Map content = new LinkedHashMap(); + Map content = new LinkedHashMap<>(); content.put("key21", "value21"); content.put("key22", "value22"); builder.withDetail("beanName2", content); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpointTests.java index 1ee0d601c3..91fa46bef8 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpointTests.java @@ -174,12 +174,12 @@ public class MetricsMvcEndpointTests { @Override public Collection> metrics() { - ArrayList> metrics = new ArrayList>(); - metrics.add(new Metric("foo", 1)); - metrics.add(new Metric("group1.a", 1)); - metrics.add(new Metric("group1.b", 1)); - metrics.add(new Metric("group2.a", 1)); - metrics.add(new Metric("group2_a", 1)); + ArrayList> metrics = new ArrayList<>(); + metrics.add(new Metric<>("foo", 1)); + metrics.add(new Metric<>("group1.a", 1)); + metrics.add(new Metric<>("group1.b", 1)); + metrics.add(new Metric<>("group2.a", 1)); + metrics.add(new Metric<>("group2_a", 1)); metrics.add(new Metric("baz", null)); return Collections.unmodifiableList(metrics); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java index 4bf86ff013..1652553209 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -63,7 +63,7 @@ public class CompositeHealthIndicatorTests { @Test public void createWithIndicators() throws Exception { - Map indicators = new HashMap(); + Map indicators = new HashMap<>(); indicators.put("one", this.one); indicators.put("two", this.two); CompositeHealthIndicator composite = new CompositeHealthIndicator( @@ -78,7 +78,7 @@ public class CompositeHealthIndicatorTests { @Test public void createWithIndicatorsAndAdd() throws Exception { - Map indicators = new HashMap(); + Map indicators = new HashMap<>(); indicators.put("one", this.one); indicators.put("two", this.two); CompositeHealthIndicator composite = new CompositeHealthIndicator( @@ -110,7 +110,7 @@ public class CompositeHealthIndicatorTests { @Test public void testSerialization() throws Exception { - Map indicators = new HashMap(); + Map indicators = new HashMap<>(); indicators.put("db1", this.one); indicators.put("db2", this.two); CompositeHealthIndicator innerComposite = new CompositeHealthIndicator( diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorTests.java index 3fc37273c5..6ab1801102 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorTests.java @@ -85,7 +85,7 @@ public class ElasticsearchHealthIndicatorTests { @Test public void certainIndices() { - PlainActionFuture responseFuture = new PlainActionFuture(); + PlainActionFuture responseFuture = new PlainActionFuture<>(); responseFuture.onResponse(new StubClusterHealthResponse()); ArgumentCaptor requestCaptor = ArgumentCaptor .forClass(ClusterHealthRequest.class); @@ -112,7 +112,7 @@ public class ElasticsearchHealthIndicatorTests { @Test public void healthDetails() { - PlainActionFuture responseFuture = new PlainActionFuture(); + PlainActionFuture responseFuture = new PlainActionFuture<>(); responseFuture.onResponse(new StubClusterHealthResponse()); given(this.cluster.health(any(ClusterHealthRequest.class))) .willReturn(responseFuture); @@ -131,7 +131,7 @@ public class ElasticsearchHealthIndicatorTests { @Test public void redResponseMapsToDown() { - PlainActionFuture responseFuture = new PlainActionFuture(); + PlainActionFuture responseFuture = new PlainActionFuture<>(); responseFuture.onResponse(new StubClusterHealthResponse(ClusterHealthStatus.RED)); given(this.cluster.health(any(ClusterHealthRequest.class))) .willReturn(responseFuture); @@ -140,7 +140,7 @@ public class ElasticsearchHealthIndicatorTests { @Test public void yellowResponseMapsToUp() { - PlainActionFuture responseFuture = new PlainActionFuture(); + PlainActionFuture responseFuture = new PlainActionFuture<>(); responseFuture .onResponse(new StubClusterHealthResponse(ClusterHealthStatus.YELLOW)); given(this.cluster.health(any(ClusterHealthRequest.class))) @@ -150,7 +150,7 @@ public class ElasticsearchHealthIndicatorTests { @Test public void responseTimeout() { - PlainActionFuture responseFuture = new PlainActionFuture(); + PlainActionFuture responseFuture = new PlainActionFuture<>(); given(this.cluster.health(any(ClusterHealthRequest.class))) .willReturn(responseFuture); Health health = this.indicator.health(); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/LdapHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/LdapHealthIndicatorTests.java index cfb4aa4196..47959cc510 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/LdapHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/LdapHealthIndicatorTests.java @@ -31,8 +31,8 @@ import org.springframework.ldap.core.ContextExecutor; import org.springframework.ldap.core.LdapTemplate; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; -import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java index 14e4033071..335a995581 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -41,7 +41,7 @@ public class OrderedHealthAggregatorTests { @Test public void defaultOrder() { - Map healths = new HashMap(); + Map healths = new HashMap<>(); healths.put("h1", new Health.Builder().status(Status.DOWN).build()); healths.put("h2", new Health.Builder().status(Status.UP).build()); healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build()); @@ -54,7 +54,7 @@ public class OrderedHealthAggregatorTests { public void customOrder() { this.healthAggregator.setStatusOrder(Status.UNKNOWN, Status.UP, Status.OUT_OF_SERVICE, Status.DOWN); - Map healths = new HashMap(); + Map healths = new HashMap<>(); healths.put("h1", new Health.Builder().status(Status.DOWN).build()); healths.put("h2", new Health.Builder().status(Status.UP).build()); healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build()); @@ -65,7 +65,7 @@ public class OrderedHealthAggregatorTests { @Test public void defaultOrderWithCustomStatus() { - Map healths = new HashMap(); + Map healths = new HashMap<>(); healths.put("h1", new Health.Builder().status(Status.DOWN).build()); healths.put("h2", new Health.Builder().status(Status.UP).build()); healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build()); @@ -79,7 +79,7 @@ public class OrderedHealthAggregatorTests { public void customOrderWithCustomStatus() { this.healthAggregator.setStatusOrder( Arrays.asList("DOWN", "OUT_OF_SERVICE", "UP", "UNKNOWN", "CUSTOM")); - Map healths = new HashMap(); + Map healths = new HashMap<>(); healths.put("h1", new Health.Builder().status(Status.DOWN).build()); healths.put("h2", new Health.Builder().status(Status.UP).build()); healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java index e4d055c39e..13eabac89b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java @@ -66,7 +66,7 @@ public class SolrHealthIndicatorTests { public void solrIsUp() throws Exception { SolrClient solrClient = mock(SolrClient.class); SolrPingResponse pingResponse = new SolrPingResponse(); - NamedList response = new NamedList(); + NamedList response = new NamedList<>(); response.add("status", "OK"); pingResponse.setResponse(response); given(solrClient.ping()).willReturn(pingResponse); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/Iterables.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/Iterables.java index 33cc8754bb..6f9562365b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/Iterables.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/Iterables.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2017 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. @@ -28,7 +28,7 @@ public abstract class Iterables { if (iterable instanceof Collection) { return (Collection) iterable; } - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); for (T t : iterable) { list.add(t); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReaderTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReaderTests.java index 59765b1c11..870fd9d4ab 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReaderTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/aggregate/AggregateMetricReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -39,28 +39,28 @@ public class AggregateMetricReaderTests { @Test public void writeAndReadDefaults() { - this.source.set(new Metric("foo.bar.spam", 2.3)); + this.source.set(new Metric<>("foo.bar.spam", 2.3)); assertThat(this.reader.findOne("aggregate.spam").getValue()).isEqualTo(2.3); } @Test public void defaultKeyPattern() { - this.source.set(new Metric("foo.bar.spam.bucket.wham", 2.3)); + this.source.set(new Metric<>("foo.bar.spam.bucket.wham", 2.3)); assertThat(this.reader.findOne("aggregate.spam.bucket.wham").getValue()) .isEqualTo(2.3); } @Test public void addKeyPattern() { - this.source.set(new Metric("foo.bar.spam.bucket.wham", 2.3)); + this.source.set(new Metric<>("foo.bar.spam.bucket.wham", 2.3)); this.reader.setKeyPattern("d.d.k.d"); assertThat(this.reader.findOne("aggregate.spam.wham").getValue()).isEqualTo(2.3); } @Test public void addPrefix() { - this.source.set(new Metric("foo.bar.spam.bucket.wham", 2.3)); - this.source.set(new Metric("off.bar.spam.bucket.wham", 2.4)); + this.source.set(new Metric<>("foo.bar.spam.bucket.wham", 2.3)); + this.source.set(new Metric<>("off.bar.spam.bucket.wham", 2.4)); this.reader.setPrefix("www"); this.reader.setKeyPattern("k.d.k.d"); assertThat(this.reader.findOne("www.foo.spam.wham").getValue()).isEqualTo(2.3); @@ -69,45 +69,45 @@ public class AggregateMetricReaderTests { @Test public void writeAndReadExtraLong() { - this.source.set(new Metric("blee.foo.bar.spam", 2.3)); + this.source.set(new Metric<>("blee.foo.bar.spam", 2.3)); this.reader.setKeyPattern("d.d.d.k"); assertThat(this.reader.findOne("aggregate.spam").getValue()).isEqualTo(2.3); } @Test public void writeAndReadLatestValue() { - this.source.set(new Metric("foo.bar.spam", 2.3, new Date(100L))); - this.source.set(new Metric("oof.rab.spam", 2.4, new Date(0L))); + this.source.set(new Metric<>("foo.bar.spam", 2.3, new Date(100L))); + this.source.set(new Metric<>("oof.rab.spam", 2.4, new Date(0L))); assertThat(this.reader.findOne("aggregate.spam").getValue()).isEqualTo(2.3); } @Test public void onlyPrefixed() { - this.source.set(new Metric("foo.bar.spam", 2.3)); + this.source.set(new Metric<>("foo.bar.spam", 2.3)); assertThat(this.reader.findOne("spam")).isNull(); } @Test public void incrementCounter() { - this.source.increment(new Delta("foo.bar.counter.spam", 2L)); - this.source.increment(new Delta("oof.rab.counter.spam", 3L)); + this.source.increment(new Delta<>("foo.bar.counter.spam", 2L)); + this.source.increment(new Delta<>("oof.rab.counter.spam", 3L)); assertThat(this.reader.findOne("aggregate.counter.spam").getValue()) .isEqualTo(5L); } @Test public void countGauges() { - this.source.set(new Metric("foo.bar.spam", 2.3)); - this.source.set(new Metric("oof.rab.spam", 2.4)); + this.source.set(new Metric<>("foo.bar.spam", 2.3)); + this.source.set(new Metric<>("oof.rab.spam", 2.4)); assertThat(this.reader.count()).isEqualTo(1); } @Test public void countGaugesAndCounters() { - this.source.set(new Metric("foo.bar.spam", 2.3)); - this.source.set(new Metric("oof.rab.spam", 2.4)); - this.source.increment(new Delta("foo.bar.counter.spam", 2L)); - this.source.increment(new Delta("oof.rab.counter.spam", 3L)); + this.source.set(new Metric<>("foo.bar.spam", 2.3)); + this.source.set(new Metric<>("oof.rab.spam", 2.4)); + this.source.increment(new Delta<>("foo.bar.counter.spam", 2L)); + this.source.increment(new Delta<>("oof.rab.counter.spam", 3L)); assertThat(this.reader.count()).isEqualTo(2); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/BufferGaugeServiceSpeedTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/BufferGaugeServiceSpeedTests.java index 29e43d1f76..322f1d97b0 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/BufferGaugeServiceSpeedTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/BufferGaugeServiceSpeedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -154,7 +154,7 @@ public class BufferGaugeServiceSpeedTests { } } }; - Collection> futures = new HashSet>(); + Collection> futures = new HashSet<>(); for (int i = 0; i < threadCount; i++) { futures.add(pool.submit(task)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/CounterServiceSpeedTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/CounterServiceSpeedTests.java index 25bc73b9c5..f309fabd04 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/CounterServiceSpeedTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/CounterServiceSpeedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -153,7 +153,7 @@ public class CounterServiceSpeedTests { } } }; - Collection> futures = new HashSet>(); + Collection> futures = new HashSet<>(); for (int i = 0; i < threadCount; i++) { futures.add(pool.submit(task)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultCounterServiceSpeedTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultCounterServiceSpeedTests.java index 9cb2083a58..4b9720705b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultCounterServiceSpeedTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultCounterServiceSpeedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -96,7 +96,7 @@ public class DefaultCounterServiceSpeedTests { } } }; - Collection> futures = new HashSet>(); + Collection> futures = new HashSet<>(); for (int i = 0; i < threadCount; i++) { futures.add(pool.submit(task)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultGaugeServiceSpeedTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultGaugeServiceSpeedTests.java index fac827f08b..bc869573af 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultGaugeServiceSpeedTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DefaultGaugeServiceSpeedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -97,7 +97,7 @@ public class DefaultGaugeServiceSpeedTests { } } }; - Collection> futures = new HashSet>(); + Collection> futures = new HashSet<>(); for (int i = 0; i < threadCount; i++) { futures.add(pool.submit(task)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DropwizardCounterServiceSpeedTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DropwizardCounterServiceSpeedTests.java index 86cfdd7a8b..3b547b2ca7 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DropwizardCounterServiceSpeedTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/buffer/DropwizardCounterServiceSpeedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -99,7 +99,7 @@ public class DropwizardCounterServiceSpeedTests { } } }; - Collection> futures = new HashSet>(); + Collection> futures = new HashSet<>(); for (int i = 0; i < threadCount; i++) { futures.add(pool.submit(task)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServicesTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServicesTests.java index 61abfe88ce..83485f2aa3 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServicesTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/dropwizard/DropwizardMetricServicesTests.java @@ -139,7 +139,7 @@ public class DropwizardMetricServicesTests { */ @Test public void testParallelism() throws Exception { - List threads = new ArrayList(); + List threads = new ArrayList<>(); ThreadGroup group = new ThreadGroup("threads"); for (int i = 0; i < 10; i++) { WriterThread thread = new WriterThread(group, i, this.writer); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricExportersTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricExportersTests.java index 61d098797a..200a464392 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricExportersTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricExportersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -41,7 +41,7 @@ public class MetricExportersTests { private MetricExportProperties export = new MetricExportProperties(); - private Map writers = new LinkedHashMap(); + private Map writers = new LinkedHashMap<>(); private MetricReader reader = mock(MetricReader.class); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java index 04ac555940..164801ca64 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -53,7 +53,7 @@ public class PrefixMetricGroupExporterTests { @Test public void countersIncremented() { - this.writer.increment("counter.foo", new Delta("bar", 1L)); + this.writer.increment("counter.foo", new Delta<>("bar", 1L)); this.reader.set("counter", Collections .>singletonList(new Metric("counter.foo.bar", 1))); this.exporter.setGroups(Collections.singleton("counter.foo")); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbGaugeWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbGaugeWriterTests.java index 21c5ebf389..45d8a44dd9 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbGaugeWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/opentsdb/OpenTsdbGaugeWriterTests.java @@ -52,7 +52,7 @@ public class OpenTsdbGaugeWriterTests { @Test public void postSuccessfullyOnFlush() { - this.writer.set(new Metric("foo", 2.4)); + this.writer.set(new Metric<>("foo", 2.4)); given(this.restTemplate.postForEntity(anyString(), any(Object.class), anyMap())) .willReturn(emptyResponse()); this.writer.flush(); @@ -64,13 +64,13 @@ public class OpenTsdbGaugeWriterTests { given(this.restTemplate.postForEntity(anyString(), any(Object.class), anyMap())) .willReturn(emptyResponse()); this.writer.setBufferSize(0); - this.writer.set(new Metric("foo", 2.4)); + this.writer.set(new Metric<>("foo", 2.4)); verify(this.restTemplate).postForEntity(anyString(), any(Object.class), anyMap()); } @SuppressWarnings("rawtypes") private ResponseEntity emptyResponse() { - return new ResponseEntity(Collections.emptyMap(), HttpStatus.OK); + return new ResponseEntity<>(Collections.emptyMap(), HttpStatus.OK); } @SuppressWarnings({ "rawtypes", "unchecked" }) diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReaderTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReaderTests.java index 4617dea14f..b409551aa4 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReaderTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/reader/MetricRegistryMetricReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -45,7 +45,7 @@ public class MetricRegistryMetricReaderTests { @Override public Set getValue() { - return new HashSet(); + return new HashSet<>(); } }); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepositoryTests.java index a3212779f3..25cf51063b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMetricRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -37,14 +37,14 @@ public class InMemoryMetricRepositoryTests { @Test public void increment() { - this.repository.increment(new Delta("foo", 1, new Date())); + this.repository.increment(new Delta<>("foo", 1, new Date())); assertThat(this.repository.findOne("foo").getValue().doubleValue()).isEqualTo(1.0, offset(0.01)); } @Test public void set() { - this.repository.set(new Metric("foo", 2.5, new Date())); + this.repository.set(new Metric<>("foo", 2.5, new Date())); assertThat(this.repository.findOne("foo").getValue().doubleValue()).isEqualTo(2.5, offset(0.01)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMultiMetricRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMultiMetricRepositoryTests.java index 19bac157fa..501691c6bc 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMultiMetricRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/InMemoryMultiMetricRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -42,7 +42,7 @@ public class InMemoryMultiMetricRepositoryTests { this.repository.increment("foo", new Delta("bar", 1)); this.repository.increment("foo", new Delta("bar", 1)); this.repository.increment("foo", new Delta("spam", 1)); - Set names = new HashSet(); + Set names = new HashSet<>(); for (Metric metric : this.repository.findAll("foo")) { names.add(metric.getName()); } @@ -53,7 +53,7 @@ public class InMemoryMultiMetricRepositoryTests { @Test public void prefixWithWildcard() { this.repository.increment("foo", new Delta("bar", 1)); - Set names = new HashSet(); + Set names = new HashSet<>(); for (Metric metric : this.repository.findAll("foo.*")) { names.add(metric.getName()); } @@ -64,7 +64,7 @@ public class InMemoryMultiMetricRepositoryTests { @Test public void prefixWithPeriod() { this.repository.increment("foo", new Delta("bar", 1)); - Set names = new HashSet(); + Set names = new HashSet<>(); for (Metric metric : this.repository.findAll("foo.")) { names.add(metric.getName()); } @@ -76,7 +76,7 @@ public class InMemoryMultiMetricRepositoryTests { public void onlyRegisteredPrefixCounted() { this.repository.increment("foo", new Delta("bar", 1)); this.repository.increment("foobar", new Delta("spam", 1)); - Set names = new HashSet(); + Set names = new HashSet<>(); for (Metric metric : this.repository.findAll("foo")) { names.add(metric.getName()); } @@ -89,7 +89,7 @@ public class InMemoryMultiMetricRepositoryTests { this.repository.increment("foo", new Delta("foo.bar", 1)); this.repository.increment("foo", new Delta("foo.bar", 2)); this.repository.increment("foo", new Delta("foo.spam", 1)); - Map> metrics = new HashMap>(); + Map> metrics = new HashMap<>(); for (Metric metric : this.repository.findAll("foo")) { metrics.put(metric.getName(), metric); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepositoryTests.java index 547b22c673..a298f585ff 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMetricRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -71,14 +71,14 @@ public class RedisMetricRepositoryTests { @Test public void incrementAndGet() { - this.repository.increment(new Delta("foo", 3L)); + this.repository.increment(new Delta<>("foo", 3L)); assertThat(this.repository.findOne("foo").getValue().longValue()).isEqualTo(3); } @Test public void setIncrementAndGet() { this.repository.set(new Metric("foo", 12.3)); - this.repository.increment(new Delta("foo", 3L)); + this.repository.increment(new Delta<>("foo", 3L)); Metric metric = this.repository.findOne("foo"); assertThat(metric.getName()).isEqualTo("foo"); assertThat(metric.getValue().doubleValue()).isEqualTo(15.3, offset(0.01)); @@ -86,21 +86,21 @@ public class RedisMetricRepositoryTests { @Test public void findAll() { - this.repository.increment(new Delta("foo", 3L)); + this.repository.increment(new Delta<>("foo", 3L)); this.repository.set(new Metric("bar", 12.3)); assertThat(Iterables.collection(this.repository.findAll())).hasSize(2); } @Test public void findOneWithAll() { - this.repository.increment(new Delta("foo", 3L)); + this.repository.increment(new Delta<>("foo", 3L)); Metric metric = this.repository.findAll().iterator().next(); assertThat(metric.getName()).isEqualTo("foo"); } @Test public void count() { - this.repository.increment(new Delta("foo", 3L)); + this.repository.increment(new Delta<>("foo", 3L)); this.repository.set(new Metric("bar", 12.3)); assertThat(this.repository.count()).isEqualTo(2); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java index c95bb27775..1612b39f92 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/repository/redis/RedisMultiMetricRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -132,7 +132,7 @@ public class RedisMultiMetricRepositoryTests { this.repository.increment("foo", new Delta("foo.bar", 2)); this.repository.increment("foo", new Delta("foo.spam", 1)); Metric bar = null; - Set names = new HashSet(); + Set names = new HashSet<>(); for (Metric metric : this.repository.findAll("foo")) { names.add(metric.getName()); if (metric.getName().equals("foo.bar")) { diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepositoryTests.java index 5afef238c5..6af63795f8 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/InMemoryRichGaugeRepositoryTests.java @@ -36,23 +36,23 @@ public class InMemoryRichGaugeRepositoryTests { @Test public void writeAndRead() { - this.repository.set(new Metric("foo", 1d)); - this.repository.set(new Metric("foo", 2d)); + this.repository.set(new Metric<>("foo", 1d)); + this.repository.set(new Metric<>("foo", 2d)); assertThat(this.repository.findOne("foo").getCount()).isEqualTo(2L); assertThat(this.repository.findOne("foo").getValue()).isEqualTo(2d, offset(0.01)); } @Test public void incrementExisting() { - this.repository.set(new Metric("foo", 1d)); - this.repository.increment(new Delta("foo", 2d)); + this.repository.set(new Metric<>("foo", 1d)); + this.repository.increment(new Delta<>("foo", 2d)); assertThat(this.repository.findOne("foo").getCount()).isEqualTo(2L); assertThat(this.repository.findOne("foo").getValue()).isEqualTo(3d, offset(0.01)); } @Test public void incrementNew() { - this.repository.increment(new Delta("foo", 2d)); + this.repository.increment(new Delta<>("foo", 2d)); assertThat(this.repository.findOne("foo").getCount()).isEqualTo(1L); assertThat(this.repository.findOne("foo").getValue()).isEqualTo(2d, offset(0.01)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java index b6b195d808..df4b7bcd55 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/rich/MultiMetricRichGaugeReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -43,8 +43,8 @@ public class MultiMetricRichGaugeReaderTests { @Test public void countOne() { - this.data.set(new Metric("foo", 1)); - this.data.set(new Metric("foo", 1)); + this.data.set(new Metric<>("foo", 1)); + this.data.set(new Metric<>("foo", 1)); this.exporter.export(); // Check the exporter worked assertThat(this.repository.countGroups()).isEqualTo(1); @@ -56,8 +56,8 @@ public class MultiMetricRichGaugeReaderTests { @Test public void countTwo() { - this.data.set(new Metric("foo", 1)); - this.data.set(new Metric("bar", 1)); + this.data.set(new Metric<>("foo", 1)); + this.data.set(new Metric<>("bar", 1)); this.exporter.export(); assertThat(this.reader.count()).isEqualTo(2); RichGauge one = this.reader.findOne("foo"); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java index 33494ecffb..8b5e4344ac 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/statsd/StatsdMetricWriterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,21 +54,21 @@ public class StatsdMetricWriterTests { @Test public void increment() { - this.writer.increment(new Delta("counter.foo", 3L)); + this.writer.increment(new Delta<>("counter.foo", 3L)); this.server.waitForMessage(); assertThat(this.server.messagesReceived().get(0)).isEqualTo("me.counter.foo:3|c"); } @Test public void setLongMetric() throws Exception { - this.writer.set(new Metric("gauge.foo", 3L)); + this.writer.set(new Metric<>("gauge.foo", 3L)); this.server.waitForMessage(); assertThat(this.server.messagesReceived().get(0)).isEqualTo("me.gauge.foo:3|g"); } @Test public void setDoubleMetric() throws Exception { - this.writer.set(new Metric("gauge.foo", 3.7)); + this.writer.set(new Metric<>("gauge.foo", 3.7)); this.server.waitForMessage(); // Doubles are truncated assertThat(this.server.messagesReceived().get(0)).isEqualTo("me.gauge.foo:3.7|g"); @@ -76,7 +76,7 @@ public class StatsdMetricWriterTests { @Test public void setTimerMetric() throws Exception { - this.writer.set(new Metric("timer.foo", 37L)); + this.writer.set(new Metric<>("timer.foo", 37L)); this.server.waitForMessage(); assertThat(this.server.messagesReceived().get(0)).isEqualTo("me.timer.foo:37|ms"); } @@ -84,7 +84,7 @@ public class StatsdMetricWriterTests { @Test public void nullPrefix() throws Exception { this.writer = new StatsdMetricWriter("localhost", this.port); - this.writer.set(new Metric("gauge.foo", 3L)); + this.writer.set(new Metric<>("gauge.foo", 3L)); this.server.waitForMessage(); assertThat(this.server.messagesReceived().get(0)).isEqualTo("gauge.foo:3|g"); } @@ -92,14 +92,14 @@ public class StatsdMetricWriterTests { @Test public void periodPrefix() throws Exception { this.writer = new StatsdMetricWriter("my.", "localhost", this.port); - this.writer.set(new Metric("gauge.foo", 3L)); + this.writer.set(new Metric<>("gauge.foo", 3L)); this.server.waitForMessage(); assertThat(this.server.messagesReceived().get(0)).isEqualTo("my.gauge.foo:3|g"); } private static final class DummyStatsDServer implements Runnable { - private final List messagesReceived = new ArrayList(); + private final List messagesReceived = new ArrayList<>(); private final DatagramSocket server; @@ -142,7 +142,7 @@ public class StatsdMetricWriterTests { } public List messagesReceived() { - return new ArrayList(this.messagesReceived); + return new ArrayList<>(this.messagesReceived); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepositoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepositoryTests.java index 2c053e0a34..049a606dd4 100755 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepositoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ public class SimpleInMemoryRepositoryTests { - private final SimpleInMemoryRepository repository = new SimpleInMemoryRepository(); + private final SimpleInMemoryRepository repository = new SimpleInMemoryRepository<>(); @Test public void setAndGet() { @@ -88,8 +88,8 @@ public class SimpleInMemoryRepositoryTests { @Test public void updateConcurrent() throws Exception { - SimpleInMemoryRepository repository = new SimpleInMemoryRepository(); - Collection> tasks = new ArrayList>(); + SimpleInMemoryRepository repository = new SimpleInMemoryRepository<>(); + Collection> tasks = new ArrayList<>(); for (int i = 0; i < 1000; i++) { tasks.add(new RepositoryUpdate(repository, 1)); tasks.add(new RepositoryUpdate(repository, -1)); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java index 2aade006b0..be497c13c5 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/MessageChannelMetricWriterTests.java @@ -67,14 +67,14 @@ public class MessageChannelMetricWriterTests { @Test public void messageSentOnAdd() { - this.writer.increment(new Delta("foo", 1)); + this.writer.increment(new Delta<>("foo", 1)); verify(this.channel).send(any(Message.class)); verify(this.observer).increment(any(Delta.class)); } @Test public void messageSentOnSet() { - this.writer.set(new Metric("foo", 1d)); + this.writer.set(new Metric<>("foo", 1d)); verify(this.channel).send(any(Message.class)); verify(this.observer).set(any(Metric.class)); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessor.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessor.java index 993ebca9b6..8a86fedfb1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AbstractDependsOnBeanFactoryPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -71,7 +71,7 @@ public abstract class AbstractDependsOnBeanFactoryPostProcessor } private Iterable getBeanNames(ListableBeanFactory beanFactory) { - Set names = new HashSet(); + Set names = new HashSet<>(); names.addAll(Arrays.asList(BeanFactoryUtils.beanNamesForTypeIncludingAncestors( beanFactory, this.beanClass, true, false))); for (String factoryBeanName : BeanFactoryUtils.beanNamesForTypeIncludingAncestors( diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java index 1e2b9b1ed9..4b5ebe85d1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java @@ -167,7 +167,7 @@ public class AutoConfigurationImportSelector private void checkExcludedClasses(List configurations, Set exclusions) { - List invalidExcludes = new ArrayList(exclusions.size()); + List invalidExcludes = new ArrayList<>(exclusions.size()); for (String exclusion : exclusions) { if (ClassUtils.isPresent(exclusion, getClass().getClassLoader()) && !configurations.contains(exclusion)) { @@ -203,7 +203,7 @@ public class AutoConfigurationImportSelector */ protected Set getExclusions(AnnotationMetadata metadata, AnnotationAttributes attributes) { - Set excluded = new LinkedHashSet(); + Set excluded = new LinkedHashSet<>(); excluded.addAll(asList(attributes, "exclude")); excluded.addAll(Arrays.asList(attributes.getStringArray("excludeName"))); excluded.addAll(getExcludeAutoConfigurationsProperty()); @@ -218,12 +218,12 @@ public class AutoConfigurationImportSelector if (properties.isEmpty()) { return Collections.emptyList(); } - List excludes = new ArrayList(); + List excludes = new ArrayList<>(); for (Map.Entry entry : properties.entrySet()) { String name = entry.getKey(); Object value = entry.getValue(); if (name.isEmpty() || name.startsWith("[") && value != null) { - excludes.addAll(new HashSet(Arrays.asList(StringUtils + excludes.addAll(new HashSet<>(Arrays.asList(StringUtils .tokenizeToStringArray(String.valueOf(value), ",")))); } } @@ -261,7 +261,7 @@ public class AutoConfigurationImportSelector if (!skipped) { return configurations; } - List result = new ArrayList(candidates.length); + List result = new ArrayList<>(candidates.length); for (int i = 0; i < candidates.length; i++) { if (!skip[i]) { result.add(candidates[i]); @@ -273,7 +273,7 @@ public class AutoConfigurationImportSelector + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime) + " ms"); } - return new ArrayList(result); + return new ArrayList<>(result); } protected List getAutoConfigurationImportFilters() { @@ -293,7 +293,7 @@ public class AutoConfigurationImportSelector } protected final List removeDuplicates(List list) { - return new ArrayList(new LinkedHashSet(list)); + return new ArrayList<>(new LinkedHashSet<>(list)); } protected final List asList(AnnotationAttributes attributes, String name) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java index a2557aa823..08215a74dd 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java @@ -113,7 +113,7 @@ public abstract class AutoConfigurationPackages { ConstructorArgumentValues constructorArguments, String[] packageNames) { String[] existing = (String[]) constructorArguments .getIndexedArgumentValue(0, String[].class).getValue(); - Set merged = new LinkedHashSet(); + Set merged = new LinkedHashSet<>(); merged.addAll(Arrays.asList(existing)); merged.addAll(Arrays.asList(packageNames)); return merged.toArray(new String[merged.size()]); @@ -184,7 +184,7 @@ public abstract class AutoConfigurationPackages { private boolean loggedBasePackageInfo; BasePackages(String... names) { - List packages = new ArrayList(); + List packages = new ArrayList<>(); for (String name : names) { if (StringUtils.hasText(name)) { packages.add(name); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java index 762f32c174..2842a80419 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java @@ -56,7 +56,7 @@ class AutoConfigurationSorter { public List getInPriorityOrder(Collection classNames) { final AutoConfigurationClasses classes = new AutoConfigurationClasses( this.metadataReaderFactory, this.autoConfigurationMetadata, classNames); - List orderedClassNames = new ArrayList(classNames); + List orderedClassNames = new ArrayList<>(classNames); // Initially sort alphabetically Collections.sort(orderedClassNames); // Then sort by order @@ -77,13 +77,13 @@ class AutoConfigurationSorter { private List sortByAnnotation(AutoConfigurationClasses classes, List classNames) { - List toSort = new ArrayList(classNames); - Set sorted = new LinkedHashSet(); - Set processing = new LinkedHashSet(); + List toSort = new ArrayList<>(classNames); + Set sorted = new LinkedHashSet<>(); + Set processing = new LinkedHashSet<>(); while (!toSort.isEmpty()) { doSortByAfterAnnotation(classes, toSort, sorted, processing, null); } - return new ArrayList(sorted); + return new ArrayList<>(sorted); } private void doSortByAfterAnnotation(AutoConfigurationClasses classes, @@ -106,7 +106,7 @@ class AutoConfigurationSorter { private static class AutoConfigurationClasses { - private final Map classes = new HashMap(); + private final Map classes = new HashMap<>(); AutoConfigurationClasses(MetadataReaderFactory metadataReaderFactory, AutoConfigurationMetadata autoConfigurationMetadata, @@ -122,7 +122,7 @@ class AutoConfigurationSorter { } public Set getClassesRequestedAfter(String className) { - Set rtn = new LinkedHashSet(); + Set rtn = new LinkedHashSet<>(); rtn.addAll(get(className).getAfter()); for (Map.Entry entry : this.classes .entrySet()) { @@ -200,7 +200,7 @@ class AutoConfigurationSorter { if (attributes == null) { return Collections.emptySet(); } - Set value = new LinkedHashSet(); + Set value = new LinkedHashSet<>(); Collections.addAll(value, (String[]) attributes.get("value")); Collections.addAll(value, (String[]) attributes.get("name")); return value; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java index 5b9fcac212..859193b6e4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java @@ -51,7 +51,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec private static final Set ANNOTATION_NAMES; static { - Set names = new LinkedHashSet(); + Set names = new LinkedHashSet<>(); names.add(ImportAutoConfiguration.class.getName()); names.add("org.springframework.boot.autoconfigure.test.ImportAutoConfiguration"); ANNOTATION_NAMES = Collections.unmodifiableSet(names); @@ -59,7 +59,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec @Override public Set determineImports(AnnotationMetadata metadata) { - Set result = new LinkedHashSet(); + Set result = new LinkedHashSet<>(); result.addAll(getCandidateConfigurations(metadata, null)); result.removeAll(getExclusions(metadata, null)); return Collections.unmodifiableSet(result); @@ -73,7 +73,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec @Override protected List getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) { - List candidates = new ArrayList(); + List candidates = new ArrayList<>(); Map, List> annotations = getAnnotations(metadata); for (Map.Entry, List> entry : annotations.entrySet()) { collectCandidateConfigurations(entry.getKey(), entry.getValue(), candidates); @@ -106,7 +106,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec @Override protected Set getExclusions(AnnotationMetadata metadata, AnnotationAttributes attributes) { - Set exclusions = new LinkedHashSet(); + Set exclusions = new LinkedHashSet<>(); Class source = ClassUtils.resolveClassName(metadata.getClassName(), null); for (String annotationName : ANNOTATION_NAMES) { AnnotationAttributes merged = AnnotatedElementUtils @@ -133,7 +133,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec protected final Map, List> getAnnotations( AnnotationMetadata metadata) { - MultiValueMap, Annotation> annotations = new LinkedMultiValueMap, Annotation>(); + MultiValueMap, Annotation> annotations = new LinkedMultiValueMap<>(); Class source = ClassUtils.resolveClassName(metadata.getClassName(), null); collectAnnotations(source, annotations, new HashSet>()); return Collections.unmodifiableMap(annotations); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java index 8b0ca0d794..6a9a4a7abf 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java @@ -166,7 +166,7 @@ public class RabbitProperties { if (CollectionUtils.isEmpty(this.parsedAddresses)) { return this.host + ":" + this.port; } - List addressStrings = new ArrayList(); + List addressStrings = new ArrayList<>(); for (Address parsedAddress : this.parsedAddresses) { addressStrings.add(parsedAddress.host + ":" + parsedAddress.port); } @@ -179,7 +179,7 @@ public class RabbitProperties { } private List
parseAddresses(String addresses) { - List
parsedAddresses = new ArrayList
(); + List
parsedAddresses = new ArrayList<>(); for (String address : StringUtils.commaDelimitedListToStringArray(addresses)) { parsedAddresses.add(new Address(address)); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java index 074b8a4825..ae3d41bb57 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2017 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. @@ -31,7 +31,7 @@ import org.springframework.context.ApplicationListener; public class JobExecutionExitCodeGenerator implements ApplicationListener, ExitCodeGenerator { - private final List executions = new ArrayList(); + private final List executions = new ArrayList<>(); @Override public void onApplicationEvent(JobExecutionEvent event) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java index ec6c78e551..a0ce641562 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -167,8 +167,7 @@ public class JobLauncherCommandLineRunner } private void removeNonIdentifying(Map parameters) { - HashMap copy = new HashMap( - parameters); + HashMap copy = new HashMap<>(parameters); for (Map.Entry parameter : copy.entrySet()) { if (!parameter.getValue().isIdentifying()) { parameters.remove(parameter.getKey()); @@ -178,7 +177,7 @@ public class JobLauncherCommandLineRunner private JobParameters merge(JobParameters parameters, Map additionals) { - Map merged = new HashMap(); + Map merged = new HashMap<>(); merged.putAll(parameters.getParameters()); merged.putAll(additionals); parameters = new JobParameters(merged); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java index c9dc7b85e1..bf33c479aa 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ final class CacheConfigurations { private static final Map> MAPPINGS; static { - Map> mappings = new HashMap>(); + Map> mappings = new HashMap<>(); mappings.put(CacheType.GENERIC, GenericCacheConfiguration.class); mappings.put(CacheType.EHCACHE, EhCacheCacheConfiguration.class); mappings.put(CacheType.HAZELCAST, HazelcastCacheConfiguration.class); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizers.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizers.java index 021f9c79e9..a9b57add7b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizers.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizers.java @@ -41,8 +41,7 @@ public class CacheManagerCustomizers { public CacheManagerCustomizers( List> customizers) { - this.customizers = (customizers != null - ? new ArrayList>(customizers) + this.customizers = (customizers != null ? new ArrayList<>(customizers) : Collections.>emptyList()); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java index 6ea9fad142..1d299e70e6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java @@ -43,7 +43,7 @@ public class CacheProperties { * Comma-separated list of cache names to create if supported by the underlying cache * manager. Usually, this disables the ability to create additional caches on-the-fly. */ - private List cacheNames = new ArrayList(); + private List cacheNames = new ArrayList<>(); private final Caffeine caffeine = new Caffeine(); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java index 582fc358e5..da7d62d095 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -132,7 +132,7 @@ class JCacheCacheConfiguration { if (this.defaultCacheConfiguration != null) { return this.defaultCacheConfiguration; } - return new MutableConfiguration(); + return new MutableConfiguration<>(); } private void customize(CacheManager cacheManager) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java index 11be4a5ec4..9fe5b3b9f9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -78,8 +78,8 @@ abstract class AbstractNestedCondition extends SpringBootCondition public MemberMatchOutcomes(MemberConditions memberConditions) { this.all = Collections.unmodifiableList(memberConditions.getMatchOutcomes()); - List matches = new ArrayList(); - List nonMatches = new ArrayList(); + List matches = new ArrayList<>(); + List nonMatches = new ArrayList<>(); for (ConditionOutcome outcome : this.all) { (outcome.isMatch() ? matches : nonMatches).add(outcome); } @@ -119,7 +119,7 @@ abstract class AbstractNestedCondition extends SpringBootCondition private Map> getMemberConditions( String[] members) { - MultiValueMap memberConditions = new LinkedMultiValueMap(); + MultiValueMap memberConditions = new LinkedMultiValueMap<>(); for (String member : members) { AnnotationMetadata metadata = getMetadata(member); for (String[] conditionClasses : getConditionClasses(metadata)) { @@ -157,7 +157,7 @@ abstract class AbstractNestedCondition extends SpringBootCondition } public List getMatchOutcomes() { - List outcomes = new ArrayList(); + List outcomes = new ArrayList<>(); for (Map.Entry> entry : this.memberConditions .entrySet()) { AnnotationMetadata metadata = entry.getKey(); @@ -182,7 +182,7 @@ abstract class AbstractNestedCondition extends SpringBootCondition List conditions) { this.context = context; this.metadata = metadata; - this.outcomes = new ArrayList(conditions.size()); + this.outcomes = new ArrayList<>(conditions.size()); for (Condition condition : conditions) { this.outcomes.add(getConditionOutcome(metadata, condition)); } @@ -207,8 +207,8 @@ abstract class AbstractNestedCondition extends SpringBootCondition return new ConditionOutcome(outcome.isMatch(), message.because(outcome.getMessage())); } - List match = new ArrayList(); - List nonMatch = new ArrayList(); + List match = new ArrayList<>(); + List nonMatch = new ArrayList<>(); for (ConditionOutcome outcome : this.outcomes) { (outcome.isMatch() ? match : nonMatch).add(outcome); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AllNestedConditions.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AllNestedConditions.java index d430540ab2..d8f6bd4a9c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AllNestedConditions.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AllNestedConditions.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -51,7 +51,7 @@ public abstract class AllNestedConditions extends AbstractNestedCondition { @Override protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcomes) { boolean match = hasSameSize(memberOutcomes.getMatches(), memberOutcomes.getAll()); - List messages = new ArrayList(); + List messages = new ArrayList<>(); messages.add(ConditionMessage.forCondition("AllNestedConditions") .because(memberOutcomes.getMatches().size() + " matched " + memberOutcomes.getNonMatches().size() + " did not")); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AnyNestedCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AnyNestedCondition.java index eea3462424..7cf9f0d781 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AnyNestedCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AnyNestedCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,7 +54,7 @@ public abstract class AnyNestedCondition extends AbstractNestedCondition { @Override protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcomes) { boolean match = !memberOutcomes.getMatches().isEmpty(); - List messages = new ArrayList(); + List messages = new ArrayList<>(); messages.add(ConditionMessage.forCondition("AnyNestedCondition") .because(memberOutcomes.getMatches().size() + " matched " + memberOutcomes.getNonMatches().size() + " did not")); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java index 5dcecbe977..b750d162fb 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java @@ -74,7 +74,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton { private final DefaultListableBeanFactory beanFactory; - private final Map> beanTypes = new HashMap>(); + private final Map> beanTypes = new HashMap<>(); private int lastBeanDefinitionCount = 0; @@ -112,7 +112,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton { */ Set getNamesForType(Class type) { updateTypesIfNecessary(); - Set matches = new LinkedHashSet(); + Set matches = new LinkedHashSet<>(); for (Map.Entry> entry : this.beanTypes.entrySet()) { if (entry.getValue() != null && type.isAssignableFrom(entry.getValue())) { matches.add(entry.getKey()); @@ -132,7 +132,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton { */ Set getNamesForAnnotation(Class annotation) { updateTypesIfNecessary(); - Set matches = new LinkedHashSet(); + Set matches = new LinkedHashSet<>(); for (Map.Entry> entry : this.beanTypes.entrySet()) { if (entry.getValue() != null && AnnotationUtils .findAnnotation(entry.getValue(), annotation) != null) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java index 05ab9e995a..9790f9fd3a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -51,7 +51,7 @@ public final class ConditionEvaluationReport { private static final AncestorsMatchedCondition ANCESTOR_CONDITION = new AncestorsMatchedCondition(); - private final SortedMap outcomes = new TreeMap(); + private final SortedMap outcomes = new TreeMap<>(); private boolean addedAncestorOutcomes; @@ -59,7 +59,7 @@ public final class ConditionEvaluationReport { private List exclusions = Collections.emptyList(); - private Set unconditionalClasses = new HashSet(); + private Set unconditionalClasses = new HashSet<>(); /** * Private constructor. @@ -93,7 +93,7 @@ public final class ConditionEvaluationReport { */ public void recordExclusions(Collection exclusions) { Assert.notNull(exclusions, "exclusions must not be null"); - this.exclusions = new ArrayList(exclusions); + this.exclusions = new ArrayList<>(exclusions); } /** @@ -103,7 +103,7 @@ public final class ConditionEvaluationReport { */ public void recordEvaluationCandidates(List evaluationCandidates) { Assert.notNull(evaluationCandidates, "evaluationCandidates must not be null"); - this.unconditionalClasses = new HashSet(evaluationCandidates); + this.unconditionalClasses = new HashSet<>(evaluationCandidates); } /** @@ -193,7 +193,7 @@ public final class ConditionEvaluationReport { */ public static class ConditionAndOutcomes implements Iterable { - private final Set outcomes = new LinkedHashSet(); + private final Set outcomes = new LinkedHashSet<>(); public void add(Condition condition, ConditionOutcome outcome) { this.outcomes.add(new ConditionAndOutcome(condition, outcome)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java index 53e03ed134..e9919e4f53 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java @@ -421,7 +421,7 @@ public final class ConditionMessage { }; public Collection applyTo(Collection items) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (Object item : items) { result.add(applyToItem(item)); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/NoneNestedConditions.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/NoneNestedConditions.java index 9bbe3f5f50..b6ebdfdb55 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/NoneNestedConditions.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/NoneNestedConditions.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -51,7 +51,7 @@ public abstract class NoneNestedConditions extends AbstractNestedCondition { @Override protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcomes) { boolean match = memberOutcomes.getMatches().isEmpty(); - List messages = new ArrayList(); + List messages = new ArrayList<>(); messages.add(ConditionMessage.forCondition("NoneNestedConditions") .because(memberOutcomes.getMatches().size() + " matched " + memberOutcomes.getNonMatches().size() + " did not")); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java index 28d2d886cd..b03dd47d06 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java @@ -230,7 +230,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit private List getNamesOfBeansIgnoredByType(List ignoredTypes, ListableBeanFactory beanFactory, ConditionContext context, boolean considerHierarchy) { - List beanNames = new ArrayList(); + List beanNames = new ArrayList<>(); for (String ignoredType : ignoredTypes) { beanNames.addAll(getBeanNamesForType(beanFactory, ignoredType, context.getClassLoader(), considerHierarchy)); @@ -250,7 +250,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit String type, ClassLoader classLoader, boolean considerHierarchy) throws LinkageError { try { - Set result = new LinkedHashSet(); + Set result = new LinkedHashSet<>(); collectBeanNamesForType(result, beanFactory, ClassUtils.forName(type, classLoader), considerHierarchy); return result; @@ -279,7 +279,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit private String[] getBeanNamesForAnnotation( ConfigurableListableBeanFactory beanFactory, String type, ClassLoader classLoader, boolean considerHierarchy) throws LinkageError { - Set names = new HashSet(); + Set names = new HashSet<>(); try { @SuppressWarnings("unchecked") Class annotationType = (Class) ClassUtils @@ -318,7 +318,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit private List getPrimaryBeans(ConfigurableListableBeanFactory beanFactory, Set beanNames, boolean considerHierarchy) { - List primaryBeans = new ArrayList(); + List primaryBeans = new ArrayList<>(); for (String beanName : beanNames) { BeanDefinition beanDefinition = findBeanDefinition(beanFactory, beanName, considerHierarchy); @@ -347,13 +347,13 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit private final Class annotationType; - private final List names = new ArrayList(); + private final List names = new ArrayList<>(); - private final List types = new ArrayList(); + private final List types = new ArrayList<>(); - private final List annotations = new ArrayList(); + private final List annotations = new ArrayList<>(); - private final List ignoredTypes = new ArrayList(); + private final List ignoredTypes = new ArrayList<>(); private final SearchStrategy strategy; @@ -523,19 +523,19 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit static final class MatchResult { - private final Map> matchedAnnotations = new HashMap>(); + private final Map> matchedAnnotations = new HashMap<>(); - private final List matchedNames = new ArrayList(); + private final List matchedNames = new ArrayList<>(); - private final Map> matchedTypes = new HashMap>(); + private final Map> matchedTypes = new HashMap<>(); - private final List unmatchedAnnotations = new ArrayList(); + private final List unmatchedAnnotations = new ArrayList<>(); - private final List unmatchedNames = new ArrayList(); + private final List unmatchedNames = new ArrayList<>(); - private final List unmatchedTypes = new ArrayList(); + private final List unmatchedTypes = new ArrayList<>(); - private final Set namesOfAllMatches = new HashSet(); + private final Set namesOfAllMatches = new HashSet<>(); private void recordMatchedName(String name) { this.matchedNames.add(name); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java index c97cf6757c..e1a750765c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java @@ -179,7 +179,7 @@ class OnClassCondition extends SpringBootCondition Class annotationType) { MultiValueMap attributes = metadata .getAllAnnotationAttributes(annotationType.getName(), true); - List candidates = new ArrayList(); + List candidates = new ArrayList<>(); if (attributes == null) { return Collections.emptyList(); } @@ -198,7 +198,7 @@ class OnClassCondition extends SpringBootCondition private List getMatches(Collection candidates, MatchType matchType, ClassLoader classLoader) { - List matches = new ArrayList(candidates.size()); + List matches = new ArrayList<>(candidates.size()); for (String candidate : candidates) { if (matchType.matches(candidate, classLoader)) { matches.add(candidate); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java index e2d5176334..d5b8ace68e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,8 +54,8 @@ class OnPropertyCondition extends SpringBootCondition { List allAnnotationAttributes = annotationAttributesFromMultiValueMap( metadata.getAllAnnotationAttributes( ConditionalOnProperty.class.getName())); - List noMatch = new ArrayList(); - List match = new ArrayList(); + List noMatch = new ArrayList<>(); + List match = new ArrayList<>(); for (AnnotationAttributes annotationAttributes : allAnnotationAttributes) { ConditionOutcome outcome = determineOutcome(annotationAttributes, context.getEnvironment()); @@ -69,7 +69,7 @@ class OnPropertyCondition extends SpringBootCondition { private List annotationAttributesFromMultiValueMap( MultiValueMap multiValueMap) { - List> maps = new ArrayList>(); + List> maps = new ArrayList<>(); for (Entry> entry : multiValueMap.entrySet()) { for (int i = 0; i < entry.getValue().size(); i++) { Map map; @@ -77,14 +77,13 @@ class OnPropertyCondition extends SpringBootCondition { map = maps.get(i); } else { - map = new HashMap(); + map = new HashMap<>(); maps.add(map); } map.put(entry.getKey(), entry.getValue().get(i)); } } - List annotationAttributes = new ArrayList( - maps.size()); + List annotationAttributes = new ArrayList<>(maps.size()); for (Map map : maps) { annotationAttributes.add(AnnotationAttributes.fromMap(map)); } @@ -94,8 +93,8 @@ class OnPropertyCondition extends SpringBootCondition { private ConditionOutcome determineOutcome(AnnotationAttributes annotationAttributes, PropertyResolver resolver) { Spec spec = new Spec(annotationAttributes); - List missingProperties = new ArrayList(); - List nonMatchingProperties = new ArrayList(); + List missingProperties = new ArrayList<>(); + List nonMatchingProperties = new ArrayList<>(); spec.collectProperties(resolver, missingProperties, nonMatchingProperties); if (!missingProperties.isEmpty()) { return ConditionOutcome.noMatch( diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java index b36627dd1b..3c54c1dc55 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -48,12 +48,12 @@ class OnResourceCondition extends SpringBootCondition { .getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true); ResourceLoader loader = context.getResourceLoader() == null ? this.defaultResourceLoader : context.getResourceLoader(); - List locations = new ArrayList(); + List locations = new ArrayList<>(); collectValues(locations, attributes.get("resources")); Assert.isTrue(!locations.isEmpty(), "@ConditionalOnResource annotations must specify at " + "least one resource location"); - List missing = new ArrayList(); + List missing = new ArrayList<>(); for (String location : locations) { String resource = context.getEnvironment().resolvePlaceholders(location); if (!loader.getResource(resource).exists()) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ResourceCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ResourceCondition.java index d98280872f..ee8c5324c5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ResourceCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ResourceCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -81,7 +81,7 @@ public abstract class ResourceCondition extends SpringBootCondition { */ protected ConditionOutcome getResourceOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - List found = new ArrayList(); + List found = new ArrayList<>(); for (String location : this.resourceLocations) { Resource resource = context.getResourceLoader().getResource(location); if (resource != null && resource.exists()) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.java index 5b292d6b8f..61d05ccdc5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfiguration.java @@ -147,7 +147,7 @@ public class MessageSourceAutoConfiguration { protected static class ResourceBundleCondition extends SpringBootCondition { - private static ConcurrentReferenceHashMap cache = new ConcurrentReferenceHashMap(); + private static ConcurrentReferenceHashMap cache = new ConcurrentReferenceHashMap<>(); @Override public ConditionOutcome getMatchOutcome(ConditionContext context, diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/OnBootstrapHostsCondition.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/OnBootstrapHostsCondition.java index b78cc05fdb..0fcc190a37 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/OnBootstrapHostsCondition.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/OnBootstrapHostsCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -66,7 +66,7 @@ class OnBootstrapHostsCondition extends SpringBootCondition { PropertyResolver(PropertySources propertySources, String prefix) { this.prefix = prefix; - this.content = new HashMap(); + this.content = new HashMap<>(); DataBinder binder = new RelaxedDataBinder(this.content, this.prefix); binder.bind(new PropertySourcesPropertyValues(propertySources)); } @@ -78,7 +78,7 @@ class OnBootstrapHostsCondition extends SpringBootCondition { for (String relaxedKey : keys) { String key = prefix + relaxedKey; if (this.content.containsKey(relaxedKey)) { - return new AbstractMap.SimpleEntry(key, + return new AbstractMap.SimpleEntry<>(key, this.content.get(relaxedKey)); } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java index c35f3a75ac..d7f953ba1a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 ElasticsearchAutoConfiguration implements DisposableBean { private static final Map DEFAULTS; static { - Map defaults = new LinkedHashMap(); + Map defaults = new LinkedHashMap<>(); defaults.put("http.enabled", String.valueOf(false)); defaults.put("node.local", String.valueOf(true)); defaults.put("path.home", System.getProperty("user.dir")); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchProperties.java index ea5a6b291a..a9436e75b5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -45,7 +45,7 @@ public class ElasticsearchProperties { /** * Additional properties used to configure the client. */ - private Map properties = new HashMap(); + private Map properties = new HashMap<>(); public String getClusterName() { return this.clusterName; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.java index 909a81cdd3..b9882aaafd 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -178,7 +178,7 @@ public class RedisAutoConfiguration { } private List createSentinels(Sentinel sentinel) { - List nodes = new ArrayList(); + List nodes = new ArrayList<>(); for (String node : StringUtils .commaDelimitedListToStringArray(sentinel.getNodes())) { try { @@ -230,7 +230,7 @@ public class RedisAutoConfiguration { public RedisTemplate redisTemplate( RedisConnectionFactory redisConnectionFactory) throws UnknownHostException { - RedisTemplate template = new RedisTemplate(); + RedisTemplate template = new RedisTemplate<>(); template.setConnectionFactory(redisConnectionFactory); return template; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzer.java index 68f8444b5e..2847602cd9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -116,7 +116,7 @@ class NoSuchBeanDefinitionFailureAnalyzer private List getAutoConfigurationResults( NoSuchBeanDefinitionException cause) { - List results = new ArrayList(); + List results = new ArrayList<>(); collectReportedConditionOutcomes(cause, results); collectExcludedAutoConfiguration(cause, results); return results; @@ -197,7 +197,7 @@ class NoSuchBeanDefinitionFailureAnalyzer .getMetadataReader(source.getClassName()); Set candidates = classMetadata.getAnnotationMetadata() .getAnnotatedMethods(Bean.class.getName()); - List result = new ArrayList(); + List result = new ArrayList<>(); for (MethodMetadata candidate : candidates) { if (isMatch(candidate, source, cause)) { result.add(candidate); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanPackages.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanPackages.java index 9c652a1513..f520724017 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanPackages.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanPackages.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -57,7 +57,7 @@ public class EntityScanPackages { private final List packageNames; EntityScanPackages(String... packageNames) { - List packages = new ArrayList(); + List packages = new ArrayList<>(); for (String name : packageNames) { if (StringUtils.hasText(name)) { packages.add(name); @@ -133,7 +133,7 @@ public class EntityScanPackages { Collection packageNames) { String[] existing = (String[]) constructorArguments .getIndexedArgumentValue(0, String[].class).getValue(); - Set merged = new LinkedHashSet(); + Set merged = new LinkedHashSet<>(); merged.addAll(Arrays.asList(existing)); merged.addAll(packageNames); return merged.toArray(new String[merged.size()]); @@ -158,7 +158,7 @@ public class EntityScanPackages { String[] basePackages = attributes.getStringArray("basePackages"); Class[] basePackageClasses = attributes .getClassArray("basePackageClasses"); - Set packagesToScan = new LinkedHashSet(); + Set packagesToScan = new LinkedHashSet<>(); packagesToScan.addAll(Arrays.asList(basePackages)); for (Class basePackageClass : basePackageClasses) { packagesToScan.add(ClassUtils.getPackageName(basePackageClass)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanner.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanner.java index dc1a25ecd1..e23afb80b8 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanner.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -64,7 +64,7 @@ public class EntityScanner { if (packages.isEmpty()) { return Collections.>emptySet(); } - Set> entitySet = new HashSet>(); + Set> entitySet = new HashSet<>(); ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( false); scanner.setEnvironment(this.context.getEnvironment()); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index c5397983be..7ba7a08271 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -239,7 +239,7 @@ public class FlywayAutoConfiguration { private static final Set CONVERTIBLE_TYPES; static { - Set types = new HashSet(2); + Set types = new HashSet<>(2); types.add(new ConvertiblePair(String.class, MigrationVersion.class)); types.add(new ConvertiblePair(Number.class, MigrationVersion.class)); CONVERTIBLE_TYPES = Collections.unmodifiableSet(types); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java index f2ca140b13..9795d28fb5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java @@ -40,7 +40,7 @@ public class FlywayProperties { * Locations of migrations scripts. Can contain the special "{vendor}" placeholder to * use vendor-specific locations. */ - private List locations = new ArrayList( + private List locations = new ArrayList<>( Collections.singletonList("db/migration")); /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java index de69eb6137..029c911258 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java @@ -81,7 +81,7 @@ public class FreeMarkerAutoConfiguration { public void checkTemplateLocationExists() { if (this.properties.isCheckTemplateLocation()) { TemplateLocation templatePathLocation = null; - List locations = new ArrayList(); + List locations = new ArrayList<>(); for (String templateLoaderPath : this.properties.getTemplateLoaderPath()) { TemplateLocation location = new TemplateLocation(templateLoaderPath); locations.add(location); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java index 2eec98d39f..e99c376ec9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -41,7 +41,7 @@ public class FreeMarkerProperties extends AbstractTemplateViewResolverProperties /** * Well-known FreeMarker keys which will be passed to FreeMarker's Configuration. */ - private Map settings = new HashMap(); + private Map settings = new HashMap<>(); /** * Comma-separated list of template paths. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.java index 4c121088a5..4a3cb9dd92 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.java @@ -64,7 +64,7 @@ public class H2ConsoleAutoConfiguration { public ServletRegistrationBean h2Console() { String path = this.properties.getPath(); String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*"); - ServletRegistrationBean registration = new ServletRegistrationBean( + ServletRegistrationBean registration = new ServletRegistrationBean<>( new WebServlet(), urlMapping); H2ConsoleProperties.Settings settings = this.properties.getSettings(); if (settings.isTrace()) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaHttpMessageConverterConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaHttpMessageConverterConfiguration.java index 2b61ee36bd..1a4536e67d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaHttpMessageConverterConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaHttpMessageConverterConfiguration.java @@ -81,7 +81,7 @@ public class HypermediaHttpMessageConverterConfiguration { private void configureHttpMessageConverter(HttpMessageConverter converter) { if (converter instanceof TypeConstrainedMappingJackson2HttpMessageConverter) { - List supportedMediaTypes = new ArrayList( + List supportedMediaTypes = new ArrayList<>( converter.getSupportedMediaTypes()); if (!supportedMediaTypes.contains(MediaType.APPLICATION_JSON)) { supportedMediaTypes.add(MediaType.APPLICATION_JSON); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java index 1ea0047f90..894cf077e6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -63,27 +63,27 @@ public class JacksonProperties { /** * Jackson on/off features that affect the way Java objects are serialized. */ - private Map serialization = new HashMap(); + private Map serialization = new HashMap<>(); /** * Jackson on/off features that affect the way Java objects are deserialized. */ - private Map deserialization = new HashMap(); + private Map deserialization = new HashMap<>(); /** * Jackson general purpose on/off features. */ - private Map mapper = new HashMap(); + private Map mapper = new HashMap<>(); /** * Jackson on/off features for parsers. */ - private Map parser = new HashMap(); + private Map parser = new HashMap<>(); /** * Jackson on/off features for generators. */ - private Map generator = new HashMap(); + private Map generator = new HashMap<>(); /** * Controls the inclusion of properties during serialization. Configured with one of diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilder.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilder.java index 3c65908125..8419d95c03 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilder.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ public class DataSourceBuilder { private ClassLoader classLoader; - private Map properties = new HashMap(); + private Map properties = new HashMap<>(); public static DataSourceBuilder create() { return new DataSourceBuilder(null); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java index 16e0debaa2..54e064851b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java @@ -134,7 +134,7 @@ class DataSourceInitializer implements ApplicationListener fallbackResources = new ArrayList(); + List fallbackResources = new ArrayList<>(); fallbackResources.add("classpath*:" + fallback + "-" + platform + ".sql"); fallbackResources.add("classpath*:" + fallback + ".sql"); return getResources(propertyName, fallbackResources, false); @@ -142,7 +142,7 @@ class DataSourceInitializer implements ApplicationListener getResources(String propertyName, List locations, boolean validate) { - List resources = new ArrayList(); + List resources = new ArrayList<>(); for (String location : locations) { for (Resource resource : doGetResources(location)) { if (resource.exists()) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java index 6b79062f89..f702187a21 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -486,7 +486,7 @@ public class DataSourceProperties /** * Properties to pass to the XA data source. */ - private Map properties = new LinkedHashMap(); + private Map properties = new LinkedHashMap<>(); public String getDataSourceClassName() { return this.dataSourceClassName; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProviders.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProviders.java index 73164134bf..ad954f23d0 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProviders.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProviders.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -43,7 +43,7 @@ public class DataSourcePoolMetadataProviders implements DataSourcePoolMetadataPr Collection providers) { this.providers = (providers == null ? Collections.emptyList() - : new ArrayList(providers)); + : new ArrayList<>(providers)); } @Override diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java index dcfc7c5b62..c1aac2457f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java @@ -135,7 +135,7 @@ public class JerseyAutoConfiguration implements ServletContextAware { @Bean @ConditionalOnMissingBean public FilterRegistrationBean requestContextFilter() { - FilterRegistrationBean registration = new FilterRegistrationBean(); + FilterRegistrationBean registration = new FilterRegistrationBean<>(); registration.setFilter(new RequestContextFilter()); registration.setOrder(this.jersey.getFilter().getOrder() - 1); registration.setName("requestContextFilter"); @@ -146,7 +146,7 @@ public class JerseyAutoConfiguration implements ServletContextAware { @ConditionalOnMissingBean(name = "jerseyFilterRegistration") @ConditionalOnProperty(prefix = "spring.jersey", name = "type", havingValue = "filter") public FilterRegistrationBean jerseyFilterRegistration() { - FilterRegistrationBean registration = new FilterRegistrationBean(); + FilterRegistrationBean registration = new FilterRegistrationBean<>(); registration.setFilter(new ServletContainer(this.config)); registration.setUrlPatterns(Arrays.asList(this.path)); registration.setOrder(this.jersey.getFilter().getOrder()); @@ -169,7 +169,7 @@ public class JerseyAutoConfiguration implements ServletContextAware { @ConditionalOnMissingBean(name = "jerseyServletRegistration") @ConditionalOnProperty(prefix = "spring.jersey", name = "type", havingValue = "servlet", matchIfMissing = true) public ServletRegistrationBean jerseyServletRegistration() { - ServletRegistrationBean registration = new ServletRegistrationBean( + ServletRegistrationBean registration = new ServletRegistrationBean<>( new ServletContainer(this.config), this.path); addInitParameters(registration); registration.setName(getServletRegistrationName()); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyProperties.java index 331fe6c7b1..4e0462499c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyProperties.java @@ -40,7 +40,7 @@ public class JerseyProperties { /** * Init parameters to pass to Jersey via the servlet or filter. */ - private Map init = new HashMap(); + private Map init = new HashMap<>(); private final Filter filter = new Filter(); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java index 6cd2fa7b1d..12aed79db9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -169,7 +169,7 @@ public class ActiveMQProperties { * Comma-separated list of specific packages to trust (when not trusting all * packages). */ - private List trusted = new ArrayList(); + private List trusted = new ArrayList<>(); public Boolean getTrustAll() { return this.trustAll; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java index ef155ef193..8e9d1ead0a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -124,7 +124,7 @@ class ArtemisConnectionFactoryFactory { private T createNativeConnectionFactory( Class factoryClass) throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.HOST_PROP_NAME, this.properties.getHost()); params.put(TransportConstants.PORT_PROP_NAME, this.properties.getPort()); TransportConfiguration transportConfiguration = new TransportConfiguration( diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisProperties.java index 6361809d89..3d16f3a7da 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -218,7 +218,7 @@ public class ArtemisProperties { * @see TransportConstants#SERVER_ID_PROP_NAME */ public Map generateTransportParameters() { - Map parameters = new HashMap(); + Map parameters = new HashMap<>(); parameters.put(TransportConstants.SERVER_ID_PROP_NAME, getServerId()); return parameters; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java index 2dcee99737..3fa765a1e2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -60,7 +60,7 @@ public class ParentAwareNamingStrategy extends MetadataNamingStrategy public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException { ObjectName name = super.getObjectName(managedBean, beanKey); - Hashtable properties = new Hashtable(); + Hashtable properties = new Hashtable<>(); properties.putAll(name.getKeyPropertyList()); if (this.ensureUniqueRuntimeObjectNames) { properties.put("identity", ObjectUtils.getIdentityHexString(managedBean)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaAnnotationDrivenConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaAnnotationDrivenConfiguration.java index 882119a60f..9abe319be3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaAnnotationDrivenConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaAnnotationDrivenConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,7 +54,7 @@ class KafkaAnnotationDrivenConfiguration { public ConcurrentKafkaListenerContainerFactory kafkaListenerContainerFactory( ConcurrentKafkaListenerContainerFactoryConfigurer configurer, ConsumerFactory kafkaConsumerFactory) { - ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory(); + ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); configurer.configure(factory, kafkaConsumerFactory); return factory; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfiguration.java index 92fad05211..be2481c38b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,7 +54,7 @@ public class KafkaAutoConfiguration { public KafkaTemplate kafkaTemplate( ProducerFactory kafkaProducerFactory, ProducerListener kafkaProducerListener) { - KafkaTemplate kafkaTemplate = new KafkaTemplate( + KafkaTemplate kafkaTemplate = new KafkaTemplate<>( kafkaProducerFactory); kafkaTemplate.setProducerListener(kafkaProducerListener); kafkaTemplate.setDefaultTopic(this.properties.getTemplate().getDefaultTopic()); @@ -64,20 +64,20 @@ public class KafkaAutoConfiguration { @Bean @ConditionalOnMissingBean(ProducerListener.class) public ProducerListener kafkaProducerListener() { - return new LoggingProducerListener(); + return new LoggingProducerListener<>(); } @Bean @ConditionalOnMissingBean(ConsumerFactory.class) public ConsumerFactory kafkaConsumerFactory() { - return new DefaultKafkaConsumerFactory( + return new DefaultKafkaConsumerFactory<>( this.properties.buildConsumerProperties()); } @Bean @ConditionalOnMissingBean(ProducerFactory.class) public ProducerFactory kafkaProducerFactory() { - return new DefaultKafkaProducerFactory( + return new DefaultKafkaProducerFactory<>( this.properties.buildProducerProperties()); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java index 356c9fbcd5..239d11344e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -53,7 +53,7 @@ public class KafkaProperties { * Comma-delimited list of host:port pairs to use for establishing the initial * connection to the Kafka cluster. */ - private List bootstrapServers = new ArrayList( + private List bootstrapServers = new ArrayList<>( Collections.singletonList("localhost:9092")); /** @@ -64,7 +64,7 @@ public class KafkaProperties { /** * Additional properties used to configure the client. */ - private Map properties = new HashMap(); + private Map properties = new HashMap<>(); private final Consumer consumer = new Consumer(); @@ -121,7 +121,7 @@ public class KafkaProperties { } private Map buildCommonProperties() { - Map properties = new HashMap(); + Map properties = new HashMap<>(); if (this.bootstrapServers != null) { properties.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, this.bootstrapServers); @@ -362,7 +362,7 @@ public class KafkaProperties { } public Map buildProperties() { - Map properties = new HashMap(); + Map properties = new HashMap<>(); if (this.autoCommitInterval != null) { properties.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, this.autoCommitInterval); @@ -562,7 +562,7 @@ public class KafkaProperties { } public Map buildProperties() { - Map properties = new HashMap(); + Map properties = new HashMap<>(); if (this.acks != null) { properties.put(ProducerConfig.ACKS_CONFIG, this.acks); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/LdapProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/LdapProperties.java index c2155866c2..d35611e173 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/LdapProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/LdapProperties.java @@ -58,7 +58,7 @@ public class LdapProperties { /** * LDAP specification settings. */ - private Map baseEnvironment = new HashMap(); + private Map baseEnvironment = new HashMap<>(); public String[] getUrls() { return this.urls; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java index 9b5aa7939e..1ecb8a922d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -94,9 +94,9 @@ public class ConditionEvaluationReportMessage { private Map orderByName( Map outcomes) { - Map result = new LinkedHashMap(); - List names = new ArrayList(); - Map classNames = new HashMap(); + Map result = new LinkedHashMap<>(); + List names = new ArrayList<>(); + Map classNames = new HashMap<>(); for (String name : outcomes.keySet()) { String shortName = ClassUtils.getShortName(name); names.add(shortName); @@ -120,8 +120,8 @@ public class ConditionEvaluationReportMessage { private void addNonMatchLogMessage(StringBuilder message, String source, ConditionAndOutcomes conditionAndOutcomes) { message.append(String.format("%n %s:%n", source)); - List matches = new ArrayList(); - List nonMatches = new ArrayList(); + List matches = new ArrayList<>(); + List nonMatches = new ArrayList<>(); for (ConditionAndOutcome conditionAndOutcome : conditionAndOutcomes) { if (conditionAndOutcome.getOutcome().isMatch()) { matches.add(conditionAndOutcome); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java index b8db99c6c7..2947de43e6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -68,7 +68,7 @@ public class MailProperties { /** * Additional JavaMail session properties. */ - private Map properties = new HashMap(); + private Map properties = new HashMap<>(); /** * Session JNDI name. When set, takes precedence to others mail settings. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java index ca72803405..c102d3d411 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java @@ -98,7 +98,7 @@ public class MongoClientFactory { if (options == null) { options = MongoClientOptions.builder().build(); } - List credentials = new ArrayList(); + List credentials = new ArrayList<>(); if (hasCustomCredentials()) { String database = this.properties.getAuthenticationDatabase() == null ? this.properties.getMongoClientDatabase() diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java index 898d6062f8..b929440378 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java @@ -99,7 +99,7 @@ public class ReactiveMongoClientFactory { Builder builder = builder(settings); if (hasCustomCredentials()) { - List credentials = new ArrayList(); + List credentials = new ArrayList<>(); String database = this.properties.getAuthenticationDatabase() == null ? this.properties.getMongoClientDatabase() : this.properties.getAuthenticationDatabase(); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoProperties.java index 9b6c1fd4b2..c20e42bfef 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -44,7 +44,7 @@ public class EmbeddedMongoProperties { /** * Comma-separated list of features to enable. */ - private Set features = new HashSet( + private Set features = new HashSet<>( Collections.singletonList(Feature.SYNC_DELAY)); public String getVersion() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java index ec4e9d4fd3..e99691dcca 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheEnvironmentCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ public class MustacheEnvironmentCollector extends DefaultCollector @Override public void setEnvironment(Environment environment) { this.environment = (ConfigurableEnvironment) environment; - this.target = new HashMap(); + this.target = new HashMap<>(); new RelaxedDataBinder(this.target).bind( new PropertySourcesPropertyValues(this.environment.getPropertySources())); this.propertyResolver = new RelaxedPropertyResolver(environment); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DatabaseLookup.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DatabaseLookup.java index 390c4f04ab..da593f8916 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DatabaseLookup.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DatabaseLookup.java @@ -43,7 +43,7 @@ final class DatabaseLookup { private static final Map LOOKUP; static { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(DatabaseDriver.DERBY, Database.DERBY); map.put(DatabaseDriver.H2, Database.H2); map.put(DatabaseDriver.HSQLDB, Database.HSQL); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java index 80204020a7..b8151e7d88 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -102,7 +102,7 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration { @Override protected Map getVendorProperties() { - Map vendorProperties = new LinkedHashMap(); + Map vendorProperties = new LinkedHashMap<>(); vendorProperties.putAll(getProperties().getHibernateProperties(getDataSource())); return vendorProperties; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java index 0921c6c73d..2368092ceb 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java @@ -42,7 +42,7 @@ public class JpaProperties { /** * Additional native properties to set on the JPA provider. */ - private Map properties = new HashMap(); + private Map properties = new HashMap<>(); /** * Name of the target database to operate on, auto-detected by default. Can be @@ -183,7 +183,7 @@ public class JpaProperties { private Map getAdditionalProperties(Map existing, DataSource dataSource) { - Map result = new HashMap(existing); + Map result = new HashMap<>(existing); applyNewIdGeneratorMappings(result); getNaming().applyNamingStrategies(result); String ddlAuto = getOrDeduceDdlAuto(existing, dataSource); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java index 0119557bb9..a718d695ff 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -173,7 +173,7 @@ public class AuthenticationManagerConfiguration { logger.info(String.format("%n%nUsing default security password: %s%n", user.getPassword())); } - Set roles = new LinkedHashSet(user.getRole()); + Set roles = new LinkedHashSet<>(user.getRole()); withUser(user.getName()).password(user.getPassword()) .roles(roles.toArray(new String[roles.size()])); setField(auth, "defaultUserDetailsService", getUserDetailsService()); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfiguration.java index 7528d68315..07b71541f8 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfiguration.java @@ -73,7 +73,7 @@ public class SecurityFilterAutoConfiguration { if (securityProperties.getFilterDispatcherTypes() == null) { return null; } - Set dispatcherTypes = new HashSet(); + Set dispatcherTypes = new HashSet<>(); for (String dispatcherType : securityProperties.getFilterDispatcherTypes()) { dispatcherTypes.add(DispatcherType.valueOf(dispatcherType)); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java index 7237afb6e5..fb64720c71 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java @@ -91,7 +91,7 @@ public class SecurityProperties implements SecurityPrerequisite { /** * Comma-separated list of paths to exclude from the default secured paths. */ - private List ignored = new ArrayList(); + private List ignored = new ArrayList<>(); private final User user = new User(); @@ -103,7 +103,7 @@ public class SecurityProperties implements SecurityPrerequisite { /** * Security filter chain dispatcher types. */ - private Set filterDispatcherTypes = new HashSet( + private Set filterDispatcherTypes = new HashSet<>( Arrays.asList("ASYNC", "ERROR", "REQUEST")); public Headers getHeaders() { @@ -147,7 +147,7 @@ public class SecurityProperties implements SecurityPrerequisite { } public void setIgnored(List ignored) { - this.ignored = new ArrayList(ignored); + this.ignored = new ArrayList<>(ignored); } public List getIgnored() { @@ -357,7 +357,7 @@ public class SecurityProperties implements SecurityPrerequisite { /** * Granted roles for the default user name. */ - private List role = new ArrayList(Arrays.asList("USER")); + private List role = new ArrayList<>(Arrays.asList("USER")); private boolean defaultPassword = true; @@ -387,7 +387,7 @@ public class SecurityProperties implements SecurityPrerequisite { } public void setRole(List role) { - this.role = new ArrayList(role); + this.role = new ArrayList<>(role); } public boolean isDefaultPassword() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java index a4f6e5a417..20566cbbc9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java @@ -190,7 +190,7 @@ public class SpringBootWebSecurityConfiguration { ignored.add(normalizePath(this.errorController.getErrorPath())); } String[] paths = this.server.getServlet().getPathsArray(ignored); - List matchers = new ArrayList(); + List matchers = new ArrayList<>(); if (!ObjectUtils.isEmpty(paths)) { for (String pattern : paths) { matchers.add(new AntPathRequestMatcher(pattern, null)); @@ -202,7 +202,7 @@ public class SpringBootWebSecurityConfiguration { } private List getIgnored(SecurityProperties security) { - List ignored = new ArrayList(security.getIgnored()); + List ignored = new ArrayList<>(security.getIgnored()); if (ignored.isEmpty()) { ignored.addAll(DEFAULT_IGNORED); } @@ -282,7 +282,7 @@ public class SpringBootWebSecurityConfiguration { } private String[] getSecureApplicationPaths() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (String path : this.security.getBasic().getPath()) { path = (path == null ? "" : path.trim()); if (path.equals("/**")) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java index 48ac21a515..929a6af72f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java @@ -97,7 +97,7 @@ public class OAuth2RestOperationsConfiguration { @Bean public FilterRegistrationBean oauth2ClientFilterRegistration( OAuth2ClientContextFilter filter, SecurityProperties security) { - FilterRegistrationBean registration = new FilterRegistrationBean(); + FilterRegistrationBean registration = new FilterRegistrationBean<>(); registration.setFilter(filter); registration.setOrder(security.getFilterOrder() - 10); return registration; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/FixedAuthoritiesExtractor.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/FixedAuthoritiesExtractor.java index 9d16dae9a9..fdb3468d93 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/FixedAuthoritiesExtractor.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/FixedAuthoritiesExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ public class FixedAuthoritiesExtractor implements AuthoritiesExtractor { } private String asAuthorities(Object object) { - List authorities = new ArrayList(); + List authorities = new ArrayList<>(); if (object instanceof Collection) { Collection collection = (Collection) object; object = collection.toArray(new Object[0]); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java index 7e1504ad82..e4da42c3df 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java @@ -315,7 +315,7 @@ public class ResourceServerTokenServicesConfiguration { byte[] token = Base64.encode((username + ":" + password).getBytes()); headers.add("Authorization", "Basic " + new String(token)); } - HttpEntity request = new HttpEntity(headers); + HttpEntity request = new HttpEntity<>(headers); String url = this.resource.getJwt().getKeyUri(); return (String) keyUriRestTemplate .exchange(url, HttpMethod.GET, request, Map.class).getBody() diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.java index ad0b75dade..286226fae5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.java @@ -38,7 +38,7 @@ class SessionRepositoryFilterConfiguration { @Bean public FilterRegistrationBean> sessionRepositoryFilterRegistration( SessionRepositoryFilter filter) { - FilterRegistrationBean> registration = new FilterRegistrationBean>( + FilterRegistrationBean> registration = new FilterRegistrationBean<>( filter); registration.setDispatcherTypes(EnumSet.of(DispatcherType.ASYNC, DispatcherType.ERROR, DispatcherType.REQUEST)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java index b2fa12b417..cae44137ac 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ final class SessionStoreMappings { private static final Map> MAPPINGS; static { - Map> mappings = new HashMap>(); + Map> mappings = new HashMap<>(); mappings.put(StoreType.REDIS, RedisSessionConfiguration.class); mappings.put(StoreType.MONGO, MongoSessionConfiguration.class); mappings.put(StoreType.JDBC, JdbcSessionConfiguration.class); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java index acc0cd6c5c..4e2b937213 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -102,7 +102,7 @@ public abstract class AbstractViewResolverProperties { public MimeType getContentType() { if (this.contentType.getCharset() == null) { - Map parameters = new LinkedHashMap(); + Map parameters = new LinkedHashMap<>(); parameters.put("charset", this.charset.name()); parameters.putAll(this.contentType.getParameters()); return new MimeType(this.contentType, parameters); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java index 39ecd7ee34..9b073f5409 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -49,7 +49,7 @@ public class TemplateAvailabilityProviders { /** * Resolved template views, returning already cached instances without a global lock. */ - private final Map resolved = new ConcurrentHashMap( + private final Map resolved = new ConcurrentHashMap<>( CACHE_LIMIT); /** @@ -96,7 +96,7 @@ public class TemplateAvailabilityProviders { protected TemplateAvailabilityProviders( Collection providers) { Assert.notNull(providers, "Providers must not be null"); - this.providers = new ArrayList(providers); + this.providers = new ArrayList<>(providers); } /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java index 919ef830d4..3110c7cd17 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java @@ -159,7 +159,7 @@ public class ThymeleafAutoConfiguration { if (type.getCharset() != null) { return type.toString(); } - LinkedHashMap parameters = new LinkedHashMap(); + LinkedHashMap parameters = new LinkedHashMap<>(); parameters.put("charset", charset); parameters.putAll(type.getParameters()); return new MimeType(type, parameters).toString(); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java index 6c5ab3a0a6..65b54868b1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java @@ -41,8 +41,7 @@ public class TransactionManagerCustomizers { public TransactionManagerCustomizers( Collection> customizers) { - this.customizers = (customizers == null ? null - : new ArrayList>(customizers)); + this.customizers = (customizers == null ? null : new ArrayList<>(customizers)); } public void customize(PlatformTransactionManager transactionManager) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/AbstractErrorController.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/AbstractErrorController.java index 20fa52d83e..4de3f83547 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/AbstractErrorController.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/AbstractErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -58,7 +58,7 @@ public abstract class AbstractErrorController implements ErrorController { private List sortErrorViewResolvers( List resolvers) { - List sorted = new ArrayList(); + List sorted = new ArrayList<>(); if (resolvers != null) { sorted.addAll(resolvers); AnnotationAwareOrderComparator.sortIfNecessary(sorted); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/BasicErrorController.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/BasicErrorController.java index 41363125d1..688abdd2a1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/BasicErrorController.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/BasicErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -99,7 +99,7 @@ public class BasicErrorController extends AbstractErrorController { Map body = getErrorAttributes(request, isIncludeStackTrace(request, MediaType.ALL)); HttpStatus status = getStatus(request); - return new ResponseEntity>(body, status); + return new ResponseEntity<>(body, status); } /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java index 05a0d08632..fc501adb06 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -83,7 +83,7 @@ public class DefaultErrorAttributes @Override public Map getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) { - Map errorAttributes = new LinkedHashMap(); + Map errorAttributes = new LinkedHashMap<>(); errorAttributes.put("timestamp", new Date()); addStatus(errorAttributes, requestAttributes); addErrorDetails(errorAttributes, requestAttributes, includeStackTrace); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewResolver.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewResolver.java index c481ff290b..6bbc4c3195 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewResolver.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 DefaultErrorViewResolver implements ErrorViewResolver, Ordered { private static final Map SERIES_VIEWS; static { - Map views = new HashMap(); + Map views = new HashMap<>(); views.put(Series.CLIENT_ERROR, "4xx"); views.put(Series.SERVER_ERROR, "5xx"); SERIES_VIEWS = Collections.unmodifiableMap(views); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java index 7f76cff58c..1c799f4b22 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java @@ -138,7 +138,7 @@ public class DispatcherServletAutoConfiguration { @ConditionalOnBean(value = DispatcherServlet.class, name = DEFAULT_DISPATCHER_SERVLET_BEAN_NAME) public ServletRegistrationBean dispatcherServletRegistration( DispatcherServlet dispatcherServlet) { - ServletRegistrationBean registration = new ServletRegistrationBean( + ServletRegistrationBean registration = new ServletRegistrationBean<>( dispatcherServlet, this.serverProperties.getServlet().getServletMapping()); registration.setName(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java index 8e99b1cb0f..a0876816b6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java @@ -221,7 +221,7 @@ public class ErrorMvcAutoConfiguration { if (response.getContentType() == null) { response.setContentType(getContentType()); } - Map map = new HashMap(model); + Map map = new HashMap<>(model); map.put("path", request.getContextPath()); PlaceholderResolver resolver = new ExpressionResolver(getExpressions(), map); String result = this.helper.replacePlaceholders(this.template, resolver); @@ -248,7 +248,7 @@ public class ErrorMvcAutoConfiguration { private final SpelExpressionParser parser = new SpelExpressionParser(); - private final Map expressions = new HashMap(); + private final Map expressions = new HashMap<>(); @Override public String resolvePlaceholder(String name) { @@ -309,8 +309,9 @@ public class ErrorMvcAutoConfiguration { @Override public void registerErrorPages(ErrorPageRegistry errorPageRegistry) { - ErrorPage errorPage = new ErrorPage(this.properties.getServlet().getServletPrefix() - + this.properties.getError().getPath()); + ErrorPage errorPage = new ErrorPage( + this.properties.getServlet().getServletPrefix() + + this.properties.getError().getPath()); errorPageRegistry.addErrorPages(errorPage); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java index c5b9606432..7b1fea9250 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 HttpMessageConverters implements Iterable> private static final List> NON_REPLACING_CONVERTERS; static { - List> nonReplacingConverters = new ArrayList>(); + List> nonReplacingConverters = new ArrayList<>(); addClassIfExists(nonReplacingConverters, "org.springframework.hateoas.mvc." + "TypeConstrainedMappingJackson2HttpMessageConverter"); NON_REPLACING_CONVERTERS = Collections.unmodifiableList(nonReplacingConverters); @@ -112,9 +112,8 @@ public class HttpMessageConverters implements Iterable> private List> getCombinedConverters( Collection> converters, List> defaultConverters) { - List> combined = new ArrayList>(); - List> processing = new ArrayList>( - converters); + List> combined = new ArrayList<>(); + List> processing = new ArrayList<>(converters); for (HttpMessageConverter defaultConverter : defaultConverters) { Iterator> iterator = processing.iterator(); while (iterator.hasNext()) { @@ -191,7 +190,7 @@ public class HttpMessageConverters implements Iterable> } private List> getDefaultConverters() { - List> converters = new ArrayList>(); + List> converters = new ArrayList<>(); if (ClassUtils.isPresent("org.springframework.web.servlet.config.annotation." + "WebMvcConfigurationSupport", null)) { converters.addAll(new WebMvcConfigurationSupport() { @@ -208,7 +207,7 @@ public class HttpMessageConverters implements Iterable> } private void reorderXmlConvertersToEnd(List> converters) { - List> xml = new ArrayList>(); + List> xml = new ArrayList<>(); for (Iterator> iterator = converters.iterator(); iterator .hasNext();) { HttpMessageConverter converter = iterator.next(); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java index 71080b136b..ef312d53e3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java @@ -118,8 +118,7 @@ public class ResourceProperties implements ResourceLoaderAware { } List getFaviconLocations() { - List locations = new ArrayList( - this.staticLocations.length + 1); + List locations = new ArrayList<>(this.staticLocations.length + 1); if (this.resourceLoader != null) { for (String location : this.staticLocations) { locations.add(this.resourceLoader.getResource(location)); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index e2296b2ec4..891b3a4676 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -481,7 +481,7 @@ public class ServerProperties { * scanning. The special '?' and '*' characters can be used in the pattern to * match one and only one character and zero or more characters respectively. */ - private List additionalTldSkipPatterns = new ArrayList(); + private List additionalTldSkipPatterns = new ArrayList<>(); public int getMaxThreads() { return this.maxThreads; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebClientAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebClientAutoConfiguration.java index 61160b0460..74c0ee600e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebClientAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebClientAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -69,7 +69,7 @@ public class WebClientAutoConfiguration { List customizers = this.restTemplateCustomizers .getIfAvailable(); if (!CollectionUtils.isEmpty(customizers)) { - customizers = new ArrayList(customizers); + customizers = new ArrayList<>(customizers); AnnotationAwareOrderComparator.sort(customizers); builder = builder.customizers(customizers); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcProperties.java index 17c1eb6cbe..18c50d7d2c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcProperties.java @@ -86,7 +86,7 @@ public class WebMvcProperties { /** * Maps file extensions to media types for content negotiation, e.g. yml->text/yaml. */ - private Map mediaTypes = new LinkedHashMap(); + private Map mediaTypes = new LinkedHashMap<>(); /** * Path pattern used for static resources. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java index 9bd698422a..9d8840cff3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java @@ -62,7 +62,7 @@ public class WebServicesAutoConfiguration { servlet.setApplicationContext(applicationContext); String path = this.properties.getPath(); String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*"); - ServletRegistrationBean registration = new ServletRegistrationBean( + ServletRegistrationBean registration = new ServletRegistrationBean<>( servlet, urlMapping); WebServicesProperties.Servlet servletProperties = this.properties.getServlet(); registration.setLoadOnStartup(servletProperties.getLoadOnStartup()); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesProperties.java index 4f26ef282f..1379170d4e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesProperties.java @@ -59,7 +59,7 @@ public class WebServicesProperties { /** * Servlet init parameters to pass to Spring Web Services. */ - private Map init = new HashMap(); + private Map init = new HashMap<>(); /** * Load on startup priority of the Spring Web Services servlet. diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java index a84b28b29b..0c8804055b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java @@ -59,7 +59,7 @@ public class AutoConfigurationImportSelectorTests { private final MockEnvironment environment = new MockEnvironment(); - private List filters = new ArrayList(); + private List filters = new ArrayList<>(); @Rule public ExpectedException expected = ExpectedException.none(); @@ -269,7 +269,7 @@ public class AutoConfigurationImportSelectorTests { private static class TestAutoConfigurationImportFilter implements AutoConfigurationImportFilter, BeanFactoryAware { - private final Set nonMatching = new HashSet(); + private final Set nonMatching = new HashSet<>(); private BeanFactory beanFactory; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java index 3536492ee3..6d2b009c1a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationSorterTests.java @@ -183,7 +183,7 @@ public class AutoConfigurationSorterTests { } private String merge(Class[] value, String[] name) { - Set items = new LinkedHashSet(); + Set items = new LinkedHashSet<>(); for (Class type : value) { items.add(type.getName()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationTests.java index 047bdacfc5..aaf8e8cc3b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -61,7 +61,7 @@ public class ImportAutoConfigurationTests { config); String shortName = ClassUtils.getShortName(ImportAutoConfigurationTests.class); int beginIndex = shortName.length() + 1; - List orderedConfigBeans = new ArrayList(); + List orderedConfigBeans = new ArrayList<>(); for (String bean : context.getBeanDefinitionNames()) { if (bean.contains("$Config")) { String shortBeanName = ClassUtils.getShortName(bean); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java index 5ec9dc5ca9..001b571269 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java @@ -637,7 +637,7 @@ public class CacheAutoConfigurationTests { String... expectedCustomizerNames) { load(config, "spring.cache.type=" + cacheType); CacheManager cacheManager = validateCacheManager(CacheManager.class); - List expected = new ArrayList(); + List expected = new ArrayList<>(); expected.addAll(Arrays.asList(expectedCustomizerNames)); Map map = this.context .getBeansOfType(CacheManagerTestCustomizer.class); @@ -787,7 +787,7 @@ public class CacheAutoConfigurationTests { return new JCacheManagerCustomizer() { @Override public void customize(javax.cache.CacheManager cacheManager) { - MutableConfiguration config = new MutableConfiguration(); + MutableConfiguration config = new MutableConfiguration<>(); config.setExpiryPolicyFactory( CreatedExpiryPolicy.factoryOf(Duration.TEN_MINUTES)); config.setStatisticsEnabled(true); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizersTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizersTests.java index 86f7c7ceff..fc89bee731 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizersTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -51,8 +51,8 @@ public class CacheManagerCustomizersTests { @Test public void customizeShouldCheckGeneric() throws Exception { - List> list = new ArrayList>(); - list.add(new TestCustomizer()); + List> list = new ArrayList<>(); + list.add(new TestCustomizer<>()); list.add(new TestConcurrentMapCacheManagerCustomizer()); CacheManagerCustomizers customizers = new CacheManagerCustomizers(list); customizers.customize(mock(CacheManager.class)); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/support/MockCachingProvider.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/support/MockCachingProvider.java index dde52959de..63d9b500de 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/support/MockCachingProvider.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/support/MockCachingProvider.java @@ -50,7 +50,7 @@ public class MockCachingProvider implements CachingProvider { CacheManager cacheManager = mock(CacheManager.class); given(cacheManager.getURI()).willReturn(uri); given(cacheManager.getClassLoader()).willReturn(classLoader); - final Map caches = new HashMap(); + final Map caches = new HashMap<>(); given(cacheManager.getCacheNames()).willReturn(caches.keySet()); given(cacheManager.getCache(anyString())).willAnswer(new Answer() { @Override diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cloud/CloudAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cloud/CloudAutoConfigurationTests.java index e6ef1a6c17..5ad7be002e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cloud/CloudAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cloud/CloudAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -42,7 +42,7 @@ public class CloudAutoConfigurationTests { public void testOrder() throws Exception { TestAutoConfigurationSorter sorter = new TestAutoConfigurationSorter( new CachingMetadataReaderFactory()); - Collection classNames = new ArrayList(); + Collection classNames = new ArrayList<>(); classNames.add(MongoAutoConfiguration.class.getName()); classNames.add(DataSourceAutoConfiguration.class.getName()); classNames.add(MongoRepositoriesAutoConfiguration.class.getName()); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java index e0378993bb..1f05f8a071 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -212,7 +212,7 @@ public class ConditionEvaluationReportTests { assertThat(outcomes).isNotEqualTo(nullValue()); assertThat(getNumberOfOutcomes(outcomes)).isEqualTo(2); - List messages = new ArrayList(); + List messages = new ArrayList<>(); for (ConditionAndOutcome outcome : outcomes) { messages.add(outcome.getOutcome().getMessage()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java index fec1496fff..eea9e1d183 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionMessageTests.java @@ -98,7 +98,7 @@ public class ConditionMessageTests { @Test public void ofCollectionShouldCombine() throws Exception { - List messages = new ArrayList(); + List messages = new ArrayList<>(); messages.add(ConditionMessage.of("a")); messages.add(ConditionMessage.of("b")); ConditionMessage message = ConditionMessage.of(messages); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJndiTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJndiTests.java index 73b026face..7d3c4e104f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJndiTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnJndiTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -142,7 +142,7 @@ public class ConditionalOnJndiTests { private AnnotatedTypeMetadata mockMetaData(String... value) { AnnotatedTypeMetadata metadata = mock(AnnotatedTypeMetadata.class); - Map attributes = new HashMap(); + Map attributes = new HashMap<>(); attributes.put("value", value); given(metadata.getAnnotationAttributes(ConditionalOnJndi.class.getName())) .willReturn(attributes); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java index 521e759cde..d06dc9c0e6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -156,7 +156,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests { @Override public String[] selectImports(AnnotationMetadata importingClassMetadata) { - List names = new ArrayList(); + List names = new ArrayList<>(); for (Class type : new Class[] { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, JpaRepositoriesAutoConfiguration.class, MongoAutoConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/ReactiveAndBlockingMongoRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/ReactiveAndBlockingMongoRepositoriesAutoConfigurationTests.java index a32235908b..9e423a9630 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/ReactiveAndBlockingMongoRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/ReactiveAndBlockingMongoRepositoriesAutoConfigurationTests.java @@ -85,7 +85,7 @@ public class ReactiveAndBlockingMongoRepositoriesAutoConfigurationTests { @Override public String[] selectImports(AnnotationMetadata importingClassMetadata) { - List names = new ArrayList(); + List names = new ArrayList<>(); for (Class type : new Class[] { MongoAutoConfiguration.class, ReactiveMongoAutoConfiguration.class, MongoDataAutoConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/MixedNeo4jRepositoriesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/MixedNeo4jRepositoriesAutoConfigurationTests.java index 821b791c24..241d006c16 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/MixedNeo4jRepositoriesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/MixedNeo4jRepositoriesAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -155,7 +155,7 @@ public class MixedNeo4jRepositoriesAutoConfigurationTests { @Override public String[] selectImports(AnnotationMetadata importingClassMetadata) { - List names = new ArrayList(); + List names = new ArrayList<>(); for (Class type : new Class[] { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, JpaRepositoriesAutoConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java index e40398186b..2d3c093fc8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -227,7 +227,7 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests { Class... classes) { ConditionEvaluationReport report = (ConditionEvaluationReport) new DirectFieldAccessor( analyzer).getPropertyValue("report"); - List exclusions = new ArrayList(report.getExclusions()); + List exclusions = new ArrayList<>(report.getExclusions()); for (Class c : classes) { exclusions.add(c.getName()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java index e12924b361..cdc9583406 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -112,7 +112,7 @@ public class JestAutoConfigurationTests { "spring.data.elasticsearch.properties.http.port:" + port, "spring.elasticsearch.jest.uris:http://localhost:" + port); JestClient client = this.context.getBean(JestClient.class); - Map source = new HashMap(); + Map source = new HashMap<>(); source.put("a", "alpha"); source.put("b", "bravo"); Index index = new Index.Builder(source).index("foo").type("bar").build(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java index 4a0658c57f..a02e2e09f0 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java @@ -324,7 +324,7 @@ public class FlywayAutoConfigurationTests { @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("configured", "manually"); properties.put("hibernate.transaction.jta.platform", NoJtaPlatform.INSTANCE); return new EntityManagerFactoryBuilder(new HibernateJpaVendorAdapter(), diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java index b608a98e97..d4184569ce 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -588,7 +588,7 @@ public class JacksonAutoConfigurationTests { private static class CustomModule extends SimpleModule { - private Set owners = new HashSet(); + private Set owners = new HashSet<>(); @Override public void setupModule(SetupContext context) { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java index 60bf306a41..10b1a91f31 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJsonSerializationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -109,7 +109,7 @@ public class DataSourceJsonSerializationTests { @Override public List changeProperties(SerializationConfig config, BeanDescription beanDesc, List beanProperties) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (BeanPropertyWriter writer : beanProperties) { AnnotatedMethod setter = beanDesc.findMethod( "set" + StringUtils.capitalize(writer.getName()), diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/TestableInitialContextFactory.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/TestableInitialContextFactory.java index 7f8241f973..ee647430a7 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/TestableInitialContextFactory.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/TestableInitialContextFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -66,7 +66,7 @@ public class TestableInitialContextFactory implements InitialContextFactory { private final static class TestableContext extends InitialContext { - private final Map bindings = new HashMap(); + private final Map bindings = new HashMap<>(); private TestableContext() throws NamingException { super(true); @@ -84,8 +84,8 @@ public class TestableInitialContextFactory implements InitialContextFactory { @Override public Hashtable getEnvironment() throws NamingException { - return new Hashtable(); // Used to detect if JNDI is - // available + return new Hashtable<>(); // Used to detect if JNDI is + // available } public void clearAll() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java index baf64d4d98..b76f38e6e6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializerTests.java @@ -60,15 +60,15 @@ import static org.mockito.Mockito.mock; */ public class AutoConfigurationReportLoggingInitializerTests { - private static ThreadLocal logThreadLocal = new ThreadLocal(); + private static ThreadLocal logThreadLocal = new ThreadLocal<>(); private Log log; private AutoConfigurationReportLoggingInitializer initializer; - protected List debugLog = new ArrayList(); + protected List debugLog = new ArrayList<>(); - protected List infoLog = new ArrayList(); + protected List infoLog = new ArrayList<>(); @Before public void setup() { @@ -171,8 +171,8 @@ public class AutoConfigurationReportLoggingInitializerTests { } // Just basic sanity check, test is for visual inspection String l = this.debugLog.get(0); - assertThat(l).contains( - "not a servlet web application (OnWebApplicationCondition)"); + assertThat(l) + .contains("not a servlet web application (OnWebApplicationCondition)"); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java index b17ed35299..6d20f55c21 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java @@ -127,9 +127,9 @@ public class DeviceResolverAutoConfigurationTests { @RequestMapping("/") public ResponseEntity test(Device device) { if (device.getDevicePlatform() != null) { - return new ResponseEntity(HttpStatus.OK); + return new ResponseEntity<>(HttpStatus.OK); } - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java index e72bf34a49..ac92adb02b 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java @@ -77,7 +77,7 @@ public class MustacheWebIntegrationTests { public void contextLoads() { String source = "Hello {{arg}}!"; Template tmpl = Mustache.compiler().compile(source); - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("arg", "world"); assertThat(tmpl.execute(context)).isEqualTo("Hello world!"); // returns "Hello // world!" diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java index 6a66bc0a98..84f5b3fa81 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java @@ -239,7 +239,7 @@ public abstract class AbstractJpaAutoConfigurationTests { factoryBean.setJpaVendorAdapter(adapter); factoryBean.setDataSource(dataSource); factoryBean.setPersistenceUnitName("manually-configured"); - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("configured", "manually"); properties.put("hibernate.transaction.jta.platform", NoJtaPlatform.INSTANCE); factoryBean.setJpaPropertyMap(properties); @@ -259,7 +259,7 @@ public abstract class AbstractJpaAutoConfigurationTests { factoryBean.setJpaVendorAdapter(adapter); factoryBean.setDataSource(dataSource); factoryBean.setPersistenceUnitName("manually-configured"); - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("configured", "manually"); properties.put("hibernate.transaction.jta.platform", NoJtaPlatform.INSTANCE); factoryBean.setJpaPropertyMap(properties); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java index b032dbecb7..2b0c080d58 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -80,7 +80,7 @@ public class SecurityPropertiesTests { @Test public void testBindingIgnoredMultiValuedList() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("security.ignored[0]", "/css/**"); map.put("security.ignored[1]", "/foo/**"); this.binder.bind(new MutablePropertyValues(map)); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java index 789cf47221..8e1d9f835a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java @@ -173,14 +173,14 @@ public class SpringBootWebSecurityConfigurationTests { TestRestTemplate rest = new TestRestTemplate(); // not overriding causes forbidden - MultiValueMap form = new LinkedMultiValueMap(); + MultiValueMap form = new LinkedMultiValueMap<>(); ResponseEntity result = rest .postForEntity("http://localhost:" + port + "/", form, Object.class); assertThat(result.getStatusCode()).isEqualTo(HttpStatus.FORBIDDEN); // override method with GET - form = new LinkedMultiValueMap(); + form = new LinkedMultiValueMap<>(); form.add("_method", "GET"); result = rest.postForEntity("http://localhost:" + port + "/", form, Object.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java index 46f5b07a07..acfb606ecc 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java @@ -419,8 +419,7 @@ public class OAuth2AutoConfigurationTests { HttpHeaders headers = getHeaders(config); String url = baseUrl + "/oauth/token"; JsonNode tokenResponse = rest.postForObject(url, - new HttpEntity>(getBody(), headers), - JsonNode.class); + new HttpEntity<>(getBody(), headers), JsonNode.class); String authorizationToken = tokenResponse.findValue("access_token").asText(); String tokenType = tokenResponse.findValue("token_type").asText(); String scope = tokenResponse.findValues("scope").get(0).toString(); @@ -448,7 +447,7 @@ public class OAuth2AutoConfigurationTests { } private MultiValueMap getBody() { - MultiValueMap body = new LinkedMultiValueMap(); + MultiValueMap body = new LinkedMultiValueMap<>(); body.set("grant_type", "password"); body.set("username", "foo"); body.set("password", "bar"); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/FixedAuthoritiesExtractorTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/FixedAuthoritiesExtractorTests.java index 9fcc717036..8152f628ef 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/FixedAuthoritiesExtractorTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/FixedAuthoritiesExtractorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -35,7 +35,7 @@ public class FixedAuthoritiesExtractorTests { private FixedAuthoritiesExtractor extractor = new FixedAuthoritiesExtractor(); - private Map map = new LinkedHashMap(); + private Map map = new LinkedHashMap<>(); @Test public void authorities() { @@ -75,7 +75,7 @@ public class FixedAuthoritiesExtractorTests { @Test public void authoritiesAsListOfMapsWithStandardKey() { - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); map.put("role", "ROLE_ADMIN"); map.put("extra", "value"); this.map.put("authorities", Arrays.asList(map)); @@ -93,7 +93,7 @@ public class FixedAuthoritiesExtractorTests { @Test public void authoritiesAsListOfMapsWithMultipleNonStandardKeys() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("any", "ROLE_ADMIN"); map.put("foo", "bar"); this.map.put("authorities", Arrays.asList(map)); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java index fceac6d7b4..72c5830b46 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java @@ -61,7 +61,7 @@ import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -177,8 +177,8 @@ public class ResourceServerTokenServicesConfigurationTests { "security.oauth2.resource.tokenInfoUri:http://example.com", "security.oauth2.resource.preferTokenInfo:false"); this.context = new SpringApplicationBuilder(ResourceConfiguration.class, - Customizer.class).environment(this.environment).web(WebApplicationType.NONE) - .run(); + Customizer.class).environment(this.environment) + .web(WebApplicationType.NONE).run(); UserInfoTokenServices services = this.context .getBean(UserInfoTokenServices.class); assertThat(services).isNotNull(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java index fde700bdf9..4ac1457cb9 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesTests.java @@ -57,7 +57,7 @@ public class UserInfoTokenServicesTests { private OAuth2RestOperations template = mock(OAuth2RestOperations.class); - private Map map = new LinkedHashMap(); + private Map map = new LinkedHashMap<>(); @SuppressWarnings("rawtypes") @Before diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java index dd3d37d726..3124aaefaf 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -42,8 +42,8 @@ public class TransactionManagerCustomizersTests { @Test public void customizeShouldCheckGeneric() throws Exception { - List> list = new ArrayList>(); - list.add(new TestCustomizer()); + List> list = new ArrayList<>(); + list.add(new TestCustomizer<>()); list.add(new TestJtaCustomizer()); TransactionManagerCustomizers customizers = new TransactionManagerCustomizers( list); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java index a0b567d175..78ac6df9ae 100755 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -203,7 +203,7 @@ public class BasicErrorControllerIntegrationTests { } private void load(String... arguments) { - List args = new ArrayList(); + List args = new ArrayList<>(); args.add("--server.port=0"); if (arguments != null) { args.addAll(Arrays.asList(arguments)); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewResolverTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewResolverTests.java index 9bd27b176c..c15146fdc8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewResolverTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewResolverTests.java @@ -68,7 +68,7 @@ public class DefaultErrorViewResolverTests { private ResourceProperties resourceProperties; - private Map model = new HashMap(); + private Map model = new HashMap<>(); private HttpServletRequest request = new MockHttpServletRequest(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizerIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizerIntegrationTests.java index 4fa9a3e681..515731c890 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizerIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizerIntegrationTests.java @@ -156,7 +156,8 @@ public class DefaultServletContainerCustomizerIntegrationTests { protected static class Config { @Bean - public DefaultServletContainerCustomizer defaultServletContainerCustomizer(ServerProperties properties) { + public DefaultServletContainerCustomizer defaultServletContainerCustomizer( + ServerProperties properties) { return new DefaultServletContainerCustomizer(properties); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizerTests.java index 8f01d7d346..ad23a0a66f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultServletContainerCustomizerTests.java @@ -84,7 +84,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void tomcatAccessLogCanBeEnabled() { TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory(); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.accesslog.enabled", "true"); bindProperties(map); this.customizer.customize(tomcatContainer); @@ -96,7 +96,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void tomcatAccessLogIsBufferedByDefault() { TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory(); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.accesslog.enabled", "true"); bindProperties(map); this.customizer.customize(tomcatContainer); @@ -107,7 +107,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void tomcatAccessLogBufferingCanBeDisabled() { TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory(); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.accesslog.enabled", "true"); map.put("server.tomcat.accesslog.buffered", "false"); bindProperties(map); @@ -118,7 +118,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void redirectContextRootCanBeConfigured() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.redirect-context-root", "false"); bindProperties(map); ServerProperties.Tomcat tomcat = this.properties.getTomcat(); @@ -160,7 +160,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void customizeSessionProperties() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.session.timeout", "123"); map.put("server.session.tracking-modes", "cookie,url"); map.put("server.session.cookie.name", "testname"); @@ -201,7 +201,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void customizeTomcatDisplayName() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.display-name", "MyBootApp"); bindProperties(map); TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(); @@ -211,7 +211,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void disableTomcatRemoteIpValve() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.remote_ip_header", ""); map.put("server.tomcat.protocol_header", ""); bindProperties(map); @@ -227,12 +227,12 @@ public class DefaultServletContainerCustomizerTests { assertThat( ((TomcatEmbeddedServletContainer) container.getEmbeddedServletContainer()) .getTomcat().getEngine().getBackgroundProcessorDelay()) - .isEqualTo(30); + .isEqualTo(30); } @Test public void customTomcatBackgroundProcessorDelay() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.background-processor-delay", "5"); bindProperties(map); TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(); @@ -240,12 +240,12 @@ public class DefaultServletContainerCustomizerTests { assertThat( ((TomcatEmbeddedServletContainer) container.getEmbeddedServletContainer()) .getTomcat().getEngine().getBackgroundProcessorDelay()) - .isEqualTo(5); + .isEqualTo(5); } @Test public void defaultTomcatRemoteIpValve() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); // Since 1.1.7 you need to specify at least the protocol map.put("server.tomcat.protocol_header", "X-Forwarded-Proto"); map.put("server.tomcat.remote_ip_header", "X-Forwarded-For"); @@ -288,7 +288,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void customTomcatRemoteIpValve() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.remote_ip_header", "x-my-remote-ip-header"); map.put("server.tomcat.protocol_header", "x-my-protocol-header"); map.put("server.tomcat.internal_proxies", "192.168.0.1"); @@ -310,7 +310,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void customTomcatAcceptCount() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.accept-count", "10"); bindProperties(map); TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory( @@ -330,7 +330,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void customTomcatMaxConnections() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.max-connections", "5"); bindProperties(map); TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory( @@ -350,7 +350,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void customTomcatMaxHttpPostSize() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.max-http-post-size", "10000"); bindProperties(map); TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory( @@ -370,7 +370,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void customizeUndertowAccessLog() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.undertow.accesslog.enabled", "true"); map.put("server.undertow.accesslog.pattern", "foo"); map.put("server.undertow.accesslog.prefix", "test_log"); @@ -391,7 +391,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void testCustomizeTomcatMinSpareThreads() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.min-spare-threads", "10"); bindProperties(map); assertThat(this.properties.getTomcat().getMinSpareThreads()).isEqualTo(10); @@ -399,7 +399,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void customTomcatTldSkip() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.additional-tld-skip-patterns", "foo.jar,bar.jar"); bindProperties(map); testCustomTomcatTldSkip("foo.jar", "bar.jar"); @@ -407,7 +407,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void customTomcatTldSkipAsList() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.additional-tld-skip-patterns[0]", "biz.jar"); map.put("server.tomcat.additional-tld-skip-patterns[1]", "bah.jar"); bindProperties(map); @@ -476,7 +476,7 @@ public class DefaultServletContainerCustomizerTests { @Test public void sessionStoreDir() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.session.store-dir", "myfolder"); bindProperties(map); JettyEmbeddedServletContainerFactory container = spy( diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfigurationTests.java index ceb98065fd..69eb04aafe 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfigurationTests.java @@ -219,7 +219,7 @@ public class DispatcherServletAutoConfigurationTests { @Bean public ServletRegistrationBean dispatcherServletRegistration( DispatcherServlet dispatcherServlet) { - ServletRegistrationBean registration = new ServletRegistrationBean( + ServletRegistrationBean registration = new ServletRegistrationBean<>( dispatcherServlet, "/foo"); registration.setName("customDispatcher"); return registration; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java index 187edefc53..660ed1feb2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfigurationTests.java @@ -219,8 +219,7 @@ public class EmbeddedServletContainerAutoConfigurationTests { @Bean(name = DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME) public ServletRegistrationBean dispatcherRegistration() { - return new ServletRegistrationBean(dispatcherServlet(), - "/app/*"); + return new ServletRegistrationBean<>(dispatcherServlet(), "/app/*"); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java index f73138eeb7..d4e6489860 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java @@ -36,8 +36,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; /** - * Tests for {@link EmbeddedWebServer}s driving {@link ServletContextListener}s - * correctly + * Tests for {@link EmbeddedWebServer}s driving {@link ServletContextListener}s correctly * * @author Andy Wilkinson */ @@ -137,7 +136,7 @@ public class EmbeddedServletContainerServletContextListenerTests { @Bean public ServletListenerRegistrationBean registration() { - return new ServletListenerRegistrationBean( + return new ServletListenerRegistrationBean<>( mock(ServletContextListener.class)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/FilterOrderingIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/FilterOrderingIntegrationTests.java index 7ff2ad98e1..386f964af6 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/FilterOrderingIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/FilterOrderingIntegrationTests.java @@ -69,7 +69,7 @@ public class FilterOrderingIntegrationTests { List registeredFilters = this.context .getBean(MockEmbeddedServletContainerFactory.class).getContainer() .getRegisteredFilters(); - List filters = new ArrayList(registeredFilters.size()); + List filters = new ArrayList<>(registeredFilters.size()); for (RegisteredFilter registeredFilter : registeredFilters) { filters.add(registeredFilter.getFilter()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java index 0023e1b09f..c6f4308b27 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -135,7 +135,7 @@ public class HttpEncodingAutoConfigurationTests { @Test public void filterIsOrderedHighest() throws Exception { load(OrderedConfiguration.class); - List beans = new ArrayList( + List beans = new ArrayList<>( this.context.getBeansOfType(Filter.class).values()); AnnotationAwareOrderComparator.sort(beans); assertThat(beans.get(0)).isInstanceOf(CharacterEncodingFilter.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java index 057ea8eab1..caedb10996 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,7 +54,7 @@ public class HttpMessageConvertersTests { @Test public void containsDefaults() throws Exception { HttpMessageConverters converters = new HttpMessageConverters(); - List> converterClasses = new ArrayList>(); + List> converterClasses = new ArrayList<>(); for (HttpMessageConverter converter : converters) { converterClasses.add(converter.getClass()); } @@ -76,7 +76,7 @@ public class HttpMessageConvertersTests { converter2); assertThat(converters.getConverters().contains(converter1)).isTrue(); assertThat(converters.getConverters().contains(converter2)).isTrue(); - List httpConverters = new ArrayList(); + List httpConverters = new ArrayList<>(); for (HttpMessageConverter candidate : converters) { if (candidate instanceof MappingJackson2HttpMessageConverter) { httpConverters.add((MappingJackson2HttpMessageConverter) candidate); @@ -127,7 +127,7 @@ public class HttpMessageConvertersTests { return converters; }; }; - List> converterClasses = new ArrayList>(); + List> converterClasses = new ArrayList<>(); for (HttpMessageConverter converter : converters) { converterClasses.add(converter.getClass()); } @@ -156,7 +156,7 @@ public class HttpMessageConvertersTests { return converters; }; }; - List> converterClasses = new ArrayList>(); + List> converterClasses = new ArrayList<>(); for (HttpMessageConverter converter : extractFormPartConverters( converters.getConverters())) { converterClasses.add(converter.getClass()); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java index 36126be6eb..56e1f96d2d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java @@ -150,8 +150,8 @@ public class MultipartAutoConfigurationTests { public void containerWithAutomatedMultipartTomcatConfiguration() throws Exception { this.context = new AnnotationConfigEmbeddedWebApplicationContext( ContainerWithEverythingTomcat.class, BaseConfiguration.class); - new RestTemplate().getForObject("http://localhost:" - + this.context.getEmbeddedWebServer().getPort() + "/", + new RestTemplate().getForObject( + "http://localhost:" + this.context.getEmbeddedWebServer().getPort() + "/", String.class); this.context.getBean(MultipartConfigElement.class); assertThat(this.context.getBean(StandardServletMultipartResolver.class)).isSameAs( @@ -228,8 +228,8 @@ public class MultipartAutoConfigurationTests { private void verifyServletWorks() { RestTemplate restTemplate = new RestTemplate(); - String url = "http://localhost:" - + this.context.getEmbeddedWebServer().getPort() + "/"; + String url = "http://localhost:" + this.context.getEmbeddedWebServer().getPort() + + "/"; assertThat(restTemplate.getForObject(url, String.class)).isEqualTo("Hello"); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java index 6d69fd04fd..78c599a388 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java @@ -69,8 +69,8 @@ public class RemappedErrorViewIntegrationTests { } @Configuration - @Import({ PropertyPlaceholderAutoConfiguration.class, - WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, + @Import({ PropertyPlaceholderAutoConfiguration.class, WebMvcAutoConfiguration.class, + HttpMessageConvertersAutoConfiguration.class, EmbeddedServletContainerAutoConfiguration.class, DispatcherServletAutoConfiguration.class, ErrorMvcAutoConfiguration.class }) @Controller diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index c5e44aee6b..3fd99ba96f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -76,7 +76,7 @@ public class ServerPropertiesTests { @Test public void testConnectionTimeout() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.connection-timeout", "60000"); bindProperties(map); assertThat(this.properties.getConnectionTimeout()).isEqualTo(60000); @@ -104,7 +104,7 @@ public class ServerPropertiesTests { @Test public void testTomcatBinding() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.accesslog.pattern", "%h %t '%r' %s %b"); map.put("server.tomcat.accesslog.prefix", "foo"); map.put("server.tomcat.accesslog.rotate", "false"); @@ -153,7 +153,7 @@ public class ServerPropertiesTests { @Test public void testCustomizeUriEncoding() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.tomcat.uriEncoding", "US-ASCII"); bindProperties(map); assertThat(this.properties.getTomcat().getUriEncoding()) @@ -162,7 +162,7 @@ public class ServerPropertiesTests { @Test public void testCustomizeHeaderSize() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.maxHttpHeaderSize", "9999"); bindProperties(map); assertThat(this.properties.getMaxHttpHeaderSize()).isEqualTo(9999); @@ -170,7 +170,7 @@ public class ServerPropertiesTests { @Test public void testCustomizeJettyAcceptors() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.jetty.acceptors", "10"); bindProperties(map); assertThat(this.properties.getJetty().getAcceptors()).isEqualTo(10); @@ -178,7 +178,7 @@ public class ServerPropertiesTests { @Test public void testCustomizeJettySelectors() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("server.jetty.selectors", "10"); bindProperties(map); assertThat(this.properties.getJetty().getSelectors()).isEqualTo(10); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebClientAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebClientAutoConfigurationTests.java index 834cb5907b..f619e18e77 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebClientAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebClientAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -79,7 +79,7 @@ public class WebClientAutoConfigurationTests { load(CustomHttpMessageConverter.class, HttpMessageConvertersAutoConfiguration.class, RestTemplateConfig.class); RestTemplate restTemplate = this.context.getBean(RestTemplate.class); - List> converterClasses = new ArrayList>(); + List> converterClasses = new ArrayList<>(); for (HttpMessageConverter converter : restTemplate.getMessageConverters()) { converterClasses.add(converter.getClass()); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java index 0a5e9ee0f4..1bcebe937d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java @@ -384,7 +384,7 @@ public class WebMvcAutoConfigurationTests { @SuppressWarnings("unchecked") protected Map> getMappingLocations(HandlerMapping mapping) throws IllegalAccessException { - Map> mappingLocations = new LinkedHashMap>(); + Map> mappingLocations = new LinkedHashMap<>(); if (mapping instanceof SimpleUrlHandlerMapping) { Field locationsField = ReflectionUtils .findField(ResourceHttpRequestHandler.class, "locations"); @@ -710,7 +710,7 @@ public class WebMvcAutoConfigurationTests { private void load(Class config, String... environment) { this.context = new AnnotationConfigEmbeddedWebApplicationContext(); EnvironmentTestUtils.addEnvironment(this.context, environment); - List> configClasses = new ArrayList>(); + List> configClasses = new ArrayList<>(); if (config != null) { configClasses.add(config); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java index 6226eaa1cc..5adcabcfeb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java @@ -124,7 +124,7 @@ public class WebSocketMessagingAutoConfigurationTests { } private List getCustomizedConverters() { - List customizedConverters = new ArrayList(); + List customizedConverters = new ArrayList<>(); WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration( new ObjectMapper()); configuration.configureMessageConverters(customizedConverters); @@ -146,8 +146,8 @@ public class WebSocketMessagingAutoConfigurationTests { new ServerPortInfoApplicationContextInitializer().initialize(this.context); this.context.refresh(); WebSocketStompClient stompClient = new WebSocketStompClient(this.sockJsClient); - final AtomicReference failure = new AtomicReference(); - final AtomicReference result = new AtomicReference(); + final AtomicReference failure = new AtomicReference<>(); + final AtomicReference result = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); StompSessionHandler handler = new StompSessionHandlerAdapter() { diff --git a/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java b/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java index 923b0d1518..3f36f187b3 100644 --- a/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java +++ b/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,7 +54,7 @@ public final class CommandLineInvoker { } private Process runCliProcess(String... args) throws IOException { - List command = new ArrayList(); + List command = new ArrayList<>(); command.add(findLaunchScript().getAbsolutePath()); command.addAll(Arrays.asList(args)); ProcessBuilder processBuilder = new ProcessBuilder(command) @@ -97,7 +97,7 @@ public final class CommandLineInvoker { private final Process process; - private final List streamReaders = new ArrayList(); + private final List streamReaders = new ArrayList<>(); public Invocation(Process process) { this.process = process; @@ -141,7 +141,7 @@ public final class CommandLineInvoker { BufferedReader reader = new BufferedReader( new StringReader(buffer.toString())); String line; - List lines = new ArrayList(); + List lines = new ArrayList<>(); try { while ((line = reader.readLine()) != null) { if (!line.startsWith("Picked up ")) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java index 7fd33b8922..00998f5645 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -80,7 +80,7 @@ public final class SpringCli { } private static URL[] getExtensionURLs() { - List urls = new ArrayList(); + List urls = new ArrayList<>(); String home = SystemPropertyUtils .resolvePlaceholders("${spring.home:${SPRING_HOME:.}}"); File extDirectory = new File(new File(home, "lib"), "ext"); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationLauncher.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationLauncher.java index 01068993a5..09459da1d9 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationLauncher.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -57,7 +57,7 @@ public class SpringApplicationLauncher { * @throws Exception if the launch fails */ public Object launch(Object[] sources, String[] args) throws Exception { - Map defaultProperties = new HashMap(); + Map defaultProperties = new HashMap<>(); defaultProperties.put("spring.groovy.template.check-template-location", "false"); Class applicationClass = this.classLoader .loadClass(getSpringApplicationClassName()); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java index 0a52a20dd8..bfea4c4cbc 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -43,7 +43,7 @@ public class CommandRunner implements Iterable { private final String name; - private final List commands = new ArrayList(); + private final List commands = new ArrayList<>(); private Class[] optionCommandClasses = {}; @@ -185,7 +185,7 @@ public class CommandRunner implements Iterable { } private String[] removeDebugFlags(String[] args) { - List rtn = new ArrayList(args.length); + List rtn = new ArrayList<>(args.length); boolean appArgsDetected = false; for (String arg : args) { // Allow apps to have a -d argument diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java index be7086f776..4e47c6f162 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java @@ -168,7 +168,7 @@ abstract class ArchiveCommand extends OptionParsingCommand { } private List getClassPathUrls(GroovyCompiler compiler) { - return new ArrayList(Arrays.asList(compiler.getLoader().getURLs())); + return new ArrayList<>(Arrays.asList(compiler.getLoader().getURLs())); } private List findMatchingClasspathEntries(List classpath, @@ -176,7 +176,7 @@ abstract class ArchiveCommand extends OptionParsingCommand { ResourceMatcher matcher = new ResourceMatcher( options.valuesOf(this.includeOption), options.valuesOf(this.excludeOption)); - List roots = new ArrayList(); + List roots = new ArrayList<>(); for (URL classpathEntry : classpath) { roots.add(new File(URI.create(classpathEntry.toString()))); } @@ -215,7 +215,7 @@ abstract class ArchiveCommand extends OptionParsingCommand { private List createLibraries(List dependencies) throws URISyntaxException { - List libraries = new ArrayList(); + List libraries = new ArrayList<>(); for (URL dependency : dependencies) { File file = new File(dependency.toURI()); libraries.add(new Library(file, getLibraryScope(file))); @@ -277,7 +277,7 @@ abstract class ArchiveCommand extends OptionParsingCommand { private List addClasspathEntries(JarWriter writer, List entries) throws IOException { - List libraries = new ArrayList(); + List libraries = new ArrayList<>(); for (MatchedResource entry : entries) { if (entry.isRoot()) { libraries.add(new Library(entry.getFile(), LibraryScope.COMPILE)); @@ -329,7 +329,7 @@ abstract class ArchiveCommand extends OptionParsingCommand { private void disableGrabResolvers(List nodes) { for (AnnotatedNode classNode : nodes) { List annotations = classNode.getAnnotations(); - for (AnnotationNode node : new ArrayList(annotations)) { + for (AnnotationNode node : new ArrayList<>(annotations)) { if (node.getClassNode().getNameWithoutPackage() .equals("GrabResolver")) { node.setMember("initClass", new ConstantExpression(false)); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ResourceMatcher.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ResourceMatcher.java index da162bed9b..f4a0a7f267 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ResourceMatcher.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ResourceMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -60,7 +60,7 @@ class ResourceMatcher { } public List find(List roots) throws IOException { - List matchedResources = new ArrayList(); + List matchedResources = new ArrayList<>(); for (File root : roots) { if (root.isFile()) { matchedResources.add(new MatchedResource(root)); @@ -73,7 +73,7 @@ class ResourceMatcher { } private List findInFolder(File folder) throws IOException { - List matchedResources = new ArrayList(); + List matchedResources = new ArrayList<>(); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver( new FolderResourceLoader(folder)); @@ -103,8 +103,8 @@ class ResourceMatcher { } private List getOptions(List values, String[] defaults) { - Set result = new LinkedHashSet(); - Set minus = new LinkedHashSet(); + Set result = new LinkedHashSet<>(); + Set minus = new LinkedHashSet<>(); boolean deltasFound = false; for (String value : values) { if (value.startsWith("+")) { @@ -126,7 +126,7 @@ class ResourceMatcher { result.add(value); } } - return new ArrayList(result); + return new ArrayList<>(result); } /** diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java index 0d41157aae..5a16d39f85 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -58,7 +58,7 @@ public class HelpCommand extends AbstractCommand { @Override public Collection getOptionsHelp() { - List help = new ArrayList(); + List help = new ArrayList<>(); for (final Command command : this.commandRunner) { if (isHelpShown(command)) { help.add(new OptionHelp() { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java index 2803e32940..88dfbefc98 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,7 +46,7 @@ public class HintCommand extends AbstractCommand { public ExitStatus run(String... args) throws Exception { try { int index = (args.length == 0 ? 0 : Integer.valueOf(args[0]) - 1); - List arguments = new ArrayList(args.length); + List arguments = new ArrayList<>(args.length); for (int i = 2; i < args.length; i++) { arguments.add(args[i]); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java index f80e123fa1..f831a77151 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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 InitCommand extends OptionParsingCommand { @Override public Collection getExamples() { - List examples = new ArrayList(); + List examples = new ArrayList<>(); examples.add(new HelpExample("To list all the capabilities of the service", "spring init --list")); examples.add(new HelpExample("To creates a default project", "spring init")); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java index b8f125ce9b..123b4a51be 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java @@ -68,12 +68,12 @@ class InitializrServiceMetadata { } InitializrServiceMetadata(ProjectType defaultProjectType) { - this.dependencies = new HashMap(); - this.projectTypes = new MetadataHolder(); + this.dependencies = new HashMap<>(); + this.projectTypes = new MetadataHolder<>(); this.projectTypes.getContent().put(defaultProjectType.getId(), defaultProjectType); this.projectTypes.setDefaultItem(defaultProjectType); - this.defaults = new HashMap(); + this.defaults = new HashMap<>(); } /** @@ -128,7 +128,7 @@ class InitializrServiceMetadata { private Map parseDependencies(JSONObject root) throws JSONException { - Map result = new HashMap(); + Map result = new HashMap<>(); if (!root.has(DEPENDENCIES_EL)) { return result; } @@ -143,7 +143,7 @@ class InitializrServiceMetadata { private MetadataHolder parseProjectTypes(JSONObject root) throws JSONException { - MetadataHolder result = new MetadataHolder(); + MetadataHolder result = new MetadataHolder<>(); if (!root.has(TYPE_EL)) { return result; } @@ -163,7 +163,7 @@ class InitializrServiceMetadata { } private Map parseDefaults(JSONObject root) throws JSONException { - Map result = new HashMap(); + Map result = new HashMap<>(); Iterator keys = root.keys(); while (keys.hasNext()) { String key = (String) keys.next(); @@ -202,7 +202,7 @@ class InitializrServiceMetadata { String name = getStringValue(object, NAME_ATTRIBUTE, null); String action = getStringValue(object, ACTION_ATTRIBUTE, null); boolean defaultType = id.equals(defaultId); - Map tags = new HashMap(); + Map tags = new HashMap<>(); if (object.has("tags")) { JSONObject jsonTags = object.getJSONObject("tags"); tags.putAll(parseStringItems(jsonTags)); @@ -216,7 +216,7 @@ class InitializrServiceMetadata { } private Map parseStringItems(JSONObject json) throws JSONException { - Map result = new HashMap(); + Map result = new HashMap<>(); for (Iterator iterator = json.keys(); iterator.hasNext();) { String key = (String) iterator.next(); Object value = json.get(key); @@ -234,7 +234,7 @@ class InitializrServiceMetadata { private T defaultItem; private MetadataHolder() { - this.content = new HashMap(); + this.content = new HashMap<>(); } public Map getContent() { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java index 4cf44fd5ed..697c838ee4 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -73,7 +73,7 @@ class ProjectGenerationRequest { private String bootVersion; - private List dependencies = new ArrayList(); + private List dependencies = new ArrayList<>(); /** * The URL of the service to use. @@ -374,8 +374,7 @@ class ProjectGenerationRequest { return result; } else if (isDetectType()) { - Map types = new HashMap( - metadata.getProjectTypes()); + Map types = new HashMap<>(metadata.getProjectTypes()); if (this.build != null) { filter(types, "build", this.build); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectType.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectType.java index df30b3e36b..383080bee4 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectType.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectType.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -36,7 +36,7 @@ class ProjectType { private final boolean defaultType; - private final Map tags = new HashMap(); + private final Map tags = new HashMap<>(); ProjectType(String id, String name, String action, boolean defaultType, Map tags) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java index 9c33682a54..0e1f776265 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -93,8 +93,7 @@ class ServiceCapabilitiesReportGenerator { } private List getSortedDependencies(InitializrServiceMetadata metadata) { - ArrayList dependencies = new ArrayList( - metadata.getDependencies()); + ArrayList dependencies = new ArrayList<>(metadata.getDependencies()); Collections.sort(dependencies, new Comparator() { @Override public int compare(Dependency o1, Dependency o2) { @@ -108,7 +107,7 @@ class ServiceCapabilitiesReportGenerator { StringBuilder report) { report.append("Available project types:" + NEW_LINE); report.append("------------------------" + NEW_LINE); - SortedSet> entries = new TreeSet>( + SortedSet> entries = new TreeSet<>( new Comparator>() { @Override @@ -150,8 +149,7 @@ class ServiceCapabilitiesReportGenerator { InitializrServiceMetadata metadata) { report.append("Defaults:" + NEW_LINE); report.append("---------" + NEW_LINE); - List defaultsKeys = new ArrayList( - metadata.getDefaults().keySet()); + List defaultsKeys = new ArrayList<>(metadata.getDefaults().keySet()); Collections.sort(defaultsKeys); for (String defaultsKey : defaultsKeys) { String defaultsValue = metadata.getDefaults().get(defaultsKey); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolver.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolver.java index ae03dde601..087692bbf2 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolver.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ class GroovyGrabDependencyResolver implements DependencyResolver { public List resolve(List artifactIdentifiers) throws CompilationFailedException, IOException { GroovyCompiler groovyCompiler = new GroovyCompiler(this.configuration); - List artifactFiles = new ArrayList(); + List artifactFiles = new ArrayList<>(); if (!artifactIdentifiers.isEmpty()) { List initialUrls = getClassPathUrls(groovyCompiler); groovyCompiler.compile(createSources(artifactIdentifiers)); @@ -64,7 +64,7 @@ class GroovyGrabDependencyResolver implements DependencyResolver { } private List getClassPathUrls(GroovyCompiler compiler) { - return new ArrayList(Arrays.asList(compiler.getLoader().getURLs())); + return new ArrayList<>(Arrays.asList(compiler.getLoader().getURLs())); } private String createSources(List artifactIdentifiers) throws IOException { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java index 305938d0f8..b3f6c004c1 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -126,7 +126,7 @@ public class OptionHandler { private static class OptionHelpFormatter implements HelpFormatter { - private final List help = new ArrayList(); + private final List help = new ArrayList<>(); @Override public String format(Map options) { @@ -138,7 +138,7 @@ public class OptionHandler { } }; - Set sorted = new TreeSet(comparator); + Set sorted = new TreeSet<>(comparator); sorted.addAll(options.values()); for (OptionDescriptor descriptor : sorted) { @@ -162,7 +162,7 @@ public class OptionHandler { private final String description; OptionHelpAdapter(OptionDescriptor descriptor) { - this.options = new LinkedHashSet(); + this.options = new LinkedHashSet<>(); for (String option : descriptor.options()) { this.options.add((option.length() == 1 ? "-" : "--") + option); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java index 60a4eaa242..0d9bd95acb 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -71,7 +71,7 @@ public class SourceOptions { } private SourceOptions(List nonOptionArguments, ClassLoader classLoader) { - List sources = new ArrayList(); + List sources = new ArrayList<>(); int sourceArgCount = 0; for (Object option : nonOptionArguments) { if (option instanceof String) { @@ -79,7 +79,7 @@ public class SourceOptions { if ("--".equals(filename)) { break; } - List urls = new ArrayList(); + List urls = new ArrayList<>(); File fileCandidate = new File(filename); if (fileCandidate.isFile()) { urls.add(fileCandidate.getAbsoluteFile().toURI().toString()); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java index a7920921c3..49d4a5f072 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -230,7 +230,7 @@ public class SpringApplicationRunner { } private List getSourceFiles() { - List sources = new ArrayList(); + List sources = new ArrayList<>(); for (String source : SpringApplicationRunner.this.sources) { List paths = ResourceUtils.getUrls(source, SpringApplicationRunner.this.compiler.getLoader()); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java index 5bfa79a542..e741eea27d 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -42,20 +42,20 @@ import org.springframework.boot.cli.util.Log; */ public class CommandCompleter extends StringsCompleter { - private final Map commandCompleters = new HashMap(); + private final Map commandCompleters = new HashMap<>(); - private final List commands = new ArrayList(); + private final List commands = new ArrayList<>(); private final ConsoleReader console; public CommandCompleter(ConsoleReader consoleReader, ArgumentDelimiter argumentDelimiter, Iterable commands) { this.console = consoleReader; - List names = new ArrayList(); + List names = new ArrayList<>(); for (Command command : commands) { this.commands.add(command); names.add(command.getName()); - List options = new ArrayList(); + List options = new ArrayList<>(); for (OptionHelp optionHelp : command.getOptionsHelp()) { options.addAll(optionHelp.getOptions()); } @@ -95,7 +95,7 @@ public class CommandCompleter extends StringsCompleter { private void printUsage(Command command) { try { int maxOptionsLength = 0; - List optionHelpLines = new ArrayList(); + List optionHelpLines = new ArrayList<>(); for (OptionHelp optionHelp : command.getOptionsHelp()) { OptionHelpLine optionHelpLine = new OptionHelpLine(optionHelp); optionHelpLines.add(optionHelpLine); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ForkProcessCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ForkProcessCommand.java index 483abdb03e..720da50692 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ForkProcessCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ForkProcessCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -69,7 +69,7 @@ class ForkProcessCommand extends RunProcessCommand { @Override public ExitStatus run(String... args) throws Exception { - List fullArgs = new ArrayList(); + List fullArgs = new ArrayList<>(); fullArgs.add("-cp"); fullArgs.add(System.getProperty("java.class.path")); fullArgs.add(MAIN_CLASS); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java index c9f84dbf57..b2745217e5 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -51,7 +51,7 @@ public class Shell { private static final Set> NON_FORKED_COMMANDS; static { - Set> nonForked = new HashSet>(); + Set> nonForked = new HashSet<>(); nonForked.add(VersionCommand.class); NON_FORKED_COMMANDS = Collections.unmodifiableSet(nonForked); } @@ -86,7 +86,7 @@ public class Shell { } private Iterable getCommands() { - List commands = new ArrayList(); + List commands = new ArrayList<>(); ServiceLoader factories = ServiceLoader.load(CommandFactory.class, getClass().getClassLoader()); for (CommandFactory factory : factories) { @@ -193,7 +193,7 @@ public class Shell { private volatile Command lastCommand; - private final Map aliases = new HashMap(); + private final Map aliases = new HashMap<>(); ShellCommandRunner() { super(null); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ShellPrompts.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ShellPrompts.java index 1b8ec1f67a..bca81c3cb3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ShellPrompts.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/ShellPrompts.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -27,7 +27,7 @@ public class ShellPrompts { private static final String DEFAULT_PROMPT = "$ "; - private final Stack prompts = new Stack(); + private final Stack prompts = new Stack<>(); /** * Push a new prompt to be used by the shell. diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java index aeab1d3a3f..3b35d163cd 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/test/TestRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -112,7 +112,7 @@ public class TestRunner { } private Class[] getTestClasses(Object[] sources) { - List> testClasses = new ArrayList>(); + List> testClasses = new ArrayList<>(); for (Object source : sources) { if ((source instanceof Class) && isTestable((Class) source)) { testClasses.add((Class) source); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AnnotatedNodeASTTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AnnotatedNodeASTTransformation.java index d0eb45e69a..bfcfb806b6 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AnnotatedNodeASTTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AnnotatedNodeASTTransformation.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -56,7 +56,7 @@ public abstract class AnnotatedNodeASTTransformation implements ASTTransformatio @Override public void visit(ASTNode[] nodes, SourceUnit source) { this.sourceUnit = source; - List annotationNodes = new ArrayList(); + List annotationNodes = new ArrayList<>(); ClassVisitor classVisitor = new ClassVisitor(source, annotationNodes); for (ASTNode node : nodes) { if (node instanceof ModuleNode) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java index e30f530a1e..ef2656c1e0 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -98,7 +98,7 @@ public abstract class AstUtils { * @return {@code true} if at least one of the types is found, otherwise {@code false} */ public static boolean hasAtLeastOneFieldOrMethod(ClassNode node, String... types) { - Set typesSet = new HashSet(Arrays.asList(types)); + Set typesSet = new HashSet<>(Arrays.asList(types)); for (FieldNode field : node.getFields()) { if (typesSet.contains(field.getType().getName())) { return true; @@ -130,7 +130,7 @@ public abstract class AstUtils { } public static boolean hasAtLeastOneInterface(ClassNode classNode, String... types) { - Set typesSet = new HashSet(Arrays.asList(types)); + Set typesSet = new HashSet<>(Arrays.asList(types)); for (ClassNode inter : classNode.getInterfaces()) { if (typesSet.contains(inter.getName())) { return true; @@ -167,7 +167,7 @@ public abstract class AstUtils { private static List getExpressionStatements( BlockStatement block) { - ArrayList statements = new ArrayList(); + ArrayList statements = new ArrayList<>(); for (Statement statement : block.getStatements()) { if (statement instanceof ExpressionStatement) { statements.add((ExpressionStatement) statement); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java index fabf061962..7b84789ea3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -70,8 +70,8 @@ public class DependencyManagementBomTransformation public static final int ORDER = Ordered.HIGHEST_PRECEDENCE + 100; private static final Set DEPENDENCY_MANAGEMENT_BOM_ANNOTATION_NAMES = Collections - .unmodifiableSet(new HashSet( - Arrays.asList(DependencyManagementBom.class.getName(), + .unmodifiableSet( + new HashSet<>(Arrays.asList(DependencyManagementBom.class.getName(), DependencyManagementBom.class.getSimpleName()))); private final DependencyResolutionContext resolutionContext; @@ -106,14 +106,14 @@ public class DependencyManagementBomTransformation Map dependency = null; List constantExpressions = getConstantExpressions( valueExpression); - List> dependencies = new ArrayList>( + List> dependencies = new ArrayList<>( constantExpressions.size()); for (ConstantExpression expression : constantExpressions) { Object value = expression.getValue(); if (value instanceof String) { String[] components = ((String) expression.getValue()).split(":"); if (components.length == 3) { - dependency = new HashMap(); + dependency = new HashMap<>(); dependency.put("group", components[0]); dependency.put("module", components[1]); dependency.put("version", components[2]); @@ -143,7 +143,7 @@ public class DependencyManagementBomTransformation private List getConstantExpressions( ListExpression valueExpression) { - List expressions = new ArrayList(); + List expressions = new ArrayList<>(); for (Expression expression : valueExpression.getExpressions()) { if (expression instanceof ConstantExpression && ((ConstantExpression) expression).getValue() instanceof String) { @@ -213,7 +213,7 @@ public class DependencyManagementBomTransformation @Override public ModelSource resolveModel(String groupId, String artifactId, String version) throws UnresolvableModelException { - Map dependency = new HashMap(); + Map dependency = new HashMap<>(); dependency.put("group", groupId); dependency.put("module", artifactId); dependency.put("version", version); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java index 9992ba9c6d..a3bee740ea 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java @@ -53,7 +53,7 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader { private static final URL[] NO_URLS = new URL[] {}; - private final Map classResources = new HashMap(); + private final Map classResources = new HashMap<>(); private final GroovyCompilerScope scope; @@ -183,13 +183,13 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader { } private URL[] getGroovyJars(final ClassLoader parent) { - Set urls = new HashSet(); + Set urls = new HashSet<>(); findGroovyJarsDirectly(parent, urls); if (urls.isEmpty()) { findGroovyJarsFromClassPath(parent, urls); } Assert.state(!urls.isEmpty(), "Unable to find groovy JAR"); - return new ArrayList(urls).toArray(new URL[urls.size()]); + return new ArrayList<>(urls).toArray(new URL[urls.size()]); } private void findGroovyJarsDirectly(ClassLoader classLoader, Set urls) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GenericBomAstTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GenericBomAstTransformation.java index 0e5b490d23..11ed2f71e1 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GenericBomAstTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GenericBomAstTransformation.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -81,7 +81,7 @@ public abstract class GenericBomAstTransformation AnnotatedNode annotated = getAnnotatedNode(node); if (annotated != null) { AnnotationNode bom = getAnnotation(annotated); - List expressions = new ArrayList( + List expressions = new ArrayList<>( getConstantExpressions(bom.getMember("value"))); expressions.add(new ConstantExpression(module)); bom.setMember("value", new ListExpression(expressions)); @@ -122,7 +122,7 @@ public abstract class GenericBomAstTransformation private List getConstantExpressions( ListExpression valueExpression) { - List expressions = new ArrayList(); + List expressions = new ArrayList<>(); for (Expression expression : valueExpression.getExpressions()) { if (expression instanceof ConstantExpression && ((ConstantExpression) expression).getValue() instanceof String) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java index 1e3b42775c..836e188209 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyBeansTransformation.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -53,8 +53,7 @@ public class GroovyBeansTransformation implements ASTTransformation { for (ASTNode node : nodes) { if (node instanceof ModuleNode) { ModuleNode module = (ModuleNode) node; - for (ClassNode classNode : new ArrayList( - module.getClasses())) { + for (ClassNode classNode : new ArrayList<>(module.getClasses())) { if (classNode.isScript()) { classNode.visitContents(new ClassVisitor(source, classNode)); } diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java index 7b4db23c27..0e31ed167f 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -109,7 +109,7 @@ public class GroovyCompiler { this.compilerAutoConfigurations = Collections.emptySet(); } - this.transformations = new ArrayList(); + this.transformations = new ArrayList<>(); this.transformations .add(new DependencyManagementBomTransformation(resolutionContext)); this.transformations.add(new DependencyAutoConfigurationTransformation( @@ -184,7 +184,7 @@ public class GroovyCompiler { throws CompilationFailedException, IOException { this.loader.clearCache(); - List> classes = new ArrayList>(); + List> classes = new ArrayList<>(); CompilerConfiguration configuration = this.loader.getConfiguration(); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java index 3b60f5d3d9..d6b6462c75 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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 final class RepositoryConfigurationFactory { */ public static List createDefaultRepositoryConfiguration() { MavenSettings mavenSettings = new MavenSettingsReader().readSettings(); - List repositoryConfiguration = new ArrayList(); + List repositoryConfiguration = new ArrayList<>(); repositoryConfiguration.add(MAVEN_CENTRAL); if (!Boolean.getBoolean("disableSpringSnapshotRepos")) { repositoryConfiguration.add(SPRING_MILESTONE); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java index 723d966764..4db5495306 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -47,7 +47,7 @@ public class ResolveDependencyCoordinatesTransformation public static final int ORDER = DependencyManagementBomTransformation.ORDER + 300; private static final Set GRAB_ANNOTATION_NAMES = Collections - .unmodifiableSet(new HashSet( + .unmodifiableSet(new HashSet<>( Arrays.asList(Grab.class.getName(), Grab.class.getSimpleName()))); private final DependencyResolutionContext resolutionContext; diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/CompositeDependencyManagement.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/CompositeDependencyManagement.java index f6d19d5e35..8cf2be3c46 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/CompositeDependencyManagement.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/CompositeDependencyManagement.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -31,7 +31,7 @@ public class CompositeDependencyManagement implements DependencyManagement { private final List delegates; - private final List dependencies = new ArrayList(); + private final List dependencies = new ArrayList<>(); public CompositeDependencyManagement(DependencyManagement... delegates) { this.delegates = Arrays.asList(delegates); diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/MavenModelDependencyManagement.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/MavenModelDependencyManagement.java index 7442978870..7effd91830 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/MavenModelDependencyManagement.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/MavenModelDependencyManagement.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -35,7 +35,7 @@ public class MavenModelDependencyManagement implements DependencyManagement { private final List dependencies; - private final Map byArtifactId = new LinkedHashMap(); + private final Map byArtifactId = new LinkedHashMap<>(); public MavenModelDependencyManagement(Model model) { this.dependencies = extractDependenciesFromModel(model); @@ -45,10 +45,10 @@ public class MavenModelDependencyManagement implements DependencyManagement { } private static List extractDependenciesFromModel(Model model) { - List dependencies = new ArrayList(); + List dependencies = new ArrayList<>(); for (org.apache.maven.model.Dependency mavenDependency : model .getDependencyManagement().getDependencies()) { - List exclusions = new ArrayList(); + List exclusions = new ArrayList<>(); for (org.apache.maven.model.Exclusion mavenExclusion : mavenDependency .getExclusions()) { exclusions.add(new Exclusion(mavenExclusion.getGroupId(), diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java index c62d40f98d..ec4be5b5b0 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -56,7 +56,7 @@ public class AetherGrapeEngine implements GrapeEngine { private static final Collection WILDCARD_EXCLUSION; static { - List exclusions = new ArrayList(); + List exclusions = new ArrayList<>(); exclusions.add(new Exclusion("*", "*", "*", "*")); WILDCARD_EXCLUSION = Collections.unmodifiableList(exclusions); } @@ -82,9 +82,8 @@ public class AetherGrapeEngine implements GrapeEngine { this.repositorySystem = repositorySystem; this.session = repositorySystemSession; this.resolutionContext = resolutionContext; - this.repositories = new ArrayList(); - List remotes = new ArrayList( - remoteRepositories); + this.repositories = new ArrayList<>(); + List remotes = new ArrayList<>(remoteRepositories); Collections.reverse(remotes); // priority is reversed in addRepository for (RemoteRepository repository : remotes) { addRepository(repository); @@ -141,7 +140,7 @@ public class AetherGrapeEngine implements GrapeEngine { @SuppressWarnings("unchecked") private List createExclusions(Map args) { - List exclusions = new ArrayList(); + List exclusions = new ArrayList<>(); if (args != null) { List> exclusionMaps = (List>) args .get("excludes"); @@ -162,7 +161,7 @@ public class AetherGrapeEngine implements GrapeEngine { private List createDependencies(Map[] dependencyMaps, List exclusions) { - List dependencies = new ArrayList(dependencyMaps.length); + List dependencies = new ArrayList<>(dependencyMaps.length); for (Map dependencyMap : dependencyMaps) { dependencies.add(createDependency(dependencyMap, exclusions)); } @@ -212,7 +211,7 @@ public class AetherGrapeEngine implements GrapeEngine { } private List getDependencies(DependencyResult dependencyResult) { - List dependencies = new ArrayList(); + List dependencies = new ArrayList<>(); for (ArtifactResult artifactResult : dependencyResult.getArtifactResults()) { dependencies.add( new Dependency(artifactResult.getArtifact(), JavaScopes.COMPILE)); @@ -221,7 +220,7 @@ public class AetherGrapeEngine implements GrapeEngine { } private List getFiles(DependencyResult dependencyResult) { - List files = new ArrayList(); + List files = new ArrayList<>(); for (ArtifactResult result : dependencyResult.getArtifactResults()) { files.add(result.getArtifact().getFile()); } @@ -297,7 +296,7 @@ public class AetherGrapeEngine implements GrapeEngine { List dependencies = createDependencies(dependencyMaps, exclusions); try { List files = resolve(dependencies); - List uris = new ArrayList(files.size()); + List uris = new ArrayList<>(files.size()); for (File file : files) { uris.add(file.toURI()); } @@ -328,7 +327,7 @@ public class AetherGrapeEngine implements GrapeEngine { private CollectRequest getCollectRequest(List dependencies) { CollectRequest collectRequest = new CollectRequest((Dependency) null, - dependencies, new ArrayList(this.repositories)); + dependencies, new ArrayList<>(this.repositories)); collectRequest .setManagedDependencies(this.resolutionContext.getManagedDependencies()); return collectRequest; diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java index 13017518c1..8878a67041 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -79,7 +79,7 @@ public abstract class AetherGrapeEngineFactory { private static List createRepositories( List repositoryConfigurations) { - List repositories = new ArrayList( + List repositories = new ArrayList<>( repositoryConfigurations.size()); for (RepositoryConfiguration repositoryConfiguration : repositoryConfigurations) { RemoteRepository.Builder builder = new RemoteRepository.Builder( diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/CompositeProxySelector.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/CompositeProxySelector.java index f34652c4fd..fc115fdfe9 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/CompositeProxySelector.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/CompositeProxySelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -31,7 +31,7 @@ import org.eclipse.aether.repository.RemoteRepository; */ public class CompositeProxySelector implements ProxySelector { - private List selectors = new ArrayList(); + private List selectors = new ArrayList<>(); public CompositeProxySelector(List selectors) { this.selectors = selectors; diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java index 94ecf81de9..69baed5595 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -40,9 +40,9 @@ import org.springframework.boot.cli.compiler.dependencies.DependencyManagementAr */ public class DependencyResolutionContext { - private final Map managedDependencyByGroupAndArtifact = new HashMap(); + private final Map managedDependencyByGroupAndArtifact = new HashMap<>(); - private final List managedDependencies = new ArrayList(); + private final List managedDependencies = new ArrayList<>(); private DependencyManagement dependencyManagement = null; @@ -90,7 +90,7 @@ public class DependencyResolutionContext { public void addDependencyManagement(DependencyManagement dependencyManagement) { for (org.springframework.boot.cli.compiler.dependencies.Dependency dependency : dependencyManagement .getDependencies()) { - List aetherExclusions = new ArrayList(); + List aetherExclusions = new ArrayList<>(); for (org.springframework.boot.cli.compiler.dependencies.Dependency.Exclusion exclusion : dependency .getExclusions()) { aetherExclusions.add(new Exclusion(exclusion.getGroupId(), diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/maven/MavenSettings.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/maven/MavenSettings.java index f3a6bbc3ac..6c73b25a4b 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/maven/MavenSettings.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/maven/MavenSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -137,7 +137,7 @@ public class MavenSettings { if (!problemCollector.getProblems().isEmpty()) { throw new IllegalStateException(createFailureMessage(problemCollector)); } - List activeProfiles = new ArrayList(); + List activeProfiles = new ArrayList<>(); Map profiles = settings.getProfilesAsMap(); for (org.apache.maven.model.Profile modelProfile : activeModelProfiles) { activeProfiles.add(profiles.get(modelProfile.getId())); @@ -200,7 +200,7 @@ public class MavenSettings { private List createModelProfiles( List profiles) { - List modelProfiles = new ArrayList(); + List modelProfiles = new ArrayList<>(); for (Profile profile : profiles) { org.apache.maven.model.Profile modelProfile = new org.apache.maven.model.Profile(); modelProfile.setId(profile.getId()); @@ -310,7 +310,7 @@ public class MavenSettings { private static final class SpringBootCliModelProblemCollector implements ModelProblemCollector { - private final List problems = new ArrayList(); + private final List problems = new ArrayList<>(); @Override public void add(ModelProblemCollectorRequest req) { diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java index 8566af19ed..289d048afe 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -84,7 +84,7 @@ public abstract class ResourceUtils { if (path.contains(":")) { return getUrlsFromPrefixedWildcardPath(path, classLoader); } - Set result = new LinkedHashSet(); + Set result = new LinkedHashSet<>(); try { result.addAll(getUrls(FILE_URL_PREFIX + path, classLoader)); } @@ -93,14 +93,14 @@ public abstract class ResourceUtils { } path = stripLeadingSlashes(path); result.addAll(getUrls(ALL_CLASSPATH_URL_PREFIX + path, classLoader)); - return new ArrayList(result); + return new ArrayList<>(result); } private static List getUrlsFromPrefixedWildcardPath(String path, ClassLoader classLoader) throws IOException { Resource[] resources = new PathMatchingResourcePatternResolver( new FileSearchResourceLoader(classLoader)).getResources(path); - List result = new ArrayList(); + List result = new ArrayList<>(); for (Resource resource : resources) { if (resource.exists()) { if (resource.getURI().getScheme().equals("file")) { @@ -118,7 +118,7 @@ public abstract class ResourceUtils { private static List getChildFiles(Resource resource) throws IOException { Resource[] children = new PathMatchingResourcePatternResolver() .getResources(resource.getURL() + "/**"); - List childFiles = new ArrayList(); + List childFiles = new ArrayList<>(); for (Resource child : children) { if (!child.getFile().isDirectory()) { childFiles.add(absolutePath(child)); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java index 13e37821fd..5e299a7c1e 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTester.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -57,7 +57,7 @@ public class CliTester implements TestRule { private long timeout = TimeUnit.MINUTES.toMillis(6); - private final List commands = new ArrayList(); + private final List commands = new ArrayList<>(); private final String prefix; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/app/SpringApplicationLauncherTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/app/SpringApplicationLauncherTests.java index 959cd0d7a6..654c8b1cea 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/app/SpringApplicationLauncherTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/app/SpringApplicationLauncherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ import static org.assertj.core.api.Assertions.assertThat; */ public class SpringApplicationLauncherTests { - private Map env = new HashMap(); + private Map env = new HashMap<>(); @After public void cleanUp() { @@ -100,7 +100,7 @@ public class SpringApplicationLauncherTests { private static class TestClassLoader extends ClassLoader { - private Set classes = new HashSet(); + private Set classes = new HashSet<>(); TestClassLoader(ClassLoader parent) { super(parent); diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/archive/ResourceMatcherTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/archive/ResourceMatcherTests.java index cd73f8a40f..fe1275cf5e 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/archive/ResourceMatcherTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/archive/ResourceMatcherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -139,7 +139,7 @@ public class ResourceMatcherTests { .find(Arrays.asList(new File("src/test/resources/resource-matcher/one"), new File("src/test/resources/resource-matcher/two"), new File("src/test/resources/resource-matcher/three"))); - List paths = new ArrayList(); + List paths = new ArrayList<>(); for (MatchedResource resource : matchedResources) { paths.add(resource.getName()); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java index 5803df1bfc..177bb89546 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -121,7 +121,7 @@ public class GroovyGrabDependencyResolverTests { } public Set getNames(Collection files) { - Set names = new HashSet(files.size()); + Set names = new HashSet<>(files.size()); for (File file : files) { names.add(file.getName()); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java index 2003c10658..8a79cd7237 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/InstallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -118,7 +118,7 @@ public class InstallerTests { } private Set getNamesOfFilesInLibExt() { - Set names = new HashSet(); + Set names = new HashSet<>(); for (File file : new File("target/lib/ext").listFiles()) { names.add(file.getName()); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/GenericBomAstTransformationTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/GenericBomAstTransformationTests.java index c62408d88b..f0477894fe 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/GenericBomAstTransformationTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/GenericBomAstTransformationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -95,7 +95,7 @@ public final class GenericBomAstTransformationTests { private List getValue() { Expression expression = findAnnotation().getMember("value"); if (expression instanceof ListExpression) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (Expression ex : ((ListExpression) expression).getExpressions()) { list.add((String) ((ConstantExpression) ex).getValue()); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactoryTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactoryTests.java index de4193d7c3..dc1db57cd9 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactoryTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -106,7 +106,7 @@ public class RepositoryConfigurationFactoryTests { private void assertRepositoryConfiguration( List configurations, String... expectedNames) { assertThat(configurations).hasSize(expectedNames.length); - Set actualNames = new HashSet(); + Set actualNames = new HashSet<>(); for (RepositoryConfiguration configuration : configurations) { actualNames.add(configuration.getName()); } diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java index 304e2b4273..37c30ff937 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngineTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -51,7 +51,7 @@ public class AetherGrapeEngineTests { private AetherGrapeEngine createGrapeEngine( RepositoryConfiguration... additionalRepositories) { - List repositoryConfigurations = new ArrayList(); + List repositoryConfigurations = new ArrayList<>(); repositoryConfigurations.add(new RepositoryConfiguration("central", URI.create("http://repo1.maven.org/maven2"), false)); repositoryConfigurations.addAll(Arrays.asList(additionalRepositories)); @@ -64,7 +64,7 @@ public class AetherGrapeEngineTests { @Test public void dependencyResolution() { - Map args = new HashMap(); + Map args = new HashMap<>(); createGrapeEngine(this.springMilestones).grab(args, createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE")); assertThat(this.groovyClassLoader.getURLs()).hasSize(5); @@ -125,7 +125,7 @@ public class AetherGrapeEngineTests { @Test public void dependencyResolutionWithExclusions() { - Map args = new HashMap(); + Map args = new HashMap<>(); args.put("excludes", Arrays.asList(createExclusion("org.springframework", "spring-core"))); @@ -138,7 +138,7 @@ public class AetherGrapeEngineTests { @Test public void nonTransitiveDependencyResolution() { - Map args = new HashMap(); + Map args = new HashMap<>(); createGrapeEngine().grab(args, createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE", false)); @@ -148,7 +148,7 @@ public class AetherGrapeEngineTests { @Test public void dependencyResolutionWithCustomClassLoader() { - Map args = new HashMap(); + Map args = new HashMap<>(); GroovyClassLoader customClassLoader = new GroovyClassLoader(); args.put("classLoader", customClassLoader); @@ -161,7 +161,7 @@ public class AetherGrapeEngineTests { @Test public void resolutionWithCustomResolver() { - Map args = new HashMap(); + Map args = new HashMap<>(); AetherGrapeEngine grapeEngine = this.createGrapeEngine(); grapeEngine .addResolver(createResolver("restlet.org", "http://maven.restlet.org")); @@ -180,7 +180,7 @@ public class AetherGrapeEngineTests { @Test public void pomDependencyResolutionViaType() { - Map args = new HashMap(); + Map args = new HashMap<>(); Map dependency = createDependency("org.springframework", "spring-framework-bom", "4.0.5.RELEASE"); dependency.put("type", "pom"); @@ -192,7 +192,7 @@ public class AetherGrapeEngineTests { @Test public void pomDependencyResolutionViaExt() { - Map args = new HashMap(); + Map args = new HashMap<>(); Map dependency = createDependency("org.springframework", "spring-framework-bom", "4.0.5.RELEASE"); dependency.put("ext", "pom"); @@ -204,7 +204,7 @@ public class AetherGrapeEngineTests { @Test public void resolutionWithClassifier() { - Map args = new HashMap(); + Map args = new HashMap<>(); Map dependency = createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE", false); @@ -218,7 +218,7 @@ public class AetherGrapeEngineTests { private Map createDependency(String group, String module, String version) { - Map dependency = new HashMap(); + Map dependency = new HashMap<>(); dependency.put("group", group); dependency.put("module", module); dependency.put("version", version); @@ -233,14 +233,14 @@ public class AetherGrapeEngineTests { } private Map createResolver(String name, String url) { - Map resolver = new HashMap(); + Map resolver = new HashMap<>(); resolver.put("name", name); resolver.put("root", url); return resolver; } private Map createExclusion(String group, String module) { - Map exclusion = new HashMap(); + Map exclusion = new HashMap<>(); exclusion.put("group", group); exclusion.put("module", module); return exclusion; diff --git a/spring-boot-cli/src/test/java/org/springframework/boot/cli/testutil/SystemProperties.java b/spring-boot-cli/src/test/java/org/springframework/boot/cli/testutil/SystemProperties.java index f9e336fc1a..f9d8f303b3 100644 --- a/spring-boot-cli/src/test/java/org/springframework/boot/cli/testutil/SystemProperties.java +++ b/spring-boot-cli/src/test/java/org/springframework/boot/cli/testutil/SystemProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -39,7 +39,7 @@ public final class SystemProperties { */ public static void doWithSystemProperties(Runnable action, String... systemPropertyPairs) { - Map originalValues = new HashMap(); + Map originalValues = new HashMap<>(); for (String pair : systemPropertyPairs) { String[] components = pair.split(":"); String key = components[0]; diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteSpringApplication.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteSpringApplication.java index 11f32e39fe..a2005bbe53 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteSpringApplication.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteSpringApplication.java @@ -65,13 +65,13 @@ public final class RemoteSpringApplication { } private Collection> getInitializers() { - List> initializers = new ArrayList>(); + List> initializers = new ArrayList<>(); initializers.add(new RestartScopeInitializer()); return initializers; } private Collection> getListeners() { - List> listeners = new ArrayList>(); + List> listeners = new ArrayList<>(); listeners.add(new AnsiOutputApplicationListener()); listeners.add(new ConfigFileApplicationListener()); listeners.add(new ClasspathLoggingApplicationListener()); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.java index 2c867b5013..7cd635d6b5 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -85,7 +85,7 @@ public class DevToolsDataSourceAutoConfiguration { static final class NonEmbeddedInMemoryDatabaseShutdownExecutor implements DisposableBean { - private static final Set IN_MEMORY_DRIVER_CLASS_NAMES = new HashSet( + private static final Set IN_MEMORY_DRIVER_CLASS_NAMES = new HashSet<>( Arrays.asList("org.apache.derby.jdbc.EmbeddedDriver", "org.h2.Driver", "org.h2.jdbcx.JdbcDataSource", "org.hsqldb.jdbcDriver", "org.hsqldb.jdbc.JDBCDriver", diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java index 30ad5c5352..7fefa779e0 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -101,7 +101,7 @@ public class DevToolsProperties { /** * Additional paths to watch for changes. */ - private List additionalPaths = new ArrayList(); + private List additionalPaths = new ArrayList<>(); public boolean isEnabled() { return this.enabled; @@ -112,7 +112,7 @@ public class DevToolsProperties { } public String[] getAllExclude() { - List allExclude = new ArrayList(); + List allExclude = new ArrayList<>(); if (StringUtils.hasText(this.exclude)) { allExclude.addAll(StringUtils.commaDelimitedListToSet(this.exclude)); } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java index 9aeb1eed27..c6d8823a33 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java @@ -95,9 +95,11 @@ public class RemoteDevToolsAutoConfiguration { @Bean public HandlerMapper remoteDevToolsHealthCheckHandlerMapper() { Handler handler = new HttpStatusHandler(); - return new UrlHandlerMapper((this.serverProperties.getServlet().getContextPath() == null ? "" - : this.serverProperties.getServlet().getContextPath()) - + this.properties.getRemote().getContextPath(), handler); + return new UrlHandlerMapper( + (this.serverProperties.getServlet().getContextPath() == null ? "" + : this.serverProperties.getServlet().getContextPath()) + + this.properties.getRemote().getContextPath(), + handler); } @Bean diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFolders.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFolders.java index 23bc180aa8..3237540397 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFolders.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFolders.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -38,7 +38,7 @@ public class ClassPathFolders implements Iterable { private static final Log logger = LogFactory.getLog(ClassPathFolders.class); - private final List folders = new ArrayList(); + private final List folders = new ArrayList<>(); public ClassPathFolders(URL[] urls) { if (urls != null) { diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java index 9455b07ae2..b6118cf3bc 100755 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java @@ -45,7 +45,7 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro private static final Map PROPERTIES; static { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("spring.thymeleaf.cache", "false"); properties.put("spring.freemarker.cache", "false"); properties.put("spring.groovy.template.cache", "false"); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java index 18cf85e130..0aab793d53 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -45,7 +45,7 @@ public class FileSystemWatcher { private static final long DEFAULT_QUIET_PERIOD = 400; - private final List listeners = new ArrayList(); + private final List listeners = new ArrayList<>(); private final boolean daemon; @@ -55,7 +55,7 @@ public class FileSystemWatcher { private final AtomicInteger remainingScans = new AtomicInteger(-1); - private final Map folders = new HashMap(); + private final Map folders = new HashMap<>(); private Thread watchThread; @@ -152,12 +152,11 @@ public class FileSystemWatcher { synchronized (this.monitor) { saveInitialSnapshots(); if (this.watchThread == null) { - Map localFolders = new HashMap(); + Map localFolders = new HashMap<>(); localFolders.putAll(this.folders); this.watchThread = new Thread(new Watcher(this.remainingScans, - new ArrayList(this.listeners), - this.triggerFilter, this.pollInterval, this.quietPeriod, - localFolders)); + new ArrayList<>(this.listeners), this.triggerFilter, + this.pollInterval, this.quietPeriod, localFolders)); this.watchThread.setName("File Watcher"); this.watchThread.setDaemon(this.daemon); this.watchThread.start(); @@ -276,7 +275,7 @@ public class FileSystemWatcher { } private Map getCurrentSnapshots() { - Map snapshots = new LinkedHashMap(); + Map snapshots = new LinkedHashMap<>(); for (File folder : this.folders.keySet()) { snapshots.put(folder, new FolderSnapshot(folder)); } @@ -284,8 +283,8 @@ public class FileSystemWatcher { } private void updateSnapshots(Collection snapshots) { - Map updated = new LinkedHashMap(); - Set changeSet = new LinkedHashSet(); + Map updated = new LinkedHashMap<>(); + Set changeSet = new LinkedHashSet<>(); for (FolderSnapshot snapshot : snapshots) { FolderSnapshot previous = this.folders.get(snapshot.getFolder()); updated.put(snapshot.getFolder(), snapshot); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java index 1ea0f697bc..f4a5da8907 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -38,7 +38,7 @@ import org.springframework.util.Assert; class FolderSnapshot { private static final Set DOT_FOLDERS = Collections - .unmodifiableSet(new HashSet(Arrays.asList(".", ".."))); + .unmodifiableSet(new HashSet<>(Arrays.asList(".", ".."))); private final File folder; @@ -55,7 +55,7 @@ class FolderSnapshot { Assert.isTrue(folder.isDirectory(), "Folder must not be a file"); this.folder = folder; this.time = new Date(); - Set files = new LinkedHashSet(); + Set files = new LinkedHashSet<>(); collectFiles(folder, files); this.files = Collections.unmodifiableSet(files); } @@ -80,7 +80,7 @@ class FolderSnapshot { File folder = this.folder; Assert.isTrue(snapshot.folder.equals(folder), "Snapshot source folder must be '" + folder + "'"); - Set changes = new LinkedHashSet(); + Set changes = new LinkedHashSet<>(); Map previousFiles = getFilesMap(); for (FileSnapshot currentFile : snapshot.files) { if (acceptChangedFile(triggerFilter, currentFile)) { @@ -107,7 +107,7 @@ class FolderSnapshot { } private Map getFilesMap() { - Map files = new LinkedHashMap(); + Map files = new LinkedHashMap<>(); for (FileSnapshot file : this.files) { files.put(file.getFile(), file); } @@ -141,7 +141,7 @@ class FolderSnapshot { if (filter == null) { return source; } - Set filtered = new LinkedHashSet(); + Set filtered = new LinkedHashSet<>(); for (FileSnapshot file : source) { if (filter.accept(file.getFile())) { filtered.add(file); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java index 6c736706ff..69a8d2eef7 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -56,7 +56,7 @@ public class LiveReloadServer { private final ExecutorService executor = Executors .newCachedThreadPool(new WorkerThreadFactory()); - private final List connections = new ArrayList(); + private final List connections = new ArrayList<>(); private final Object monitor = new Object(); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java index cbd5c67499..6c1bf79096 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -61,7 +61,7 @@ public class ClassPathChangeUploader private static final Map TYPE_MAPPINGS; static { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(ChangedFile.Type.ADD, ClassLoaderFile.Kind.ADDED); map.put(ChangedFile.Type.DELETE, ClassLoaderFile.Kind.DELETED); map.put(ChangedFile.Type.MODIFY, ClassLoaderFile.Kind.MODIFIED); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/Dispatcher.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/Dispatcher.java index 85b79ec644..3d4a733f65 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/Dispatcher.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/Dispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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,7 +46,7 @@ public class Dispatcher { Assert.notNull(accessManager, "AccessManager must not be null"); Assert.notNull(mappers, "Mappers must not be null"); this.accessManager = accessManager; - this.mappers = new ArrayList(mappers); + this.mappers = new ArrayList<>(mappers); AnnotationAwareOrderComparator.sort(this.mappers); } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/AgentReloader.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/AgentReloader.java index f54e9c080f..163ca20f8e 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/AgentReloader.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/AgentReloader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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 @@ public abstract class AgentReloader { private static final Set AGENT_CLASSES; static { - Set agentClasses = new LinkedHashSet(); + Set agentClasses = new LinkedHashSet<>(); agentClasses.add("org.zeroturnaround.javarebel.Integration"); agentClasses.add("org.zeroturnaround.javarebel.ReloaderFactory"); AGENT_CLASSES = Collections.unmodifiableSet(agentClasses); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java index 7d68419769..f9cf69aae5 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ final class ChangeableUrls implements Iterable { private ChangeableUrls(URL... urls) { DevToolsSettings settings = DevToolsSettings.get(); - List reloadableUrls = new ArrayList(urls.length); + List reloadableUrls = new ArrayList<>(urls.length); for (URL url : urls) { if ((settings.isRestartInclude(url) || isFolderUrl(url.toString())) && !settings.isRestartExclude(url)) { @@ -90,7 +90,7 @@ final class ChangeableUrls implements Iterable { } public static ChangeableUrls fromUrlClassLoader(URLClassLoader classLoader) { - List urls = new ArrayList(); + List urls = new ArrayList<>(); for (URL url : classLoader.getURLs()) { urls.add(url); urls.addAll(getUrlsFromClassPathOfJarManifestIfPossible(url)); @@ -136,7 +136,7 @@ final class ChangeableUrls implements Iterable { return Collections.emptyList(); } String[] entries = StringUtils.delimitedListToStringArray(classPath, " "); - List urls = new ArrayList(entries.length); + List urls = new ArrayList<>(entries.length); for (String entry : entries) { try { urls.add(new URL(base, entry)); @@ -150,7 +150,7 @@ final class ChangeableUrls implements Iterable { } public static ChangeableUrls fromUrls(Collection urls) { - return fromUrls(new ArrayList(urls).toArray(new URL[urls.size()])); + return fromUrls(new ArrayList<>(urls).toArray(new URL[urls.size()])); } public static ChangeableUrls fromUrls(URL... urls) { diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java index cbba9e9870..46b53a2777 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java @@ -108,7 +108,7 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe @Override public Resource[] getResources(String locationPattern) throws IOException { - List resources = new ArrayList(); + List resources = new ArrayList<>(); Resource[] candidates = this.patternResolverDelegate .getResources(locationPattern); for (Resource candidate : candidates) { @@ -122,7 +122,7 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe private List getAdditionalResources(String locationPattern) throws MalformedURLException { - List additionalResources = new ArrayList(); + List additionalResources = new ArrayList<>(); String trimmedLocationPattern = trimLocationPattern(locationPattern); for (SourceFolder sourceFolder : this.classLoaderFiles.getSourceFolders()) { for (Entry entry : sourceFolder.getFilesEntrySet()) { diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java index ea3b6f8e63..55b36297cb 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -36,7 +36,7 @@ public class DefaultRestartInitializer implements RestartInitializer { private static final Set SKIPPED_STACK_ELEMENTS; static { - Set skipped = new LinkedHashSet(); + Set skipped = new LinkedHashSet<>(); skipped.add("org.junit.runners."); skipped.add("org.springframework.boot.test."); skipped.add("cucumber.runtime."); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java index 0eb49b6bea..4da7159670 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -89,13 +89,13 @@ public class Restarter { private static Restarter instance; - private final Set urls = new LinkedHashSet(); + private final Set urls = new LinkedHashSet<>(); private final ClassLoaderFiles classLoaderFiles = new ClassLoaderFiles(); - private final Map attributes = new HashMap(); + private final Map attributes = new HashMap<>(); - private final BlockingDeque leakSafeThreads = new LinkedBlockingDeque(); + private final BlockingDeque leakSafeThreads = new LinkedBlockingDeque<>(); private final Lock stopLock = new ReentrantLock(); @@ -119,7 +119,7 @@ public class Restarter { private boolean finished = false; - private final List rootContexts = new CopyOnWriteArrayList(); + private final List rootContexts = new CopyOnWriteArrayList<>(); /** * Internal constructor to create a new {@link Restarter} instance. @@ -387,7 +387,7 @@ public class Restarter { */ private void forceReferenceCleanup() { try { - final List memory = new LinkedList(); + final List memory = new LinkedList<>(); while (true) { memory.add(new long[102400]); } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFiles.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFiles.java index 94d6e7859e..d8670abba8 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFiles.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFiles.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -47,7 +47,7 @@ public class ClassLoaderFiles implements ClassLoaderFileRepository, Serializable * Create a new {@link ClassLoaderFiles} instance. */ public ClassLoaderFiles() { - this.sourceFolders = new LinkedHashMap(); + this.sourceFolders = new LinkedHashMap<>(); } /** @@ -56,8 +56,7 @@ public class ClassLoaderFiles implements ClassLoaderFileRepository, Serializable */ public ClassLoaderFiles(ClassLoaderFiles classLoaderFiles) { Assert.notNull(classLoaderFiles, "ClassLoaderFiles must not be null"); - this.sourceFolders = new LinkedHashMap( - classLoaderFiles.sourceFolders); + this.sourceFolders = new LinkedHashMap<>(classLoaderFiles.sourceFolders); } /** @@ -158,7 +157,7 @@ public class ClassLoaderFiles implements ClassLoaderFileRepository, Serializable private final String name; - private final Map files = new LinkedHashMap(); + private final Map files = new LinkedHashMap<>(); SourceFolder(String name) { this.name = name; diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java index ac39e2a5fb..bad78dd338 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -98,7 +98,7 @@ public class RestartClassLoader extends URLClassLoader implements SmartClassLoad resources.nextElement(); } if (file.getKind() != Kind.DELETED) { - return new CompoundEnumeration(createFileUrl(name, file), resources); + return new CompoundEnumeration<>(createFileUrl(name, file), resources); } } return resources; diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilter.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilter.java index cad1b4d5da..20c0284371 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilter.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -41,7 +41,7 @@ public class DefaultSourceFolderUrlFilter implements SourceFolderUrlFilter { private static final Pattern VERSION_PATTERN = Pattern .compile("^-\\d+(?:\\.\\d+)*(?:[.-].+)?$"); - private static final Set SKIPPED_PROJECTS = new HashSet(Arrays.asList( + private static final Set SKIPPED_PROJECTS = new HashSet<>(Arrays.asList( "spring-boot", "spring-boot-devtools", "spring-boot-autoconfigure", "spring-boot-actuator", "spring-boot-starter")); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java index fff70e8c41..9483e0b51e 100755 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -81,7 +81,7 @@ public class RestartServer { * @param files updated class loader files */ public void updateAndRestart(ClassLoaderFiles files) { - Set urls = new LinkedHashSet(); + Set urls = new LinkedHashSet<>(); Set classLoaderUrls = getClassLoaderUrls(); for (SourceFolder folder : files.getSourceFolders()) { for (Entry entry : folder.getFilesEntrySet()) { @@ -124,7 +124,7 @@ public class RestartServer { } private Set getMatchingUrls(Set urls, String sourceFolder) { - Set matchingUrls = new LinkedHashSet(); + Set matchingUrls = new LinkedHashSet<>(); for (URL url : urls) { if (this.sourceFolderUrlFilter.isMatch(sourceFolder, url)) { if (logger.isDebugEnabled()) { @@ -138,7 +138,7 @@ public class RestartServer { } private Set getClassLoaderUrls() { - Set urls = new LinkedHashSet(); + Set urls = new LinkedHashSet<>(); ClassLoader classLoader = this.classLoader; while (classLoader != null) { if (classLoader instanceof URLClassLoader) { diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/settings/DevToolsSettings.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/settings/DevToolsSettings.java index e0a08091a0..27b528ce02 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/settings/DevToolsSettings.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/settings/DevToolsSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -47,9 +47,9 @@ public class DevToolsSettings { private static DevToolsSettings settings; - private final List restartIncludePatterns = new ArrayList(); + private final List restartIncludePatterns = new ArrayList<>(); - private final List restartExcludePatterns = new ArrayList(); + private final List restartExcludePatterns = new ArrayList<>(); DevToolsSettings() { } @@ -62,7 +62,7 @@ public class DevToolsSettings { } private Map getPatterns(Map properties, String prefix) { - Map patterns = new LinkedHashMap(); + Map patterns = new LinkedHashMap<>(); for (Map.Entry entry : properties.entrySet()) { String name = String.valueOf(entry.getKey()); if (name.startsWith(prefix)) { diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClientListeners.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClientListeners.java index 0cd704df14..e54f86ba36 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClientListeners.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClientListeners.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -29,7 +29,7 @@ import org.springframework.util.Assert; */ class TunnelClientListeners { - private final List listeners = new CopyOnWriteArrayList(); + private final List listeners = new CopyOnWriteArrayList<>(); public void addListener(TunnelClientListener listener) { Assert.notNull(listener, "Listener must not be null"); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadForwarder.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadForwarder.java index eb286bea54..d055401707 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadForwarder.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayloadForwarder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,7 +34,7 @@ public class HttpTunnelPayloadForwarder { private static final int MAXIMUM_QUEUE_SIZE = 100; - private final Map queue = new HashMap(); + private final Map queue = new HashMap<>(); private final Object monitor = new Object(); diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java index cc2c5711e3..7afb2ceb9e 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -227,7 +227,7 @@ public class HttpTunnelServer { public ServerThread(ByteChannel targetServer) { Assert.notNull(targetServer, "TargetServer must not be null"); this.targetServer = targetServer; - this.httpConnections = new ArrayDeque(2); + this.httpConnections = new ArrayDeque<>(2); this.payloadForwarder = new HttpTunnelPayloadForwarder(targetServer); } diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java index 60d9ea13d5..6f5980d615 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java @@ -167,7 +167,7 @@ public class LocalDevToolsAutoConfigurationTests { @Test public void liveReloadDisabled() throws Exception { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("spring.devtools.livereload.enabled", false); this.context = initializeAndRun(Config.class, properties); this.thrown.expect(NoSuchBeanDefinitionException.class); @@ -202,7 +202,7 @@ public class LocalDevToolsAutoConfigurationTests { @Test public void restartDisabled() throws Exception { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("spring.devtools.restart.enabled", false); this.context = initializeAndRun(Config.class, properties); this.thrown.expect(NoSuchBeanDefinitionException.class); @@ -211,7 +211,7 @@ public class LocalDevToolsAutoConfigurationTests { @Test public void restartWithTriggerFile() throws Exception { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("spring.devtools.restart.trigger-file", "somefile.txt"); this.context = initializeAndRun(Config.class, properties); ClassPathFileSystemWatcher classPathWatcher = this.context @@ -224,7 +224,7 @@ public class LocalDevToolsAutoConfigurationTests { @Test public void watchingAdditionalPaths() throws Exception { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("spring.devtools.restart.additional-paths", "src/main/java,src/test/java"); this.context = initializeAndRun(Config.class, properties); @@ -268,7 +268,7 @@ public class LocalDevToolsAutoConfigurationTests { private Map getDefaultProperties( Map specifiedProperties) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("spring.thymeleaf.check-template-location", false); properties.put("spring.devtools.livereload.port", this.liveReloadPort); properties.put("server.port", 0); @@ -307,7 +307,7 @@ public class LocalDevToolsAutoConfigurationTests { @Bean public RedisTemplate sessionRedisTemplate() { - RedisTemplate redisTemplate = new RedisTemplate(); + RedisTemplate redisTemplate = new RedisTemplate<>(); redisTemplate.setConnectionFactory(mock(RedisConnectionFactory.class)); return redisTemplate; } diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java index aaa7a53759..3c21de473e 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathChangedEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -48,7 +48,7 @@ public class ClassPathChangedEventTests { @Test public void getChangeSet() throws Exception { - Set changeSet = new LinkedHashSet(); + Set changeSet = new LinkedHashSet<>(); ClassPathChangedEvent event = new ClassPathChangedEvent(this.source, changeSet, false); assertThat(event.getChangeSet()).isSameAs(changeSet); @@ -56,7 +56,7 @@ public class ClassPathChangedEventTests { @Test public void getRestartRequired() throws Exception { - Set changeSet = new LinkedHashSet(); + Set changeSet = new LinkedHashSet<>(); ClassPathChangedEvent event; event = new ClassPathChangedEvent(this.source, changeSet, false); assertThat(event.isRestartRequired()).isFalse(); diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java index 135b604b61..6bbc692305 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -103,7 +103,7 @@ public class ClassPathFileChangeListenerTests { File file = new File("f1"); ChangedFile file1 = new ChangedFile(folder, file, ChangedFile.Type.ADD); ChangedFile file2 = new ChangedFile(folder, file, ChangedFile.Type.ADD); - Set files = new LinkedHashSet(); + Set files = new LinkedHashSet<>(); files.add(file1); files.add(file2); ChangedFiles changedFiles = new ChangedFiles(new File("source"), files); diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java index 9f5c97fb57..e2d1c4d896 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -67,9 +67,9 @@ public class ClassPathFileSystemWatcherTests { @Test public void configuredWithRestartStrategy() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - Map properties = new HashMap(); + Map properties = new HashMap<>(); File folder = this.temp.newFolder(); - List urls = new ArrayList(); + List urls = new ArrayList<>(); urls.add(new URL("http://spring.io")); urls.add(folder.toURI().toURL()); properties.put("urls", urls); @@ -132,7 +132,7 @@ public class ClassPathFileSystemWatcherTests { public static class Listener implements ApplicationListener { - private List events = new ArrayList(); + private List events = new ArrayList<>(); @Override public void onApplicationEvent(ClassPathChangedEvent event) { diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java index a39f2a3a8f..03ceb3c215 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java @@ -219,7 +219,7 @@ public class FileSystemWatcherTests { @Test public void multipleListeners() throws Exception { File folder = this.temp.newFolder(); - final Set listener2Changes = new LinkedHashSet(); + final Set listener2Changes = new LinkedHashSet<>(); this.watcher.addSourceFolder(folder); this.watcher.addListener(new FileChangeListener() { @Override @@ -249,7 +249,7 @@ public class FileSystemWatcherTests { this.watcher.stopAfter(1); ChangedFiles changedFiles = getSingleChangedFiles(); Set actual = changedFiles.getFiles(); - Set expected = new HashSet(); + Set expected = new HashSet<>(); expected.add(new ChangedFile(folder, modify, Type.MODIFY)); expected.add(new ChangedFile(folder, delete, Type.DELETE)); expected.add(new ChangedFile(folder, add, Type.ADD)); @@ -278,7 +278,7 @@ public class FileSystemWatcherTests { this.watcher.stopAfter(1); ChangedFiles changedFiles = getSingleChangedFiles(); Set actual = changedFiles.getFiles(); - Set expected = new HashSet(); + Set expected = new HashSet<>(); expected.add(new ChangedFile(folder, file, Type.MODIFY)); assertThat(actual).isEqualTo(expected); } diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java index 5fd384e9f2..f2df9ec91a 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -156,7 +156,7 @@ public class LiveReloadServerTests { */ private static class MonitoredLiveReloadServer extends LiveReloadServer { - private final List closedExceptions = new ArrayList(); + private final List closedExceptions = new ArrayList<>(); private final Object monitor = new Object(); @@ -172,7 +172,7 @@ public class LiveReloadServerTests { public List getClosedExceptions() { synchronized (this.monitor) { - return new ArrayList(this.closedExceptions); + return new ArrayList<>(this.closedExceptions); } } @@ -207,7 +207,7 @@ public class LiveReloadServerTests { private final CountDownLatch helloLatch = new CountDownLatch(2); - private final List messages = new ArrayList(); + private final List messages = new ArrayList<>(); private int pongCount; diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java index f1158bf5c3..b7c9598406 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -145,14 +145,14 @@ public class ClassPathChangeUploaderTests { private ClassPathChangedEvent createClassPathChangedEvent(File sourceFolder) throws IOException { - Set files = new LinkedHashSet(); + Set files = new LinkedHashSet<>(); File file1 = createFile(sourceFolder, "File1"); File file2 = createFile(sourceFolder, "File2"); File file3 = createFile(sourceFolder, "File3"); files.add(new ChangedFile(sourceFolder, file1, Type.ADD)); files.add(new ChangedFile(sourceFolder, file2, Type.MODIFY)); files.add(new ChangedFile(sourceFolder, file3, Type.DELETE)); - Set changeSet = new LinkedHashSet(); + Set changeSet = new LinkedHashSet<>(); changeSet.add(new ChangedFiles(sourceFolder, files)); ClassPathChangedEvent event = new ClassPathChangedEvent(this, changeSet, false); return event; diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java index 95e293c182..9241e66d1e 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java @@ -112,7 +112,7 @@ public class RemoteClientConfigurationTests { @Test public void liveReloadOnClassPathChanged() throws Exception { configure(); - Set changeSet = new HashSet(); + Set changeSet = new HashSet<>(); ClassPathChangedEvent event = new ClassPathChangedEvent(this, changeSet, false); this.context.publishEvent(event); LiveReloadConfiguration configuration = this.context diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java index deb64e5784..4bd5c0c0b1 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MainMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -37,7 +37,7 @@ public class MainMethodTests { @Rule public ExpectedException thrown = ExpectedException.none(); - private static ThreadLocal mainMethod = new ThreadLocal(); + private static ThreadLocal mainMethod = new ThreadLocal<>(); private Method actualMain; diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java index da0889fa10..c315b762ac 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java @@ -41,7 +41,7 @@ import static org.mockito.Mockito.mock; */ public class MockRestarter implements TestRule { - private Map attributes = new HashMap(); + private Map attributes = new HashMap<>(); private Restarter mock = mock(Restarter.class); diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java index 1ad2954ac4..1060f03951 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java @@ -214,7 +214,7 @@ public class RestartClassLoaderTests { } private List toList(Enumeration enumeration) { - List list = new ArrayList(); + List list = new ArrayList<>(); if (enumeration != null) { while (enumeration.hasMoreElements()) { list.add(enumeration.nextElement()); diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilterTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilterTests.java index 29ce5038e9..f530257b48 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilterTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/DefaultSourceFolderUrlFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -38,7 +38,7 @@ public class DefaultSourceFolderUrlFilterTests { private static final List COMMON_POSTFIXES; static { - List postfixes = new ArrayList(); + List postfixes = new ArrayList<>(); postfixes.add(".jar"); postfixes.add("-1.3.0.jar"); postfixes.add("-1.3.0-SNAPSHOT.jar"); @@ -105,7 +105,7 @@ public class DefaultSourceFolderUrlFilterTests { } private List getUrls(String name) throws MalformedURLException { - List urls = new ArrayList(); + List urls = new ArrayList<>(); urls.add(new URL("file:/some/path/" + name)); urls.add(new URL("file:/some/path/" + name + "!/")); for (String postfix : COMMON_POSTFIXES) { diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/RestartServerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/RestartServerTests.java index 3964f7c4be..e2a9c4979f 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/RestartServerTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/RestartServerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -73,7 +73,7 @@ public class RestartServerTests { files.addFile("my/module-a", "ClassA.class", fileA); files.addFile("my/module-c", "ClassB.class", fileB); server.updateAndRestart(files); - Set expectedUrls = new LinkedHashSet(Arrays.asList(url1, url3)); + Set expectedUrls = new LinkedHashSet<>(Arrays.asList(url1, url3)); assertThat(server.restartUrls).isEqualTo(expectedUrls); assertThat(server.restartFiles).isEqualTo(files); } diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java index 3d10375c60..a144f58a6e 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -43,9 +43,9 @@ public class MockClientHttpRequestFactory implements ClientHttpRequestFactory { private AtomicLong seq = new AtomicLong(); - private Deque responses = new ArrayDeque(); + private Deque responses = new ArrayDeque<>(); - private List executedRequests = new ArrayList(); + private List executedRequests = new ArrayList<>(); @Override public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java index d81cc70226..e8a7d17931 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServerTests.java @@ -345,7 +345,7 @@ public class HttpTunnelServerTests { private int timeout; - private BlockingDeque outgoing = new LinkedBlockingDeque(); + private BlockingDeque outgoing = new LinkedBlockingDeque<>(); private ByteArrayOutputStream written = new ByteArrayOutputStream(); diff --git a/spring-boot-docs/src/main/java/org/springframework/boot/kafka/KafkaSpecialProducerConsumerConfigExample.java b/spring-boot-docs/src/main/java/org/springframework/boot/kafka/KafkaSpecialProducerConsumerConfigExample.java index c3e46a4d9a..ae859a7478 100644 --- a/spring-boot-docs/src/main/java/org/springframework/boot/kafka/KafkaSpecialProducerConsumerConfigExample.java +++ b/spring-boot-docs/src/main/java/org/springframework/boot/kafka/KafkaSpecialProducerConsumerConfigExample.java @@ -54,7 +54,7 @@ public class KafkaSpecialProducerConsumerConfigExample { Map producerProperties = properties.buildProducerProperties(); producerProperties.put(CommonClientConfigs.METRIC_REPORTER_CLASSES_CONFIG, MyProducerMetricsReporter.class); - return new DefaultKafkaProducerFactory(producerProperties); + return new DefaultKafkaProducerFactory<>(producerProperties); } /** @@ -67,7 +67,7 @@ public class KafkaSpecialProducerConsumerConfigExample { Map consumerProperties = properties.buildConsumerProperties(); consumerProperties.put(CommonClientConfigs.METRIC_REPORTER_CLASSES_CONFIG, MyConsumerMetricsReporter.class); - return new DefaultKafkaConsumerFactory(consumerProperties); + return new DefaultKafkaConsumerFactory<>(consumerProperties); } } diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FullyExecutableJarTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FullyExecutableJarTests.java index ffdfc54267..c90f1fc40d 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FullyExecutableJarTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FullyExecutableJarTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -165,7 +165,7 @@ public class FullyExecutableJarTests { private List readLines(File file) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(file)); - List lines = new ArrayList(); + List lines = new ArrayList<>(); try { String line = reader.readLine(); while (line != null && lines.size() < 50) { diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java index 10d0005b03..da131ea2be 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -60,7 +60,7 @@ public class SpringLoadedTests { BufferedReader reader = new BufferedReader(new FileReader( new File("target/spring-loaded-jvm-args/build/output.txt"))); try { - List lines = new ArrayList(); + List lines = new ArrayList<>(); String line; diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java index 809228541d..8e1918c4b3 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -44,11 +44,11 @@ public class WarPackagingTests { private static final String WEB_INF_LIB_PREFIX = "WEB-INF/lib/"; - private static final Set TOMCAT_EXPECTED_IN_WEB_INF_LIB_PROVIDED = new HashSet( + private static final Set TOMCAT_EXPECTED_IN_WEB_INF_LIB_PROVIDED = new HashSet<>( Arrays.asList("spring-boot-starter-tomcat-", "tomcat-embed-core-", "tomcat-embed-el-", "tomcat-embed-websocket-")); - private static final Set JETTY_EXPECTED_IN_WEB_INF_LIB_PROVIDED = new HashSet( + private static final Set JETTY_EXPECTED_IN_WEB_INF_LIB_PROVIDED = new HashSet<>( Arrays.asList("spring-boot-starter-jetty-", "jetty-continuation", "jetty-util-", "javax.servlet-", "jetty-client", "jetty-io-", "jetty-http-", "jetty-server-", "jetty-security-", "jetty-servlet-", @@ -105,7 +105,7 @@ public class WarPackagingTests { throws IOException { Set entries = getWebInfLibProvidedEntries(war); assertThat(entries).hasSameSizeAs(expectedEntries); - List unexpectedLibProvidedEntries = new ArrayList(); + List unexpectedLibProvidedEntries = new ArrayList<>(); for (String entry : entries) { if (!isExpectedInWebInfLibProvided(entry, expectedEntries)) { unexpectedLibProvidedEntries.add(entry); @@ -117,7 +117,7 @@ public class WarPackagingTests { private void checkWebInfLibEntries(JarFile war, Set entriesOnlyInLibProvided) throws IOException { Set entries = getWebInfLibEntries(war); - List unexpectedLibEntries = new ArrayList(); + List unexpectedLibEntries = new ArrayList<>(); for (String entry : entries) { if (!isExpectedInWebInfLib(entry, entriesOnlyInLibProvided)) { unexpectedLibEntries.add(entry); @@ -127,7 +127,7 @@ public class WarPackagingTests { } private Set getWebInfLibProvidedEntries(JarFile war) throws IOException { - Set webInfLibProvidedEntries = new HashSet(); + Set webInfLibProvidedEntries = new HashSet<>(); Enumeration entries = war.entries(); while (entries.hasMoreElements()) { String name = entries.nextElement().getName(); @@ -139,7 +139,7 @@ public class WarPackagingTests { } private Set getWebInfLibEntries(JarFile war) throws IOException { - Set webInfLibEntries = new HashSet(); + Set webInfLibEntries = new HashSet<>(); Enumeration entries = war.entries(); while (entries.hasMoreElements()) { String name = entries.nextElement().getName(); diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java index f19197b976..f8d2fc7922 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java @@ -58,7 +58,7 @@ public class StarterDependenciesIntegrationTests { @Parameters public static List getStarters() { - List starters = new ArrayList(); + List starters = new ArrayList<>(); for (File file : new File("../../spring-boot-starters").listFiles()) { if (file.isDirectory() && new File(file, "pom.xml").exists()) { String name = file.getName(); diff --git a/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java b/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java index bd16fdf01b..3c192162ec 100644 --- a/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java +++ b/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java @@ -65,7 +65,7 @@ abstract class AbstractApplicationLauncher extends ExternalResource { private Process startApplication() throws Exception { this.serverPortFile.delete(); File archive = this.applicationBuilder.buildApplication(); - List arguments = new ArrayList(); + List arguments = new ArrayList<>(); arguments.add(System.getProperty("java.home") + "/bin/java"); arguments.addAll(getArguments(archive)); ProcessBuilder processBuilder = new ProcessBuilder( diff --git a/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerIntegrationTests.java b/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerIntegrationTests.java index f318cf3c07..fd6638fe23 100644 --- a/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerIntegrationTests.java +++ b/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerIntegrationTests.java @@ -48,7 +48,7 @@ public abstract class AbstractEmbeddedServletContainerIntegrationTests { protected final RestTemplate rest = new RestTemplate(); public static Object[] parameters(String packaging) { - List parameters = new ArrayList(); + List parameters = new ArrayList<>(); parameters.addAll(createParameters(packaging, "jetty")); parameters.addAll(createParameters(packaging, "tomcat")); parameters.addAll(createParameters(packaging, "undertow")); @@ -57,7 +57,7 @@ public abstract class AbstractEmbeddedServletContainerIntegrationTests { private static List createParameters(String packaging, String container, String... versions) { - List parameters = new ArrayList(); + List parameters = new ArrayList<>(); ApplicationBuilder applicationBuilder = new ApplicationBuilder(temporaryFolder, packaging, container); parameters.add(new Object[] { diff --git a/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/ApplicationBuilder.java b/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/ApplicationBuilder.java index 8685ff9576..cb439df345 100644 --- a/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/ApplicationBuilder.java +++ b/spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/ApplicationBuilder.java @@ -98,7 +98,7 @@ class ApplicationBuilder { private void writePom(File appFolder, File resourcesJar) throws FileNotFoundException, IOException { - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("packaging", this.packaging); context.put("container", this.container); context.put("bootVersion", Versions.getBootVersion()); diff --git a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java index 57f44a7646..0a18899e01 100644 --- a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java +++ b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -73,7 +73,7 @@ public class SysVinitLaunchScriptIT { @Parameters(name = "{0} {1}") public static List parameters() { - List parameters = new ArrayList(); + List parameters = new ArrayList<>(); for (File os : new File("src/test/resources/conf").listFiles()) { for (File version : os.listFiles()) { parameters.add(new Object[] { os.getName(), version.getName() }); diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/main/java/sample/actuator/SampleController.java b/spring-boot-samples/spring-boot-sample-actuator/src/main/java/sample/actuator/SampleController.java index 1dcc6054e2..3cd2396e5e 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/main/java/sample/actuator/SampleController.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/main/java/sample/actuator/SampleController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -51,7 +51,7 @@ public class SampleController { @PostMapping("/") @ResponseBody public Map olleh(@Validated Message message) { - Map model = new LinkedHashMap(); + Map model = new LinkedHashMap<>(); model.put("message", message.getValue()); model.put("title", "Hello Home"); model.put("date", new Date()); diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java index 29d036addf..24844bf9d3 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java @@ -48,7 +48,7 @@ public class SampleAtmosphereApplication { public ServletRegistrationBean atmosphereServlet() { // Dispatcher servlet is mapped to '/home' to allow the AtmosphereServlet // to be mapped to '/chat' - ServletRegistrationBean registration = new ServletRegistrationBean( + ServletRegistrationBean registration = new ServletRegistrationBean<>( new AtmosphereServlet(), "/chat/*"); registration.addInitParameter("org.atmosphere.cpr.packages", "sample"); registration.addInitParameter("org.atmosphere.interceptor.HeartbeatInterceptor" diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java index af9dbc744e..ea4e3212f2 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java @@ -79,7 +79,7 @@ public class SampleAtmosphereApplicationTests { private final CountDownLatch latch = new CountDownLatch(1); - private final AtomicReference messagePayload = new AtomicReference(); + private final AtomicReference messagePayload = new AtomicReference<>(); @Override public void run(String... args) throws Exception { diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java index 85c05d22f9..5a1ecf464c 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -83,7 +83,7 @@ class HotelServiceImpl implements HotelService { private final Map ratingCount; public ReviewsSummaryImpl(List ratingCounts) { - this.ratingCount = new HashMap(); + this.ratingCount = new HashMap<>(); for (RatingCount ratingCount : ratingCounts) { this.ratingCount.put(ratingCount.getRating(), ratingCount.getCount()); } diff --git a/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/InMemoryCustomerRepository.java b/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/InMemoryCustomerRepository.java index c1783ebb65..793e56cd00 100644 --- a/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/InMemoryCustomerRepository.java +++ b/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/InMemoryCustomerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -25,7 +25,7 @@ import org.springframework.util.ObjectUtils; @Repository public class InMemoryCustomerRepository implements CustomerRepository { - private final List customers = new ArrayList(); + private final List customers = new ArrayList<>(); public InMemoryCustomerRepository() { this.customers.add(new Customer(1L, "Oliver", "Gierke")); diff --git a/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java b/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java index 87c9bfdc6b..1412771860 100644 --- a/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java +++ b/spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -48,17 +48,16 @@ public class CustomerController { @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) HttpEntity> showCustomers() { - Resources resources = new Resources( - this.repository.findAll()); + Resources resources = new Resources<>(this.repository.findAll()); resources.add(this.entityLinks.linkToCollectionResource(Customer.class)); - return new ResponseEntity>(resources, HttpStatus.OK); + return new ResponseEntity<>(resources, HttpStatus.OK); } @GetMapping(path = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) HttpEntity> showCustomer(@PathVariable Long id) { - Resource resource = new Resource(this.repository.findOne(id)); + Resource resource = new Resource<>(this.repository.findOne(id)); resource.add(this.entityLinks.linkToSingleResource(Customer.class, id)); - return new ResponseEntity>(resource, HttpStatus.OK); + return new ResponseEntity<>(resource, HttpStatus.OK); } } diff --git a/spring-boot-samples/spring-boot-sample-jersey1/src/main/java/sample/jersey1/SampleJersey1Application.java b/spring-boot-samples/spring-boot-sample-jersey1/src/main/java/sample/jersey1/SampleJersey1Application.java index 9e75ba7c00..8b4fdb5983 100644 --- a/spring-boot-samples/spring-boot-sample-jersey1/src/main/java/sample/jersey1/SampleJersey1Application.java +++ b/spring-boot-samples/spring-boot-sample-jersey1/src/main/java/sample/jersey1/SampleJersey1Application.java @@ -47,7 +47,7 @@ public class SampleJersey1Application { @Bean public FilterRegistrationBean jersey() { - FilterRegistrationBean bean = new FilterRegistrationBean(); + FilterRegistrationBean bean = new FilterRegistrationBean<>(); bean.setFilter(new ServletContainer()); bean.addInitParameter("com.sun.jersey.config.property.packages", "com.sun.jersey;sample.jersey1"); diff --git a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java index 3a2ea9b7ef..91912ccce3 100644 --- a/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -63,7 +63,7 @@ public class SampleJettyApplicationTests { public void testCompression() throws Exception { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.set("Accept-Encoding", "gzip"); - HttpEntity requestEntity = new HttpEntity(requestHeaders); + HttpEntity requestEntity = new HttpEntity<>(requestHeaders); ResponseEntity entity = this.restTemplate.exchange("/", HttpMethod.GET, requestEntity, byte[].class); diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Author.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Author.java index 0052e031c3..70f5bae490 100644 --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Author.java +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Author.java @@ -133,6 +133,7 @@ public class Author extends TableImpl { /** * Rename this table */ + @Override public Author rename(String name) { return new Author(name, null); } diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Book.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Book.java index b987e2f5b6..8b90b902c4 100644 --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Book.java +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Book.java @@ -136,6 +136,7 @@ public class Book extends TableImpl { /** * Rename this table */ + @Override public Book rename(String name) { return new Book(name, null); } diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/BookStore.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/BookStore.java index a4025863c5..6bb06ff4a4 100644 --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/BookStore.java +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/BookStore.java @@ -94,6 +94,7 @@ public class BookStore extends TableImpl { /** * Rename this table */ + @Override public BookStore rename(String name) { return new BookStore(name, null); } diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/BookToBookStore.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/BookToBookStore.java index fa5ea67190..87dcc42d62 100644 --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/BookToBookStore.java +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/BookToBookStore.java @@ -124,6 +124,7 @@ public class BookToBookStore extends TableImpl { /** * Rename this table */ + @Override public BookToBookStore rename(String name) { return new BookToBookStore(name, null); } diff --git a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Language.java b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Language.java index a8f9d51578..6c90114549 100644 --- a/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Language.java +++ b/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Language.java @@ -114,6 +114,7 @@ public class Language extends TableImpl { /** * Rename this table */ + @Override public Language rename(String name) { return new Language(name, null); } diff --git a/spring-boot-samples/spring-boot-sample-session-redis/src/test/java/sample/session/redis/SampleSessionRedisApplicationTests.java b/spring-boot-samples/spring-boot-sample-session-redis/src/test/java/sample/session/redis/SampleSessionRedisApplicationTests.java index a18af63950..9cb3e27ddb 100644 --- a/spring-boot-samples/spring-boot-sample-session-redis/src/test/java/sample/session/redis/SampleSessionRedisApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-session-redis/src/test/java/sample/session/redis/SampleSessionRedisApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -67,8 +67,8 @@ public class SampleSessionRedisApplicationTests { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.set("Cookie", response.getHeaders().getFirst("Set-Cookie")); - RequestEntity request = new RequestEntity(requestHeaders, - HttpMethod.GET, uri); + RequestEntity request = new RequestEntity<>(requestHeaders, HttpMethod.GET, + uri); String uuid2 = restTemplate.exchange(request, String.class).getBody(); assertThat(uuid1).isEqualTo(uuid2); diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java index 235565edfb..5055992802 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java @@ -71,7 +71,7 @@ public class SampleTomcatApplicationTests { public void testCompression() throws Exception { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.set("Accept-Encoding", "gzip"); - HttpEntity requestEntity = new HttpEntity(requestHeaders); + HttpEntity requestEntity = new HttpEntity<>(requestHeaders); ResponseEntity entity = this.restTemplate.exchange("/", HttpMethod.GET, requestEntity, byte[].class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java index 05ee9d4d39..3b964e191f 100644 --- a/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -66,7 +66,7 @@ public class SampleUndertowApplicationTests { public void testCompression() throws Exception { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.set("Accept-Encoding", "gzip"); - HttpEntity requestEntity = new HttpEntity(requestHeaders); + HttpEntity requestEntity = new HttpEntity<>(requestHeaders); ResponseEntity entity = this.restTemplate.exchange("/", HttpMethod.GET, requestEntity, byte[].class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java index 1adec7ff61..754badaee0 100644 --- a/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 SampleWebFreeMarkerApplicationTests { public void testFreeMarkerErrorTemplate() throws Exception { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); - HttpEntity requestEntity = new HttpEntity(headers); + HttpEntity requestEntity = new HttpEntity<>(headers); ResponseEntity responseEntity = this.testRestTemplate .exchange("/does-not-exist", HttpMethod.GET, requestEntity, String.class); diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/InMemoryMessageRepository.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/InMemoryMessageRepository.java index 626b83064d..0fe40f2c0c 100644 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/InMemoryMessageRepository.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/InMemoryMessageRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -24,7 +24,7 @@ public class InMemoryMessageRepository implements MessageRepository { private static AtomicLong counter = new AtomicLong(); - private final ConcurrentMap messages = new ConcurrentHashMap(); + private final ConcurrentMap messages = new ConcurrentHashMap<>(); @Override public Iterable findAll() { diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/mvc/MessageController.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/mvc/MessageController.java index 89bb290970..eb2fe29426 100644 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/mvc/MessageController.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/mvc/MessageController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -77,7 +77,7 @@ public class MessageController { } private Map getFieldErrors(BindingResult result) { - Map map = new HashMap(); + Map map = new HashMap<>(); for (FieldError error : result.getFieldErrors()) { map.put(error.getField(), error); } diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java index 108f13c16f..cf0fd812e3 100644 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -61,7 +61,7 @@ public class SampleGroovyTemplateApplicationTests { @Test public void testCreate() throws Exception { - MultiValueMap map = new LinkedMultiValueMap(); + MultiValueMap map = new LinkedMultiValueMap<>(); map.set("text", "FOO text"); map.set("summary", "FOO"); URI location = this.restTemplate.postForLocation("/", map); diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java index fa23d46567..695b23ec6f 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -72,14 +72,12 @@ public class SampleMethodSecurityApplicationTests { public void testLogin() throws Exception { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); - MultiValueMap form = new LinkedMultiValueMap(); + MultiValueMap form = new LinkedMultiValueMap<>(); form.set("username", "admin"); form.set("password", "admin"); getCsrf(form, headers); ResponseEntity entity = this.restTemplate.exchange("/login", - HttpMethod.POST, - new HttpEntity>(form, headers), - String.class); + HttpMethod.POST, new HttpEntity<>(form, headers), String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND); assertThat(entity.getHeaders().getLocation().toString()) .isEqualTo("http://localhost:" + this.port + "/"); @@ -89,14 +87,12 @@ public class SampleMethodSecurityApplicationTests { public void testDenied() throws Exception { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); - MultiValueMap form = new LinkedMultiValueMap(); + MultiValueMap form = new LinkedMultiValueMap<>(); form.set("username", "user"); form.set("password", "user"); getCsrf(form, headers); ResponseEntity entity = this.restTemplate.exchange("/login", - HttpMethod.POST, - new HttpEntity>(form, headers), - String.class); + HttpMethod.POST, new HttpEntity<>(form, headers), String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND); String cookie = entity.getHeaders().getFirst("Set-Cookie"); headers.set("Cookie", cookie); diff --git a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java index 397b232481..029ff9798a 100644 --- a/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -61,7 +61,7 @@ public class SampleWebMustacheApplicationTests { public void testMustacheErrorTemplate() throws Exception { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); - HttpEntity requestEntity = new HttpEntity(headers); + HttpEntity requestEntity = new HttpEntity<>(headers); ResponseEntity responseEntity = this.restTemplate .exchange("/does-not-exist", HttpMethod.GET, requestEntity, String.class); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); @@ -73,7 +73,7 @@ public class SampleWebMustacheApplicationTests { public void test503HtmlResource() throws Exception { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); - HttpEntity requestEntity = new HttpEntity(headers); + HttpEntity requestEntity = new HttpEntity<>(headers); ResponseEntity entity = this.restTemplate.exchange("/serviceUnavailable", HttpMethod.GET, requestEntity, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.SERVICE_UNAVAILABLE); @@ -84,7 +84,7 @@ public class SampleWebMustacheApplicationTests { public void test5xxHtmlResource() throws Exception { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); - HttpEntity requestEntity = new HttpEntity(headers); + HttpEntity requestEntity = new HttpEntity<>(headers); ResponseEntity entity = this.restTemplate.exchange("/bang", HttpMethod.GET, requestEntity, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); @@ -95,7 +95,7 @@ public class SampleWebMustacheApplicationTests { public void test507Template() throws Exception { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); - HttpEntity requestEntity = new HttpEntity(headers); + HttpEntity requestEntity = new HttpEntity<>(headers); ResponseEntity entity = this.restTemplate.exchange("/insufficientStorage", HttpMethod.GET, requestEntity, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INSUFFICIENT_STORAGE); diff --git a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java index 70f83cc19c..70d5ca2086 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -83,13 +83,11 @@ public class SampleWebSecureCustomApplicationTests { HttpHeaders headers = getHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - MultiValueMap form = new LinkedMultiValueMap(); + MultiValueMap form = new LinkedMultiValueMap<>(); form.set("username", "user"); form.set("password", "user"); ResponseEntity entity = this.restTemplate.exchange("/login", - HttpMethod.POST, - new HttpEntity>(form, headers), - String.class); + HttpMethod.POST, new HttpEntity<>(form, headers), String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND); assertThat(entity.getHeaders().getLocation().toString()) .endsWith(this.port + "/"); diff --git a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java index 644b9815ee..00b9109856 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -83,13 +83,11 @@ public class SampleWebSecureJdbcApplicationTests { HttpHeaders headers = getHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - MultiValueMap form = new LinkedMultiValueMap(); + MultiValueMap form = new LinkedMultiValueMap<>(); form.set("username", "user"); form.set("password", "user"); ResponseEntity entity = this.restTemplate.exchange("/login", - HttpMethod.POST, - new HttpEntity>(form, headers), - String.class); + HttpMethod.POST, new HttpEntity<>(form, headers), String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND); assertThat(entity.getHeaders().getLocation().toString()) .endsWith(this.port + "/"); diff --git a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java index 098e28f781..5eec9ec8c9 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -83,13 +83,11 @@ public class SampleSecureApplicationTests { HttpHeaders headers = getHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - MultiValueMap form = new LinkedMultiValueMap(); + MultiValueMap form = new LinkedMultiValueMap<>(); form.set("username", "user"); form.set("password", "user"); ResponseEntity entity = this.restTemplate.exchange("/login", - HttpMethod.POST, - new HttpEntity>(form, headers), - String.class); + HttpMethod.POST, new HttpEntity<>(form, headers), String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND); assertThat(entity.getHeaders().getLocation().toString()) .endsWith(this.port + "/"); diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/InMemoryMessageRepository.java b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/InMemoryMessageRepository.java index af360eff42..4d3c372752 100755 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/InMemoryMessageRepository.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/InMemoryMessageRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -27,7 +27,7 @@ public class InMemoryMessageRepository implements MessageRepository { private static AtomicLong counter = new AtomicLong(); - private final ConcurrentMap messages = new ConcurrentHashMap(); + private final ConcurrentMap messages = new ConcurrentHashMap<>(); @Override public Iterable findAll() { diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java index 57c81c8bf4..d7b998ac66 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -61,7 +61,7 @@ public class SampleWebUiApplicationTests { @Test public void testCreate() throws Exception { - MultiValueMap map = new LinkedMultiValueMap(); + MultiValueMap map = new LinkedMultiValueMap<>(); map.set("text", "FOO text"); map.set("summary", "FOO"); URI location = this.restTemplate.postForLocation("/", map); diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java index a819650835..39ffc8de80 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java @@ -28,7 +28,7 @@ public class Snake { private static final int DEFAULT_LENGTH = 5; - private final Deque tail = new ArrayDeque(); + private final Deque tail = new ArrayDeque<>(); private final Object monitor = new Object(); diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java index d78a40ff9e..af0d7c6526 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java @@ -39,7 +39,7 @@ public class SnakeTimer { private static final Logger log = LoggerFactory.getLogger(SnakeTimer.class); - private static final ConcurrentHashMap snakes = new ConcurrentHashMap(); + private static final ConcurrentHashMap snakes = new ConcurrentHashMap<>(); private static Timer gameTimer = null; diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java index 134d8767e1..6136a8e077 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java @@ -94,7 +94,7 @@ public class SampleWebSocketsApplicationTests { private final CountDownLatch latch = new CountDownLatch(1); - private final AtomicReference messagePayload = new AtomicReference(); + private final AtomicReference messagePayload = new AtomicReference<>(); @Override public void run(String... args) throws Exception { diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java index a9efbc260c..3364dd9961 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/echo/CustomContainerWebSocketsApplicationTests.java @@ -109,7 +109,7 @@ public class CustomContainerWebSocketsApplicationTests { private final CountDownLatch latch = new CountDownLatch(1); - private final AtomicReference messagePayload = new AtomicReference(); + private final AtomicReference messagePayload = new AtomicReference<>(); @Override public void run(String... args) throws Exception { diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java index ce0eec69d8..d19cd4f549 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java @@ -28,7 +28,7 @@ public class Snake { private static final int DEFAULT_LENGTH = 5; - private final Deque tail = new ArrayDeque(); + private final Deque tail = new ArrayDeque<>(); private final Object monitor = new Object(); diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java index 07f5ecc558..b8d60600cd 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java @@ -39,7 +39,7 @@ public class SnakeTimer { private static final Log log = LogFactory.getLog(SnakeTimer.class); - private static final ConcurrentHashMap snakes = new ConcurrentHashMap(); + private static final ConcurrentHashMap snakes = new ConcurrentHashMap<>(); private static Timer gameTimer = null; diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java index 83bf872272..0cff500d18 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java @@ -94,7 +94,7 @@ public class SampleWebSocketsApplicationTests { private final CountDownLatch latch = new CountDownLatch(1); - private final AtomicReference messagePayload = new AtomicReference(); + private final AtomicReference messagePayload = new AtomicReference<>(); @Override public void run(String... args) throws Exception { diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java index 2a9c7d9cf4..81155eeb23 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/echo/CustomContainerWebSocketsApplicationTests.java @@ -109,7 +109,7 @@ public class CustomContainerWebSocketsApplicationTests { private final CountDownLatch latch = new CountDownLatch(1); - private final AtomicReference messagePayload = new AtomicReference(); + private final AtomicReference messagePayload = new AtomicReference<>(); @Override public void run(String... args) throws Exception { diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java index ba95f12688..78b6b044b4 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java @@ -28,7 +28,7 @@ public class Snake { private static final int DEFAULT_LENGTH = 5; - private final Deque tail = new ArrayDeque(); + private final Deque tail = new ArrayDeque<>(); private final Object monitor = new Object(); diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java index 3f76cbe03a..7c78c3e1df 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java @@ -39,7 +39,7 @@ public class SnakeTimer { private static final Logger log = LoggerFactory.getLogger(SnakeTimer.class); - private static final ConcurrentHashMap snakes = new ConcurrentHashMap(); + private static final ConcurrentHashMap snakes = new ConcurrentHashMap<>(); private static Timer gameTimer = null; diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java index 383b3a478c..80d6032af0 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java @@ -94,7 +94,7 @@ public class SampleWebSocketsApplicationTests { private final CountDownLatch latch = new CountDownLatch(1); - private final AtomicReference messagePayload = new AtomicReference(); + private final AtomicReference messagePayload = new AtomicReference<>(); @Override public void run(String... args) throws Exception { diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java index 329840959f..8dedb17e0d 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/echo/CustomContainerWebSocketsApplicationTests.java @@ -109,7 +109,7 @@ public class CustomContainerWebSocketsApplicationTests { private final CountDownLatch latch = new CountDownLatch(1); - private final AtomicReference messagePayload = new AtomicReference(); + private final AtomicReference messagePayload = new AtomicReference<>(); @Override public void run(String... args) throws Exception { diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java index bf44fdd2a9..0663bc5add 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java @@ -74,8 +74,7 @@ public class JsonTestersAutoConfiguration { @ConditionalOnBean(ObjectMapper.class) public FactoryBean> jacksonTesterFactoryBean( ObjectMapper mapper) { - return new JsonTesterFactoryBean<>( - JacksonTester.class, mapper); + return new JsonTesterFactoryBean<>(JacksonTester.class, mapper); } } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java index b77a7dffb9..7d761fac2b 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java @@ -231,7 +231,7 @@ class ImportsContextCustomizer implements ContextCustomizer { private static final Set ANNOTATION_FILTERS; static { - Set filters = new HashSet(); + Set filters = new HashSet<>(); filters.add(new JavaLangAnnotationFilter()); filters.add(new KotlinAnnotationFilter()); filters.add(new SpockAnnotationFilter()); @@ -241,8 +241,8 @@ class ImportsContextCustomizer implements ContextCustomizer { private final Set key; ContextCustomizerKey(Class testClass) { - Set annotations = new HashSet(); - Set> seen = new HashSet>(); + Set annotations = new HashSet<>(); + Set> seen = new HashSet<>(); collectClassAnnotations(testClass, annotations, seen); Set determinedImports = determineImports(annotations, testClass); this.key = Collections.unmodifiableSet( @@ -284,7 +284,7 @@ class ImportsContextCustomizer implements ContextCustomizer { private Set determineImports(Set annotations, Class testClass) { - Set determinedImports = new LinkedHashSet(); + Set determinedImports = new LinkedHashSet<>(); AnnotationMetadata testClassMetadata = new StandardAnnotationMetadata( testClass); for (Annotation annotation : annotations) { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java index 8f3ee51196..6847c5162e 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java @@ -83,7 +83,7 @@ public class SpringBootContextLoader extends AbstractContextLoader { private static final Set INTEGRATION_TEST_ANNOTATIONS; static { - Set annotations = new LinkedHashSet(); + Set annotations = new LinkedHashSet<>(); annotations.add("org.springframework.boot.test.IntegrationTest"); annotations.add("org.springframework.boot.test.WebIntegrationTest"); INTEGRATION_TEST_ANNOTATIONS = Collections.unmodifiableSet(annotations); @@ -139,7 +139,7 @@ public class SpringBootContextLoader extends AbstractContextLoader { } private Set getSources(MergedContextConfiguration mergedConfig) { - Set sources = new LinkedHashSet(); + Set sources = new LinkedHashSet<>(); sources.addAll(Arrays.asList(mergedConfig.getClasses())); sources.addAll(Arrays.asList(mergedConfig.getLocations())); Assert.state(!sources.isEmpty(), "No configuration classes " @@ -156,7 +156,7 @@ public class SpringBootContextLoader extends AbstractContextLoader { } protected String[] getInlinedProperties(MergedContextConfiguration config) { - ArrayList properties = new ArrayList(); + ArrayList properties = new ArrayList<>(); // JMX bean names will clash if the same bean is used in multiple contexts disableJmx(properties); properties.addAll(Arrays.asList(config.getPropertySourceProperties())); @@ -188,7 +188,7 @@ public class SpringBootContextLoader extends AbstractContextLoader { private List> getInitializers( MergedContextConfiguration config, SpringApplication application) { - List> initializers = new ArrayList>(); + List> initializers = new ArrayList<>(); for (ContextCustomizer contextCustomizer : config.getContextCustomizers()) { initializers.add(new ContextCustomizerAdapter(contextCustomizer, config)); } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java index 34aa35ef65..66036972c4 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java @@ -129,7 +129,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr private void addConfigAttributesClasses( ContextConfigurationAttributes configAttributes, Class[] classes) { - List> combined = new ArrayList>(); + List> combined = new ArrayList<>(); combined.addAll(Arrays.asList(classes)); if (configAttributes.getClasses() != null) { combined.addAll(Arrays.asList(configAttributes.getClasses())); @@ -253,7 +253,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr private List getAndProcessPropertySourceProperties( MergedContextConfiguration mergedConfig) { - List propertySourceProperties = new ArrayList( + List propertySourceProperties = new ArrayList<>( Arrays.asList(mergedConfig.getPropertySourceProperties())); String differentiator = getDifferentiatorPropertySourceProperty(); if (differentiator != null) { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java b/spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java index e5aaf8b1e7..187213f245 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -123,7 +123,7 @@ public abstract class AbstractJsonMarshalTester { verify(); Assert.notNull(value, "Value must not be null"); String json = writeObject(value, this.type); - return new JsonContent(this.resourceLoadClass, this.type, json); + return new JsonContent<>(this.resourceLoadClass, this.type, json); } /** @@ -266,7 +266,7 @@ public abstract class AbstractJsonMarshalTester { InputStream inputStream = resource.getInputStream(); T object = readObject(inputStream, this.type); closeQuietly(inputStream); - return new ObjectContent(this.type, object); + return new ObjectContent<>(this.type, object); } /** @@ -291,7 +291,7 @@ public abstract class AbstractJsonMarshalTester { Assert.notNull(reader, "Reader must not be null"); T object = readObject(reader, this.type); closeQuietly(reader); - return new ObjectContent(this.type, object); + return new ObjectContent<>(this.type, object); } private void closeQuietly(Closeable closeable) { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java b/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java index 6efb110bc7..4909f174ad 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -169,7 +169,7 @@ public class BasicJsonTester { } private JsonContent getJsonContent(String json) { - return new JsonContent(this.loader.getResourceLoadClass(), null, json); + return new JsonContent<>(this.loader.getResourceLoadClass(), null, json); } } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/json/GsonTester.java b/spring-boot-test/src/main/java/org/springframework/boot/test/json/GsonTester.java index 688b833ca3..c24e296147 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/json/GsonTester.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/json/GsonTester.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -121,7 +121,7 @@ public class GsonTester extends AbstractJsonMarshalTester { @Override protected AbstractJsonMarshalTester createTester( Class resourceLoadClass, ResolvableType type, Gson marshaller) { - return new GsonTester(resourceLoadClass, type, marshaller); + return new GsonTester<>(resourceLoadClass, type, marshaller); } } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/json/JacksonTester.java b/spring-boot-test/src/main/java/org/springframework/boot/test/json/JacksonTester.java index 466d8e9d11..e6f079fe86 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/json/JacksonTester.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/json/JacksonTester.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -137,7 +137,7 @@ public class JacksonTester extends AbstractJsonMarshalTester { protected AbstractJsonMarshalTester createTester( Class resourceLoadClass, ResolvableType type, ObjectMapper marshaller) { - return new JacksonTester(resourceLoadClass, type, marshaller); + return new JacksonTester<>(resourceLoadClass, type, marshaller); } } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContent.java b/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContent.java index 553030553e..71c3b63aa2 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContent.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -49,7 +49,7 @@ public final class ObjectContent implements AssertProvider assertThat() { - return new ObjectContentAssert(this.object); + return new ObjectContentAssert<>(this.object); } /** diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java index d95e7fde27..e0f4dce879 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -51,8 +51,8 @@ class DefinitionsParser { } DefinitionsParser(Collection existing) { - this.definitions = new LinkedHashSet(); - this.definitionFields = new LinkedHashMap(); + this.definitions = new LinkedHashSet<>(); + this.definitionFields = new LinkedHashMap<>(); if (existing != null) { this.definitions.addAll(existing); } @@ -127,7 +127,7 @@ class DefinitionsParser { private Set getOrDeduceTypes(AnnotatedElement element, Class[] value) { - Set types = new LinkedHashSet(); + Set types = new LinkedHashSet<>(); for (Class clazz : value) { types.add(ResolvableType.forClass(clazz)); } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java index 86bc5433ad..6257414e5f 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java @@ -60,7 +60,7 @@ class MockDefinition extends Definition { } private Set> asClassSet(Class[] classes) { - Set> classSet = new LinkedHashSet>(); + Set> classSet = new LinkedHashSet<>(); if (classes != null) { classSet.addAll(Arrays.asList(classes)); } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoBeans.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoBeans.java index 1c6fae243e..bd274cb1a8 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoBeans.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoBeans.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -27,7 +27,7 @@ import java.util.List; */ class MockitoBeans implements Iterable { - private final List beans = new ArrayList(); + private final List beans = new ArrayList<>(); void add(Object bean) { this.beans.add(bean); diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java index f2c31ad083..048f0ab287 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,7 +34,7 @@ class MockitoContextCustomizer implements ContextCustomizer { private final Set definitions; MockitoContextCustomizer(Set definitions) { - this.definitions = new LinkedHashSet(definitions); + this.definitions = new LinkedHashSet<>(definitions); } @Override diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java index bcfee98d19..fab7081390 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java @@ -98,11 +98,11 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda private final MockitoBeans mockitoBeans = new MockitoBeans(); - private Map beanNameRegistry = new HashMap(); + private Map beanNameRegistry = new HashMap<>(); - private Map fieldRegistry = new HashMap(); + private Map fieldRegistry = new HashMap<>(); - private Map spies = new HashMap(); + private Map spies = new HashMap<>(); /** * Create a new {@link MockitoPostProcessor} instance with the given initial @@ -150,7 +150,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda private Set> getConfigurationClasses( ConfigurableListableBeanFactory beanFactory) { - Set> configurationClasses = new LinkedHashSet>(); + Set> configurationClasses = new LinkedHashSet<>(); for (BeanDefinition beanDefinition : getConfigurationBeanDefinitions(beanFactory) .values()) { configurationClasses.add(ClassUtils.resolveClassName( @@ -161,7 +161,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda private Map getConfigurationBeanDefinitions( ConfigurableListableBeanFactory beanFactory) { - Map definitions = new LinkedHashMap(); + Map definitions = new LinkedHashMap<>(); for (String beanName : beanFactory.getBeanDefinitionNames()) { BeanDefinition definition = beanFactory.getBeanDefinition(beanName); if (definition.getAttribute(CONFIGURATION_CLASS_ATTRIBUTE) != null) { @@ -258,7 +258,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda private Set findCandidateBeans(ConfigurableListableBeanFactory beanFactory, MockDefinition mockDefinition) { QualifierDefinition qualifier = mockDefinition.getQualifier(); - Set candidates = new TreeSet(); + Set candidates = new TreeSet<>(); for (String candidate : getExistingBeans(beanFactory, mockDefinition.getTypeToMock())) { if (qualifier == null || qualifier.matches(beanFactory, candidate)) { @@ -270,7 +270,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda private String[] getExistingBeans(ConfigurableListableBeanFactory beanFactory, ResolvableType type) { - Set beans = new LinkedHashSet( + Set beans = new LinkedHashSet<>( Arrays.asList(beanFactory.getBeanNamesForType(type))); String resolvedTypeName = type.resolve(Object.class).getName(); for (String beanName : beanFactory.getBeanNamesForType(FactoryBean.class)) { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListener.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListener.java index 0521c27f4b..2a7374022d 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListener.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -80,7 +80,7 @@ public class MockitoTestExecutionListener extends AbstractTestExecutionListener */ private static class MockitoAnnotationCollection implements FieldCallback { - private final Set annotations = new LinkedHashSet(); + private final Set annotations = new LinkedHashSet<>(); @Override public void doWith(Field field) diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java index c66713b468..dad2d1d972 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -91,7 +91,7 @@ class QualifierDefinition { private static Set getQualifierAnnotations(Field field) { // Assume that any annotations other than @MockBean/@SpyBean are qualifiers Annotation[] candidates = field.getDeclaredAnnotations(); - Set annotations = new HashSet(candidates.length); + Set annotations = new HashSet<>(candidates.length); for (Annotation candidate : candidates) { if (!isMockOrSpyAnnotation(candidate)) { annotations.add(candidate); diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListener.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListener.java index 2d9f257d86..6e65391053 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListener.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -60,7 +60,7 @@ public class ResetMocksTestExecutionListener extends AbstractTestExecutionListen MockReset reset) { ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); String[] names = beanFactory.getBeanDefinitionNames(); - Set instantiatedSingletons = new HashSet( + Set instantiatedSingletons = new HashSet<>( Arrays.asList(beanFactory.getSingletonNames())); for (String name : names) { BeanDefinition definition = beanFactory.getBeanDefinition(name); diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java b/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java index ba3cc44b3e..a69e5bb1c0 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -49,7 +49,7 @@ public class OutputCapture implements TestRule { private ByteArrayOutputStream copy; - private List> matchers = new ArrayList>(); + private List> matchers = new ArrayList<>(); @Override public Statement apply(final Statement base, Description description) { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/util/EnvironmentTestUtils.java b/spring-boot-test/src/main/java/org/springframework/boot/test/util/EnvironmentTestUtils.java index b7cb4690bd..ecaffc7cde 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/util/EnvironmentTestUtils.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/util/EnvironmentTestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -83,7 +83,7 @@ public abstract class EnvironmentTestUtils { if (sources.contains(name)) { return (Map) sources.get(name).getSource(); } - Map map = new HashMap(); + Map map = new HashMap<>(); sources.addFirst(new MapPropertySource(name, map)); return map; } diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizer.java b/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizer.java index 427cc955f0..827f9153dd 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizer.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -53,9 +53,9 @@ import org.springframework.web.client.RestTemplate; */ public class MockServerRestTemplateCustomizer implements RestTemplateCustomizer { - private Map expectationManagers = new ConcurrentHashMap(); + private Map expectationManagers = new ConcurrentHashMap<>(); - private Map servers = new ConcurrentHashMap(); + private Map servers = new ConcurrentHashMap<>(); private final Class expectationManager; diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java b/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java index 2ddca34889..f206a77a9c 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java @@ -148,7 +148,7 @@ public class TestRestTemplate { if (interceptors == null) { interceptors = Collections.emptyList(); } - interceptors = new ArrayList(interceptors); + interceptors = new ArrayList<>(interceptors); Iterator iterator = interceptors.iterator(); while (iterator.hasNext()) { if (iterator.next() instanceof BasicAuthorizationInterceptor) { @@ -1063,7 +1063,7 @@ public class TestRestTemplate { public CustomHttpComponentsClientHttpRequestFactory( HttpClientOption[] httpClientOptions) { - Set options = new HashSet( + Set options = new HashSet<>( Arrays.asList(httpClientOptions)); this.cookieSpec = (options.contains(HttpClientOption.ENABLE_COOKIES) ? CookieSpecs.STANDARD : CookieSpecs.IGNORE_COOKIES); diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentDefinedPortTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentDefinedPortTests.java index 1a62e8f192..601f6f8124 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentDefinedPortTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentDefinedPortTests.java @@ -26,8 +26,8 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.reactive.config.EnableWebFlux; /** - * Tests for {@link SpringBootTest} in a reactive environment configured - * with {@link WebEnvironment#DEFINED_PORT}. + * Tests for {@link SpringBootTest} in a reactive environment configured with + * {@link WebEnvironment#DEFINED_PORT}. * * @author Stephane Nicoll */ diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentRandomPortTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentRandomPortTests.java index a115ef51e2..6a57681ba6 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentRandomPortTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentRandomPortTests.java @@ -26,8 +26,8 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.reactive.config.EnableWebFlux; /** - * Tests for {@link SpringBootTest} in a reactive environment configured - * with {@link WebEnvironment#RANDOM_PORT}. + * Tests for {@link SpringBootTest} in a reactive environment configured with + * {@link WebEnvironment#RANDOM_PORT}. * * @author Stephane Nicoll */ diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/json/AbstractJsonMarshalTesterTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/json/AbstractJsonMarshalTesterTests.java index 2a0d2f2acd..04ded77ad6 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/json/AbstractJsonMarshalTesterTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/json/AbstractJsonMarshalTesterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -89,7 +89,7 @@ public abstract class AbstractJsonMarshalTesterTests { @Test public void writeMapShouldReturnJsonContent() throws Exception { ResolvableType type = ResolvableTypes.get("mapOfExampleObject"); - Map value = new LinkedHashMap(); + Map value = new LinkedHashMap<>(); value.put("a", OBJECT); JsonContent content = createTester(type).write(value); assertThat(content).isEqualToJson(MAP_JSON); diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/json/GsonTesterTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/json/GsonTesterTests.java index 9431bd9f76..69e19142a3 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/json/GsonTesterTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/json/GsonTesterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,15 +62,14 @@ public class GsonTesterTests extends AbstractJsonMarshalTesterTests { @Override protected AbstractJsonMarshalTester createTester(Class resourceLoadClass, ResolvableType type) { - return new GsonTester(resourceLoadClass, type, - new GsonBuilder().create()); + return new GsonTester<>(resourceLoadClass, type, new GsonBuilder().create()); } static abstract class InitFieldsBaseClass { public GsonTester base; - public GsonTester baseSet = new GsonTester( + public GsonTester baseSet = new GsonTester<>( InitFieldsBaseClass.class, ResolvableType.forClass(ExampleObject.class), new GsonBuilder().create()); @@ -80,7 +79,7 @@ public class GsonTesterTests extends AbstractJsonMarshalTesterTests { public GsonTester> test; - public GsonTester testSet = new GsonTester( + public GsonTester testSet = new GsonTester<>( InitFieldsBaseClass.class, ResolvableType.forClass(ExampleObject.class), new GsonBuilder().create()); diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterIntegrationTests.java index f85532cad2..7134c17288 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterIntegrationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ public class JacksonTesterIntegrationTests { @Test public void typicalMapTest() throws Exception { - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); map.put("a", 1); map.put("b", 2); assertThat(this.mapJson.write(map)).extractingJsonPathNumberValue("@.a") diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterTests.java index 8aa4667d92..08db300c9b 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/json/JacksonTesterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -61,14 +61,14 @@ public class JacksonTesterTests extends AbstractJsonMarshalTesterTests { @Override protected AbstractJsonMarshalTester createTester(Class resourceLoadClass, ResolvableType type) { - return new JacksonTester(resourceLoadClass, type, new ObjectMapper()); + return new JacksonTester<>(resourceLoadClass, type, new ObjectMapper()); } static abstract class InitFieldsBaseClass { public JacksonTester base; - public JacksonTester baseSet = new JacksonTester( + public JacksonTester baseSet = new JacksonTester<>( InitFieldsBaseClass.class, ResolvableType.forClass(ExampleObject.class), new ObjectMapper()); @@ -78,7 +78,7 @@ public class JacksonTesterTests extends AbstractJsonMarshalTesterTests { public JacksonTester> test; - public JacksonTester testSet = new JacksonTester( + public JacksonTester testSet = new JacksonTester<>( InitFieldsBaseClass.class, ResolvableType.forClass(ExampleObject.class), new ObjectMapper()); diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentTests.java index aba589ec11..e9afe460f5 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -55,38 +55,33 @@ public class JsonContentTests { @Test public void createWhenTypeIsNullShouldCreateContent() throws Exception { - JsonContent content = new JsonContent(getClass(), - null, JSON); + JsonContent content = new JsonContent<>(getClass(), null, JSON); assertThat(content).isNotNull(); } @Test public void assertThatShouldReturnJsonContentAssert() throws Exception { - JsonContent content = new JsonContent(getClass(), - TYPE, JSON); + JsonContent content = new JsonContent<>(getClass(), TYPE, JSON); assertThat(content.assertThat()).isInstanceOf(JsonContentAssert.class); } @Test public void getJsonShouldReturnJson() throws Exception { - JsonContent content = new JsonContent(getClass(), - TYPE, JSON); + JsonContent content = new JsonContent<>(getClass(), TYPE, JSON); assertThat(content.getJson()).isEqualTo(JSON); } @Test public void toStringWhenHasTypeShouldReturnString() throws Exception { - JsonContent content = new JsonContent(getClass(), - TYPE, JSON); + JsonContent content = new JsonContent<>(getClass(), TYPE, JSON); assertThat(content.toString()) .isEqualTo("JsonContent " + JSON + " created from " + TYPE); } @Test public void toStringWhenHasNoTypeShouldReturnString() throws Exception { - JsonContent content = new JsonContent(getClass(), - null, JSON); + JsonContent content = new JsonContent<>(getClass(), null, JSON); assertThat(content.toString()).isEqualTo("JsonContent " + JSON); } diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentAssertTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentAssertTests.java index a6b705ee43..be83982f24 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentAssertTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentAssertTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -77,7 +77,7 @@ public class ObjectContentAssertTests { @Override public ObjectContentAssert assertThat() { - return new ObjectContentAssert(source); + return new ObjectContentAssert<>(source); } }; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentTests.java index 55ad734980..376fc6c34e 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/json/ObjectContentTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -48,37 +48,32 @@ public class ObjectContentTests { @Test public void createWhenTypeIsNullShouldCreateContent() throws Exception { - ObjectContent content = new ObjectContent(null, - OBJECT); + ObjectContent content = new ObjectContent<>(null, OBJECT); assertThat(content).isNotNull(); } @Test public void assertThatShouldReturnObjectContentAssert() throws Exception { - ObjectContent content = new ObjectContent(TYPE, - OBJECT); + ObjectContent content = new ObjectContent<>(TYPE, OBJECT); assertThat(content.assertThat()).isInstanceOf(ObjectContentAssert.class); } @Test public void getObjectShouldReturnObject() throws Exception { - ObjectContent content = new ObjectContent(TYPE, - OBJECT); + ObjectContent content = new ObjectContent<>(TYPE, OBJECT); assertThat(content.getObject()).isEqualTo(OBJECT); } @Test public void toStringWhenHasTypeShouldReturnString() throws Exception { - ObjectContent content = new ObjectContent(TYPE, - OBJECT); + ObjectContent content = new ObjectContent<>(TYPE, OBJECT); assertThat(content.toString()) .isEqualTo("ObjectContent " + OBJECT + " created from " + TYPE); } @Test public void toStringWhenHasNoTypeShouldReturnString() throws Exception { - ObjectContent content = new ObjectContent(null, - OBJECT); + ObjectContent content = new ObjectContent<>(null, OBJECT); assertThat(content.toString()).isEqualTo("ObjectContent " + OBJECT); } diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java index 65ac8cf512..94aa767560 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -215,7 +215,7 @@ public class DefinitionsParserTests { } private List getDefinitions() { - return new ArrayList(this.parser.getDefinitions()); + return new ArrayList<>(this.parser.getDefinitions()); } @MockBean(ExampleService.class) diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerTests.java index aa25164707..184021f369 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -44,9 +44,9 @@ public class MockitoContextCustomizerTests { MockDefinition d2 = createTestMockDefinition(ExampleServiceCaller.class); MockitoContextCustomizer c1 = new MockitoContextCustomizer(NO_DEFINITIONS); MockitoContextCustomizer c2 = new MockitoContextCustomizer( - new LinkedHashSet(Arrays.asList(d1, d2))); + new LinkedHashSet<>(Arrays.asList(d1, d2))); MockitoContextCustomizer c3 = new MockitoContextCustomizer( - new LinkedHashSet(Arrays.asList(d2, d1))); + new LinkedHashSet<>(Arrays.asList(d2, d1))); assertThat(c2.hashCode()).isEqualTo(c3.hashCode()); assertThat(c1).isEqualTo(c1).isNotEqualTo(c2); assertThat(c2).isEqualTo(c2).isEqualTo(c3).isNotEqualTo(c1); diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/testutil/AbstractConfigurationClassTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/testutil/AbstractConfigurationClassTests.java index 189f52727a..bb41f33a63 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/testutil/AbstractConfigurationClassTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/testutil/AbstractConfigurationClassTests.java @@ -48,7 +48,7 @@ public abstract class AbstractConfigurationClassTests { @Test public void allBeanMethodsArePublic() throws IOException, ClassNotFoundException { - Set nonPublicBeanMethods = new HashSet(); + Set nonPublicBeanMethods = new HashSet<>(); for (AnnotationMetadata configurationClass : findConfigurationClasses()) { Set beanMethods = configurationClass .getAnnotatedMethods(Bean.class.getName()); @@ -63,7 +63,7 @@ public abstract class AbstractConfigurationClassTests { } private Set findConfigurationClasses() throws IOException { - Set configurationClasses = new HashSet(); + Set configurationClasses = new HashSet<>(); Resource[] resources = this.resolver.getResources("classpath*:" + getClass().getPackage().getName().replace('.', '/') + "/**/*.class"); for (Resource resource : resources) { diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java index a4e4e42a59..c7fa64624f 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -83,7 +83,7 @@ public class EnvironmentTestUtilsTests { @Test public void testConfigHasHigherPrecedence() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("my.foo", "bar"); MapPropertySource source = new MapPropertySource("sample", map); this.environment.getPropertySources().addFirst(source); diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java index 3ac0a6fca9..94fea8df7f 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java @@ -269,7 +269,7 @@ public class TestRestTemplateTests { public void doWithTestRestTemplate(TestRestTemplate testRestTemplate, URI relativeUri) { testRestTemplate.exchange(relativeUri, HttpMethod.GET, - new HttpEntity(new byte[0]), String.class); + new HttpEntity<>(new byte[0]), String.class); } }); @@ -284,7 +284,7 @@ public class TestRestTemplateTests { public void doWithTestRestTemplate(TestRestTemplate testRestTemplate, URI relativeUri) { testRestTemplate.exchange(relativeUri, HttpMethod.GET, - new HttpEntity(new byte[0]), + new HttpEntity<>(new byte[0]), new ParameterizedTypeReference() { }); } diff --git a/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java b/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java index fe09512e66..71a26c8558 100644 --- a/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java +++ b/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java @@ -62,7 +62,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor { private final Properties properties = new Properties(); public AutoConfigureAnnotationProcessor() { - Map annotations = new LinkedHashMap(); + Map annotations = new LinkedHashMap<>(); addAnnotations(annotations); this.annotations = Collections.unmodifiableMap(annotations); } @@ -152,7 +152,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor { @SuppressWarnings("unchecked") private List getValues(AnnotationMirror annotation) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (Map.Entry entry : annotation .getElementValues().entrySet()) { String attributeName = entry.getKey().getSimpleName().toString(); diff --git a/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessorTests.java b/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessorTests.java index 7336153480..c50f697831 100644 --- a/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessorTests.java +++ b/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessorTests.java @@ -71,7 +71,7 @@ public class AutoConfigureAnnotationProcessorTests { @Test public void annotatedMethod() throws Exception { Properties properties = compile(TestMethodConfiguration.class); - List matching = new ArrayList(); + List matching = new ArrayList<>(); for (Object key : properties.keySet()) { if (key.toString().startsWith( "org.springframework.boot.autoconfigureprocessor.TestMethodConfiguration")) { diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataGroup.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataGroup.java index ea6428e852..0886679ba6 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataGroup.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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,9 +34,9 @@ public class ConfigurationMetadataGroup implements Serializable { private final String id; - private final Map sources = new HashMap(); + private final Map sources = new HashMap<>(); - private final Map properties = new HashMap(); + private final Map properties = new HashMap<>(); public ConfigurationMetadataGroup(String id) { this.id = id; diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataHint.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataHint.java index 9f5e1f2049..a373370256 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataHint.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataHint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,9 +33,9 @@ class ConfigurationMetadataHint { private String id; - private final List valueHints = new ArrayList(); + private final List valueHints = new ArrayList<>(); - private final List valueProviders = new ArrayList(); + private final List valueProviders = new ArrayList<>(); public boolean isMapKeyHints() { return (this.id != null && this.id.endsWith(KEY_SUFFIX)); diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java index ce5a94723b..045776768b 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java @@ -41,7 +41,7 @@ public final class ConfigurationMetadataRepositoryJsonBuilder { private final JsonReader reader = new JsonReader(); - private final List repositories = new ArrayList(); + private final List repositories = new ArrayList<>(); private ConfigurationMetadataRepositoryJsonBuilder(Charset defaultCharset) { this.defaultCharset = defaultCharset; diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataSource.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataSource.java index 9c1dad9537..a78ec66be2 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataSource.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -42,7 +42,7 @@ public class ConfigurationMetadataSource implements Serializable { private String sourceMethod; - private final Map properties = new HashMap(); + private final Map properties = new HashMap<>(); /** * The identifier of the group to which this source is associated. diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/Hints.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/Hints.java index 26bdcb69d7..792765192b 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/Hints.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/Hints.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -29,13 +29,13 @@ import java.util.List; */ public class Hints { - private final List keyHints = new ArrayList(); + private final List keyHints = new ArrayList<>(); - private final List keyProviders = new ArrayList(); + private final List keyProviders = new ArrayList<>(); - private final List valueHints = new ArrayList(); + private final List valueHints = new ArrayList<>(); - private final List valueProviders = new ArrayList(); + private final List valueProviders = new ArrayList<>(); /** * The list of well-defined keys, if any. Only applicable if the type of the related diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java index 442df6ec35..b60e4e0788 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/JsonReader.java @@ -61,7 +61,7 @@ class JsonReader { private List parseAllSources(JSONObject root) throws Exception { - List result = new ArrayList(); + List result = new ArrayList<>(); if (!root.has("groups")) { return result; } @@ -75,7 +75,7 @@ class JsonReader { private List parseAllItems(JSONObject root) throws Exception { - List result = new ArrayList(); + List result = new ArrayList<>(); if (!root.has("properties")) { return result; } @@ -89,7 +89,7 @@ class JsonReader { private List parseAllHints(JSONObject root) throws Exception { - List result = new ArrayList(); + List result = new ArrayList<>(); if (!root.has("hints")) { return result; } diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java index 4bc6c4d950..f3d0ecf808 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -36,9 +36,9 @@ class RawConfigurationMetadata { RawConfigurationMetadata(List sources, List items, List hints) { - this.sources = new ArrayList(sources); - this.items = new ArrayList(items); - this.hints = new ArrayList(hints); + this.sources = new ArrayList<>(sources); + this.items = new ArrayList<>(items); + this.hints = new ArrayList<>(hints); for (ConfigurationMetadataItem item : this.items) { resolveName(item); } diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java index e12ec44796..1f4fde8456 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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.Map; public class SimpleConfigurationMetadataRepository implements ConfigurationMetadataRepository, Serializable { - private final Map allGroups = new HashMap(); + private final Map allGroups = new HashMap<>(); @Override public Map getAllGroups() { @@ -41,7 +41,7 @@ public class SimpleConfigurationMetadataRepository @Override public Map getAllProperties() { - Map properties = new HashMap(); + Map properties = new HashMap<>(); for (ConfigurationMetadataGroup group : this.allGroups.values()) { properties.putAll(group.getProperties()); } diff --git a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueProvider.java b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueProvider.java index 550181ee91..07d99fdf90 100644 --- a/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueProvider.java +++ b/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ValueProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -35,7 +35,7 @@ public class ValueProvider implements Serializable { private String name; - private final Map parameters = new LinkedHashMap(); + private final Map parameters = new LinkedHashMap<>(); /** * Return the name of the provider. diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java index 0111c3d169..8652d00d3b 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java @@ -385,7 +385,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor } private Map getAnnotationElementValues(AnnotationMirror annotation) { - Map values = new LinkedHashMap(); + Map values = new LinkedHashMap<>(); for (Map.Entry entry : annotation .getElementValues().entrySet()) { values.put(entry.getKey().getSimpleName().toString(), diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java index a478cf849e..fc64d19ca5 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -39,7 +39,7 @@ import org.springframework.boot.configurationprocessor.metadata.ItemMetadata; */ public class MetadataCollector { - private final List metadataItems = new ArrayList(); + private final List metadataItems = new ArrayList<>(); private final ProcessingEnvironment processingEnvironment; @@ -47,7 +47,7 @@ public class MetadataCollector { private final TypeUtils typeUtils; - private final Set processedSourceTypes = new HashSet(); + private final Set processedSourceTypes = new HashSet<>(); /** * Creates a new {@code MetadataProcessor} instance. diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java index 1c735eebc5..e6a7363df9 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -49,13 +49,13 @@ class TypeElementMembers { private final TypeUtils typeUtils; - private final Map fields = new LinkedHashMap(); + private final Map fields = new LinkedHashMap<>(); - private final Map publicGetters = new LinkedHashMap(); + private final Map publicGetters = new LinkedHashMap<>(); - private final Map> publicSetters = new LinkedHashMap>(); + private final Map> publicSetters = new LinkedHashMap<>(); - private final Map fieldValues = new LinkedHashMap(); + private final Map fieldValues = new LinkedHashMap<>(); private final FieldValuesParser fieldValuesParser; @@ -107,7 +107,7 @@ class TypeElementMembers { List matchingSetters = this.publicSetters .get(propertyName); if (matchingSetters == null) { - matchingSetters = new ArrayList(); + matchingSetters = new ArrayList<>(); this.publicSetters.put(propertyName, matchingSetters); } TypeMirror paramType = method.getParameters().get(0).asType(); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeExcludeFilter.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeExcludeFilter.java index c8ba4a8d5b..2e9e2e114f 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeExcludeFilter.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeExcludeFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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 javax.lang.model.type.TypeMirror; */ class TypeExcludeFilter { - private final Set excludes = new HashSet(); + private final Set excludes = new HashSet<>(); TypeExcludeFilter() { add("com.zaxxer.hikari.IConnectionCustomizer"); diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java index 0fd0c7479b..df9e7267b6 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -41,7 +41,7 @@ class TypeUtils { private static final Map> PRIMITIVE_WRAPPERS; static { - Map> wrappers = new HashMap>(); + Map> wrappers = new HashMap<>(); wrappers.put(TypeKind.BOOLEAN, Boolean.class); wrappers.put(TypeKind.BYTE, Byte.class); wrappers.put(TypeKind.CHAR, Character.class); @@ -56,7 +56,7 @@ class TypeUtils { private static final Map WRAPPER_TO_PRIMITIVE; static { - Map primitives = new HashMap(); + Map primitives = new HashMap<>(); for (Map.Entry> entry : PRIMITIVE_WRAPPERS.entrySet()) { primitives.put(entry.getValue().getName(), entry.getKey()); } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/ExpressionTree.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/ExpressionTree.java index 467e06dcdf..099cce19f7 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/ExpressionTree.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/ExpressionTree.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -75,7 +75,7 @@ class ExpressionTree extends ReflectionWrapper { public List getArrayExpression() throws Exception { if (this.newArrayTreeType.isAssignableFrom(getInstance().getClass())) { List elements = (List) this.arrayValueMethod.invoke(getInstance()); - List result = new ArrayList(); + List result = new ArrayList<>(); if (elements == null) { return result; } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java index 6c9e80e293..2675668e69 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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 JavaCompilerFieldValuesParser implements FieldValuesParser { private static final Map> WRAPPER_TYPES; static { - Map> types = new HashMap>(); + Map> types = new HashMap<>(); types.put("boolean", Boolean.class); types.put(Boolean.class.getName(), Boolean.class); types.put("byte", Byte.class); @@ -79,7 +79,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser { private static final Map, Object> DEFAULT_TYPE_VALUES; static { - Map, Object> values = new HashMap, Object>(); + Map, Object> values = new HashMap<>(); values.put(Boolean.class, false); values.put(Byte.class, (byte) 0); values.put(Short.class, (short) 0); @@ -91,15 +91,15 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser { private static final Map WELL_KNOWN_STATIC_FINALS; static { - Map values = new HashMap(); + Map values = new HashMap<>(); values.put("Boolean.TRUE", true); values.put("Boolean.FALSE", false); WELL_KNOWN_STATIC_FINALS = Collections.unmodifiableMap(values); } - private final Map fieldValues = new HashMap(); + private final Map fieldValues = new HashMap<>(); - private final Map staticFinals = new HashMap(); + private final Map staticFinals = new HashMap<>(); @Override public void visitVariable(VariableTree variable) throws Exception { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java index f703f9e5b2..3ffb07865f 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java @@ -40,7 +40,7 @@ public class ConfigurationMetadata { static { List chars = Arrays.asList('-', '_'); - SEPARATORS = Collections.unmodifiableSet(new HashSet(chars)); + SEPARATORS = Collections.unmodifiableSet(new HashSet<>(chars)); } private final Map> items; @@ -48,13 +48,13 @@ public class ConfigurationMetadata { private final Map> hints; public ConfigurationMetadata() { - this.items = new LinkedHashMap>(); - this.hints = new LinkedHashMap>(); + this.items = new LinkedHashMap<>(); + this.hints = new LinkedHashMap<>(); } public ConfigurationMetadata(ConfigurationMetadata metadata) { - this.items = new LinkedHashMap>(metadata.items); - this.hints = new LinkedHashMap>(metadata.hints); + this.items = new LinkedHashMap<>(metadata.items); + this.hints = new LinkedHashMap<>(metadata.hints); } /** @@ -135,7 +135,7 @@ public class ConfigurationMetadata { private void add(Map> map, K key, V value) { List values = map.get(key); if (values == null) { - values = new ArrayList(); + values = new ArrayList<>(); map.put(key, values); } values.add(value); @@ -198,7 +198,7 @@ public class ConfigurationMetadata { } private static > List flattenValues(Map> map) { - List content = new ArrayList(); + List content = new ArrayList<>(); for (List values : map.values()) { content.addAll(values); } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java index 1851d41ca8..ba7c2998be 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -44,10 +44,9 @@ public class ItemHint implements Comparable { public ItemHint(String name, List values, List providers) { this.name = toCanonicalName(name); - this.values = (values != null ? new ArrayList(values) - : new ArrayList()); - this.providers = (providers != null ? new ArrayList(providers) - : new ArrayList()); + this.values = (values != null ? new ArrayList<>(values) : new ArrayList<>()); + this.providers = (providers != null ? new ArrayList<>(providers) + : new ArrayList<>()); } private String toCanonicalName(String name) { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JSONOrderedObject.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JSONOrderedObject.java index 8c89707d2f..bab74c752d 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JSONOrderedObject.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JSONOrderedObject.java @@ -32,7 +32,7 @@ import org.json.JSONObject; @SuppressWarnings("rawtypes") class JSONOrderedObject extends JSONObject { - private Set keys = new LinkedHashSet(); + private Set keys = new LinkedHashSet<>(); @Override public JSONObject put(String key, Object value) throws JSONException { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java index 0c6d65b2b8..e4ad5695b8 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java @@ -118,14 +118,14 @@ public class JsonMarshaller { private ItemHint toItemHint(JSONObject object) throws Exception { String name = object.getString("name"); - List values = new ArrayList(); + List values = new ArrayList<>(); if (object.has("values")) { JSONArray valuesArray = object.getJSONArray("values"); for (int i = 0; i < valuesArray.length(); i++) { values.add(toValueHint((JSONObject) valuesArray.get(i))); } } - List providers = new ArrayList(); + List providers = new ArrayList<>(); if (object.has("providers")) { JSONArray providersObject = object.getJSONArray("providers"); for (int i = 0; i < providersObject.length(); i++) { @@ -143,7 +143,7 @@ public class JsonMarshaller { private ItemHint.ValueProvider toValueProvider(JSONObject object) throws Exception { String name = object.getString("name"); - Map parameters = new HashMap(); + Map parameters = new HashMap<>(); if (object.has("parameters")) { JSONObject parametersObject = object.getJSONObject("parameters"); for (Iterator iterator = parametersObject.keys(); iterator.hasNext();) { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/Metadata.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/Metadata.java index ef99e535f5..3efd621981 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/Metadata.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/Metadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -296,7 +296,7 @@ public final class Metadata { } private List add(List items, T item) { - List result = new ArrayList(items); + List result = new ArrayList<>(items); result.add(item); return result; } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java index ff5ec89fdd..aeb76620e4 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TestProject.java @@ -63,7 +63,7 @@ public class TestProject { private TestCompiler compiler; - private Set sourceFiles = new LinkedHashSet(); + private Set sourceFiles = new LinkedHashSet<>(); public TestProject(TemporaryFolder tempFolder, Class... classes) throws IOException { @@ -74,7 +74,7 @@ public class TestProject { return TestProject.this.sourceFolder; } }; - Set> contents = new HashSet>(Arrays.asList(classes)); + Set> contents = new HashSet<>(Arrays.asList(classes)); contents.addAll(Arrays.asList(ALWAYS_INCLUDE)); copySources(contents); } diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java index 1a6793cdec..ad475e308e 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/fieldvalues/AbstractFieldValuesProcessorTests.java @@ -97,7 +97,7 @@ public abstract class AbstractFieldValuesProcessorTests { private FieldValuesParser processor; - private Map values = new HashMap(); + private Map values = new HashMap<>(); @Override public synchronized void init(ProcessingEnvironment env) { diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokExplicitProperties.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokExplicitProperties.java index b014016715..d04a597f11 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokExplicitProperties.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokExplicitProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -56,7 +56,7 @@ public class LombokExplicitProperties { private Integer number = 0; @Getter - private final List items = new ArrayList(); + private final List items = new ArrayList<>(); // Should be ignored if no annotation is set @SuppressWarnings("unused") diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleDataProperties.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleDataProperties.java index 6c7c610a26..83a9e38caf 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleDataProperties.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleDataProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -47,7 +47,7 @@ public class LombokSimpleDataProperties { @Deprecated private Integer number = 0; - private final List items = new ArrayList(); + private final List items = new ArrayList<>(); private final String ignored = "foo"; diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleProperties.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleProperties.java index 369482f71b..cda5d19cb2 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleProperties.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokSimpleProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -49,7 +49,7 @@ public class LombokSimpleProperties { @Deprecated private Integer number = 0; - private final List items = new ArrayList(); + private final List items = new ArrayList<>(); private final String ignored = "foo"; diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/SimpleCollectionProperties.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/SimpleCollectionProperties.java index 91d14019a2..e8c627f712 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/SimpleCollectionProperties.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/SimpleCollectionProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -39,11 +39,11 @@ public class SimpleCollectionProperties { private List floats; - private final Map namesToIntegers = new HashMap(); + private final Map namesToIntegers = new HashMap<>(); - private final Collection bytes = new LinkedHashSet(); + private final Collection bytes = new LinkedHashSet<>(); - private final List doubles = new ArrayList(); + private final List doubles = new ArrayList<>(); public Map getIntegersToNames() { return this.integersToNames; diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/specific/GenericConfig.java b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/specific/GenericConfig.java index 28de281047..3ffb6fc52e 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/specific/GenericConfig.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/specific/GenericConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -42,11 +42,11 @@ public class GenericConfig { private String name; @NestedConfigurationProperty - private final Bar bar = new Bar(); + private final Bar bar = new Bar<>(); - private final Map> stringToBar = new HashMap>(); + private final Map> stringToBar = new HashMap<>(); - private final Map stringToInteger = new HashMap(); + private final Map stringToInteger = new HashMap<>(); public String getName() { return this.name; @@ -75,7 +75,7 @@ public class GenericConfig { private String name; @NestedConfigurationProperty - private final Biz biz = new Biz(); + private final Biz biz = new Biz<>(); public String getName() { return this.name; diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/buildinfo/BuildInfo.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/buildinfo/BuildInfo.java index 3cb5105e7e..b7d30287f0 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/buildinfo/BuildInfo.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/buildinfo/BuildInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -63,7 +63,7 @@ public class BuildInfo extends DefaultTask { private String projectName = getProject().getName(); @Input - private Map additionalProperties = new HashMap(); + private Map additionalProperties = new HashMap<>(); @TaskAction public void generateBuildProperties() { @@ -127,7 +127,7 @@ public class BuildInfo extends DefaultTask { } private Map coerceToStringValues(Map input) { - Map output = new HashMap(); + Map output = new HashMap<>(); for (Entry entry : input.entrySet()) { output.put(entry.getKey(), entry.getValue().toString()); } diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java index a808ab4039..1ebd3a6c33 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java @@ -119,7 +119,7 @@ class ProjectLibraries implements Libraries { if (configuration == null) { return null; } - Set libraries = new LinkedHashSet(); + Set libraries = new LinkedHashSet<>(); for (ResolvedArtifact artifact : configuration.getResolvedConfiguration() .getResolvedArtifacts()) { libraries.add(new ResolvedArtifactLibrary(artifact, scope)); @@ -130,7 +130,7 @@ class ProjectLibraries implements Libraries { private Set getLibrariesForFileDependencies( Configuration configuration, LibraryScope scope) { - Set libraries = new LinkedHashSet(); + Set libraries = new LinkedHashSet<>(); for (Dependency dependency : configuration.getIncoming().getDependencies()) { if (dependency instanceof FileCollectionDependency) { FileCollectionDependency fileDependency = (FileCollectionDependency) dependency; @@ -156,11 +156,11 @@ class ProjectLibraries implements Libraries { if (source == null || toRemove == null) { return source; } - Set filesToRemove = new HashSet(); + Set filesToRemove = new HashSet<>(); for (GradleLibrary library : toRemove) { filesToRemove.add(library.getFile()); } - Set result = new LinkedHashSet(); + Set result = new LinkedHashSet<>(); for (GradleLibrary library : source) { if (!filesToRemove.contains(library.getFile())) { result.add(library); @@ -195,8 +195,8 @@ class ProjectLibraries implements Libraries { } private Set getDuplicates(Set libraries) { - Set duplicates = new HashSet(); - Set seen = new HashSet(); + Set duplicates = new HashSet<>(); + Set seen = new HashSet<>(); for (GradleLibrary library : libraries) { if (library.getFile() != null && !seen.add(library.getFile().getName())) { duplicates.add(library.getFile().getName()); diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackageTask.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackageTask.java index 370c78b5f3..155adebca2 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackageTask.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackageTask.java @@ -193,7 +193,7 @@ public class RepackageTask extends DefaultTask { private boolean isTaskMatch(Jar task, Object withJarTask) { if (withJarTask == null) { if ("".equals(task.getClassifier())) { - Set tasksWithCustomRepackaging = new HashSet(); + Set tasksWithCustomRepackaging = new HashSet<>(); for (RepackageTask repackageTask : RepackageTask.this.getProject() .getTasks().withType(RepackageTask.class)) { if (repackageTask.getWithJarTask() != null) { diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/BootRunTask.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/BootRunTask.java index 76cc4fd345..7f51972f9f 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/BootRunTask.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/BootRunTask.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -67,11 +67,11 @@ public class BootRunTask extends JavaExec { SourceSet mainSourceSet = SourceSets.findMainSourceSet(getProject()); final File outputDir = (mainSourceSet == null ? null : mainSourceSet.getOutput().getResourcesDir()); - final Set resources = new LinkedHashSet(); + final Set resources = new LinkedHashSet<>(); if (mainSourceSet != null) { resources.addAll(mainSourceSet.getResources().getSrcDirs()); } - List classPath = new ArrayList(getClasspath().getFiles()); + List classPath = new ArrayList<>(getClasspath().getFiles()); classPath.addAll(0, resources); getLogger().info("Adding classpath: " + resources); setClasspath(new SimpleFileCollection(classPath)); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java index 79fd737e29..c60b595418 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -57,7 +57,7 @@ public class JarWriter implements LoaderClassesWriter { private final JarOutputStream jarOutput; - private final Set writtenEntries = new HashSet(); + private final Set writtenEntries = new HashSet<>(); /** * Create a new {@link JarWriter} instance. @@ -89,7 +89,7 @@ public class JarWriter implements LoaderClassesWriter { private void setExecutableFilePermission(File file) { try { Path path = file.toPath(); - Set permissions = new HashSet( + Set permissions = new HashSet<>( Files.getPosixFilePermissions(path)); permissions.add(PosixFilePermission.OWNER_EXECUTE); Files.setPosixFilePermissions(path, permissions); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java index 4070d79d41..f57d1d81b8 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java @@ -123,7 +123,7 @@ public final class Layouts { private static final Map SCOPE_DESTINATIONS; static { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(LibraryScope.COMPILE, "WEB-INF/lib/"); map.put(LibraryScope.CUSTOM, "WEB-INF/lib/"); map.put(LibraryScope.RUNTIME, "WEB-INF/lib/"); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java index f46257618f..e9835a3468 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java @@ -136,7 +136,7 @@ public abstract class MainClassFinder { "Invalid root folder '" + rootFolder + "'"); } String prefix = rootFolder.getAbsolutePath() + "/"; - Deque stack = new ArrayDeque(); + Deque stack = new ArrayDeque<>(); stack.push(rootFolder); while (!stack.isEmpty()) { File file = stack.pop(); @@ -275,7 +275,7 @@ public abstract class MainClassFinder { String classesLocation) { classesLocation = (classesLocation != null ? classesLocation : ""); Enumeration sourceEntries = source.entries(); - List classEntries = new ArrayList(); + List classEntries = new ArrayList<>(); while (sourceEntries.hasMoreElements()) { JarEntry entry = sourceEntries.nextElement(); if (entry.getName().startsWith(classesLocation) @@ -319,7 +319,7 @@ public abstract class MainClassFinder { private static class ClassDescriptor extends ClassVisitor { - private final Set annotationNames = new LinkedHashSet(); + private final Set annotationNames = new LinkedHashSet<>(); private boolean mainMethodFound; @@ -398,7 +398,7 @@ public abstract class MainClassFinder { MainClass(String name, Set annotationNames) { this.name = name; this.annotationNames = Collections - .unmodifiableSet(new HashSet(annotationNames)); + .unmodifiableSet(new HashSet<>(annotationNames)); } String getName() { @@ -446,7 +446,7 @@ public abstract class MainClassFinder { private static final class SingleMainClassCallback implements MainClassCallback { - private final Set mainClasses = new LinkedHashSet(); + private final Set mainClasses = new LinkedHashSet<>(); private final String annotationName; @@ -461,7 +461,7 @@ public abstract class MainClassFinder { } private String getMainClassName() { - Set matchingMainClasses = new LinkedHashSet(); + Set matchingMainClasses = new LinkedHashSet<>(); if (this.annotationName != null) { for (MainClass mainClass : this.mainClasses) { if (mainClass.getAnnotationNames().contains(this.annotationName)) { diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java index 1450c48205..1bfee27d33 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java @@ -60,7 +60,7 @@ public class Repackager { private static final String SPRING_BOOT_APPLICATION_CLASS_NAME = "org.springframework.boot.autoconfigure.SpringBootApplication"; - private List mainClassTimeoutListeners = new ArrayList(); + private List mainClassTimeoutListeners = new ArrayList<>(); private String mainClass; @@ -236,8 +236,8 @@ public class Repackager { LaunchScript launchScript) throws IOException { JarWriter writer = new JarWriter(destination, launchScript); try { - final List unpackLibraries = new ArrayList(); - final List standardLibraries = new ArrayList(); + final List unpackLibraries = new ArrayList<>(); + final List standardLibraries = new ArrayList<>(); libraries.doWithLibraries(new LibraryCallback() { @Override @@ -270,7 +270,7 @@ public class Repackager { final List unpackLibraries, final List standardLibraries) throws IOException { writer.writeManifest(buildManifest(sourceJar)); - Set seen = new HashSet(); + Set seen = new HashSet<>(); writeNestedLibraries(unpackLibraries, seen, writer); if (this.layout instanceof RepackagingLayout) { writer.writeEntries(sourceJar, new RenamingEntryTransformer( diff --git a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/DefaultLaunchScriptTests.java b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/DefaultLaunchScriptTests.java index fd4998ff27..2582cba95c 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/DefaultLaunchScriptTests.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/DefaultLaunchScriptTests.java @@ -212,7 +212,7 @@ public class DefaultLaunchScriptTests { } private Map createProperties(String... pairs) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); for (String pair : pairs) { String[] keyValue = pair.split(":"); properties.put(keyValue[0], keyValue[1]); diff --git a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java index 9b8c532980..81ab7a1774 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -178,7 +178,7 @@ public class MainClassFinderTests { private static class ClassNameCollector implements MainClassCallback { - private final List classNames = new ArrayList(); + private final List classNames = new ArrayList<>(); @Override public Object doWith(MainClass mainClass) { diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/ExecutableArchiveLauncher.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/ExecutableArchiveLauncher.java index 0a6a1c83f4..c65fbfcbae 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/ExecutableArchiveLauncher.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/ExecutableArchiveLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -68,7 +68,7 @@ public abstract class ExecutableArchiveLauncher extends Launcher { @Override protected List getClassPathArchives() throws Exception { - List archives = new ArrayList( + List archives = new ArrayList<>( this.archive.getNestedArchives(new EntryFilter() { @Override diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java index 2b0f106e66..ba402225f4 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -57,7 +57,7 @@ public abstract class Launcher { * @throws Exception if the classloader cannot be created */ protected ClassLoader createClassLoader(List archives) throws Exception { - List urls = new ArrayList(archives.size()); + List urls = new ArrayList<>(archives.size()); for (Archive archive : archives) { urls.add(archive.getUrl()); } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java index 01253279ac..677c2212d8 100755 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java @@ -121,7 +121,7 @@ public class PropertiesLauncher extends Launcher { private final File home; - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); private final Properties properties = new Properties(); @@ -149,7 +149,7 @@ public class PropertiesLauncher extends Launcher { } private void initializeProperties() throws Exception, IOException { - List configs = new ArrayList(); + List configs = new ArrayList<>(); if (getProperty(CONFIG_LOCATION) != null) { configs.add(getProperty(CONFIG_LOCATION)); } @@ -296,7 +296,7 @@ public class PropertiesLauncher extends Launcher { } private List parsePathsProperty(String commaSeparatedPaths) { - List paths = new ArrayList(); + List paths = new ArrayList<>(); for (String path : commaSeparatedPaths.split(",")) { path = cleanupPath(path); // Empty path (i.e. the archive itself if running from a JAR) is always added @@ -432,11 +432,11 @@ public class PropertiesLauncher extends Launcher { @Override protected List getClassPathArchives() throws Exception { - List lib = new ArrayList(); + List lib = new ArrayList<>(); for (String path : this.paths) { for (Archive archive : getClassPathArchives(path)) { if (archive instanceof ExplodedArchive) { - List nested = new ArrayList( + List nested = new ArrayList<>( archive.getNestedArchives(new ArchiveEntryFilter())); nested.add(0, archive); lib.addAll(nested); @@ -452,7 +452,7 @@ public class PropertiesLauncher extends Launcher { private List getClassPathArchives(String path) throws Exception { String root = cleanupPath(stripFileUrlPrefix(path)); - List lib = new ArrayList(); + List lib = new ArrayList<>(); File file = new File(root); if (!isAbsolutePath(root)) { file = new File(this.home, root); diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java index 59f94407a8..3f2b435ddd 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -42,7 +42,7 @@ import java.util.jar.Manifest; */ public class ExplodedArchive implements Archive { - private static final Set SKIPPED_NAMES = new HashSet( + private static final Set SKIPPED_NAMES = new HashSet<>( Arrays.asList(".", "..")); private final File root; @@ -104,7 +104,7 @@ public class ExplodedArchive implements Archive { @Override public List getNestedArchives(EntryFilter filter) throws IOException { - List nestedArchives = new ArrayList(); + List nestedArchives = new ArrayList<>(); for (Entry entry : this) { if (filter.matches(entry)) { nestedArchives.add(getNestedArchive(entry)); @@ -145,7 +145,7 @@ public class ExplodedArchive implements Archive { private final boolean recursive; - private final Deque> stack = new LinkedList>(); + private final Deque> stack = new LinkedList<>(); private File current; diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java index a136897e12..174b5486dd 100755 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -81,7 +81,7 @@ public class JarFileArchive implements Archive { @Override public List getNestedArchives(EntryFilter filter) throws IOException { - List nestedArchives = new ArrayList(); + List nestedArchives = new ArrayList<>(); for (Entry entry : this) { if (filter.matches(entry)) { nestedArchives.add(getNestedArchive(entry)); diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java index 384107bdd6..263fd5e76f 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -240,7 +240,7 @@ public class RandomAccessDataFile implements RandomAccessData { FilePool(int size) { this.size = size; this.available = new Semaphore(size); - this.files = new ConcurrentLinkedQueue(); + this.files = new ConcurrentLinkedQueue<>(); } public RandomAccessFile acquire() throws IOException { diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java index 4b8a694c22..f1ca2c6993 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ class CentralDirectoryParser { private int CENTRAL_DIRECTORY_HEADER_BASE_SIZE = 46; - private final List visitors = new ArrayList(); + private final List visitors = new ArrayList<>(); public T addVisitor(T visitor) { this.visitors.add(visitor); diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java index 949504b4ff..4d4154c323 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -68,7 +68,7 @@ public class Handler extends URLStreamHandler { private static SoftReference> rootFileCache; static { - rootFileCache = new SoftReference>(null); + rootFileCache = new SoftReference<>(null); } private final Logger logger = Logger.getLogger(getClass().getName()); @@ -291,8 +291,8 @@ public class Handler extends URLStreamHandler { static void addToRootFileCache(File sourceFile, JarFile jarFile) { Map cache = rootFileCache.get(); if (cache == null) { - cache = new ConcurrentHashMap(); - rootFileCache = new SoftReference>(cache); + cache = new ConcurrentHashMap<>(); + rootFileCache = new SoftReference<>(cache); } cache.put(sourceFile, jarFile); } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java index e0a2741dfc..76f20da650 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -172,7 +172,7 @@ public class JarFile extends java.util.jar.JarFile { inputStream.close(); } } - this.manifest = new SoftReference(manifest); + this.manifest = new SoftReference<>(manifest); } return manifest; } diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java index 8199fb4490..92ddeb0453 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java @@ -39,7 +39,7 @@ import org.springframework.boot.loader.data.RandomAccessData.ResourceAccess; */ final class JarURLConnection extends java.net.JarURLConnection { - private static ThreadLocal useFastExceptions = new ThreadLocal(); + private static ThreadLocal useFastExceptions = new ThreadLocal<>(); private static final FileNotFoundException FILE_NOT_FOUND_EXCEPTION = new FileNotFoundException( "Jar file or entry not found"); diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/AbstractExecutableArchiveLauncherTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/AbstractExecutableArchiveLauncherTests.java index 48a2f53a2b..6bace570ad 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/AbstractExecutableArchiveLauncherTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/AbstractExecutableArchiveLauncherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -89,7 +89,7 @@ public class AbstractExecutableArchiveLauncherTests { } protected Set getUrls(List archives) throws MalformedURLException { - Set urls = new HashSet(archives.size()); + Set urls = new HashSet<>(archives.size()); for (Archive archive : archives) { urls.add(archive.getUrl()); } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java index 3166ed3bd9..08f07304a4 100755 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/ExplodedArchiveTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -188,7 +188,7 @@ public class ExplodedArchiveTests { } private Map getEntriesMap(Archive archive) { - Map entries = new HashMap(); + Map entries = new HashMap<>(); for (Archive.Entry entry : archive) { entries.put(entry.getName(), entry); } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java index ac7756d6d8..37df7c1d31 100755 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -121,7 +121,7 @@ public class JarFileArchiveTests { } private Map getEntriesMap(Archive archive) { - Map entries = new HashMap(); + Map entries = new HashMap<>(); for (Archive.Entry entry : archive) { entries.put(entry.getName(), entry); } diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java index 3b0422dc89..500510c994 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/data/RandomAccessDataFileTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -276,7 +276,7 @@ public class RandomAccessDataFileTests { @Test public void concurrentReads() throws Exception { ExecutorService executorService = Executors.newFixedThreadPool(20); - List> results = new ArrayList>(); + List> results = new ArrayList<>(); for (int i = 0; i < 100; i++) { results.add(executorService.submit(new Callable() { diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/CentralDirectoryParserTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/CentralDirectoryParserTests.java index fe0343d19e..2ef8e98ffa 100644 --- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/CentralDirectoryParserTests.java +++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/CentralDirectoryParserTests.java @@ -86,7 +86,7 @@ public class CentralDirectoryParserTests { private static class Collector implements CentralDirectoryVisitor { - private List headers = new ArrayList(); + private List headers = new ArrayList<>(); @Override public void visitStart(CentralDirectoryEndRecord endRecord, @@ -111,7 +111,7 @@ public class CentralDirectoryParserTests { private static class MockCentralDirectoryVisitor implements CentralDirectoryVisitor { - private final List invocations = new ArrayList(); + private final List invocations = new ArrayList<>(); @Override public void visitStart(CentralDirectoryEndRecord endRecord, diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java index bcb5b2dbed..d3deec31ad 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java @@ -90,7 +90,7 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo { protected Set filterDependencies(Set dependencies, FilterArtifacts filters) throws MojoExecutionException { try { - Set filtered = new LinkedHashSet(dependencies); + Set filtered = new LinkedHashSet<>(dependencies); filtered.retainAll(filters.filter(dependencies)); return filtered; } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index 87a460905d..f208a99855 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -270,7 +270,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { private void doRunWithForkedJvm(String startClassName) throws MojoExecutionException, MojoFailureException { - List args = new ArrayList(); + List args = new ArrayList<>(); addAgents(args); addJvmArgs(args); addClasspath(args); @@ -392,7 +392,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { protected URL[] getClassPathUrls() throws MojoExecutionException { try { - List urls = new ArrayList(); + List urls = new ArrayList<>(); addUserDefinedFolders(urls); addResources(urls); addProjectClasses(urls); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java index dd83710824..fed687bf27 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/ArtifactsLibraries.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -45,7 +45,7 @@ public class ArtifactsLibraries implements Libraries { private static final Map SCOPES; static { - Map scopes = new HashMap(); + Map scopes = new HashMap<>(); scopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE); scopes.put(Artifact.SCOPE_RUNTIME, LibraryScope.RUNTIME); scopes.put(Artifact.SCOPE_PROVIDED, LibraryScope.PROVIDED); @@ -85,8 +85,8 @@ public class ArtifactsLibraries implements Libraries { } private Set getDuplicates(Set artifacts) { - Set duplicates = new HashSet(); - Set seen = new HashSet(); + Set duplicates = new HashSet<>(); + Set seen = new HashSet<>(); for (Artifact artifact : artifacts) { String fileName = getFileName(artifact); if (artifact.getFile() != null && !seen.add(fileName)) { diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java index e73c0fedf3..cba02a6cc7 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java @@ -242,7 +242,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { } private ArtifactsFilter[] getAdditionalFilters() { - List filters = new ArrayList(); + List filters = new ArrayList<>(); if (this.excludeDevtools) { Exclude exclude = new Exclude(); exclude.setGroupId("org.springframework.boot"); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java index f81348b3fb..6888043c6a 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunArguments.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -38,7 +38,7 @@ class RunArguments { } RunArguments(String[] args) { - this.args = new LinkedList(Arrays.asList(args)); + this.args = new LinkedList<>(Arrays.asList(args)); } public LinkedList getArgs() { diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java index 595ef0e124..1c157acbf5 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -132,7 +132,7 @@ public class StartMojo extends AbstractRunMojo { protected RunArguments resolveJvmArguments() { RunArguments jvmArguments = super.resolveJvmArguments(); if (isFork()) { - List remoteJmxArguments = new ArrayList(); + List remoteJmxArguments = new ArrayList<>(); remoteJmxArguments.add("-Dcom.sun.management.jmxremote"); remoteJmxArguments.add("-Dcom.sun.management.jmxremote.port=" + this.jmxPort); remoteJmxArguments.add("-Dcom.sun.management.jmxremote.authenticate=false"); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ArtifactsLibrariesTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ArtifactsLibrariesTests.java index 243ab5dfb1..f73c0d4ade 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ArtifactsLibrariesTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ArtifactsLibrariesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -124,7 +124,7 @@ public class ArtifactsLibrariesTests { given(artifact2.getBaseVersion()).willReturn("1.0"); given(artifact2.getFile()).willReturn(new File("a")); given(artifact2.getArtifactHandler()).willReturn(this.artifactHandler); - this.artifacts = new LinkedHashSet(Arrays.asList(artifact1, artifact2)); + this.artifacts = new LinkedHashSet<>(Arrays.asList(artifact1, artifact2)); this.libs = new ArtifactsLibraries(this.artifacts, null, mock(Log.class)); this.libs.doWithLibraries(this.callback); verify(this.callback, times(2)).library(this.libraryCaptor.capture()); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java index 212e711d12..3b39ce4d11 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java @@ -148,7 +148,7 @@ public class DependencyFilterMojoTests { public Set filterDependencies(Artifact... artifacts) throws MojoExecutionException { - Set input = new LinkedHashSet(Arrays.asList(artifacts)); + Set input = new LinkedHashSet<>(Arrays.asList(artifacts)); return filterDependencies(input, getFilters(this.additionalFilters)); } diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java index ee7340681c..610bb5608f 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/ExcludeFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -101,7 +101,7 @@ public class ExcludeFilterTests { ExcludeFilter filter = new ExcludeFilter(Arrays.asList( createExclude("com.foo", "bar"), createExclude("com.foo", "bar2"), createExclude("org.acme", "app"))); - Set artifacts = new HashSet(); + Set artifacts = new HashSet<>(); artifacts.add(createArtifact("com.foo", "bar")); artifacts.add(createArtifact("com.foo", "bar")); Artifact anotherAcme = createArtifact("org.acme", "another-app"); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java index 12553eb980..995410852e 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/IncludeFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -98,7 +98,7 @@ public class IncludeFilterTests { IncludeFilter filter = new IncludeFilter(Arrays.asList( createInclude("com.foo", "bar"), createInclude("com.foo", "bar2"), createInclude("org.acme", "app"))); - Set artifacts = new HashSet(); + Set artifacts = new HashSet<>(); artifacts.add(createArtifact("com.foo", "bar")); artifacts.add(createArtifact("com.foo", "bar")); Artifact anotherAcme = createArtifact("org.acme", "another-app"); diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java index e169faed59..55beb4d1aa 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/Verify.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -93,7 +93,7 @@ public final class Verify { public ArchiveVerifier(ZipFile zipFile) { this.zipFile = zipFile; Enumeration entries = zipFile.entries(); - this.content = new HashMap(); + this.content = new HashMap<>(); while (entries.hasMoreElements()) { ZipEntry zipEntry = entries.nextElement(); this.content.put(zipEntry.getName(), zipEntry); diff --git a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java index be3149894b..edf7db9159 100644 --- a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -305,7 +305,7 @@ class BeanDefinitionLoader { private static class ClassExcludeFilter extends AbstractTypeHierarchyTraversingFilter { - private final Set classNames = new HashSet(); + private final Set classNames = new HashSet<>(); ClassExcludeFilter(Object... sources) { super(false, false); diff --git a/spring-boot/src/main/java/org/springframework/boot/DefaultApplicationArguments.java b/spring-boot/src/main/java/org/springframework/boot/DefaultApplicationArguments.java index 5b5817724d..2cbf74f3a3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/DefaultApplicationArguments.java +++ b/spring-boot/src/main/java/org/springframework/boot/DefaultApplicationArguments.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -51,7 +51,7 @@ public class DefaultApplicationArguments implements ApplicationArguments { @Override public Set getOptionNames() { String[] names = this.source.getPropertyNames(); - return Collections.unmodifiableSet(new HashSet(Arrays.asList(names))); + return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(names))); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java b/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java index 866595febf..ab9ad2a93b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java +++ b/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,7 +34,7 @@ import org.springframework.util.Assert; */ class ExitCodeGenerators implements Iterable { - private List generators = new ArrayList(); + private List generators = new ArrayList<>(); public void addAll(Throwable exception, ExitCodeExceptionMapper... mappers) { Assert.notNull(exception, "Exception must not be null"); diff --git a/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java b/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java index c2d1d797b2..2091bd3577 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java +++ b/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -78,7 +78,7 @@ public class ResourceBanner implements Banner { protected List getPropertyResolvers(Environment environment, Class sourceClass) { - List resolvers = new ArrayList(); + List resolvers = new ArrayList<>(); resolvers.add(environment); resolvers.add(getVersionResolver(sourceClass)); resolvers.add(getAnsiResolver()); @@ -96,7 +96,7 @@ public class ResourceBanner implements Banner { private Map getVersionsMap(Class sourceClass) { String appVersion = getApplicationVersion(sourceClass); String bootVersion = getBootVersion(); - Map versions = new HashMap(); + Map versions = new HashMap<>(); versions.put("application.version", getVersionString(appVersion, false)); versions.put("spring-boot.version", getVersionString(bootVersion, false)); versions.put("application.formatted-version", getVersionString(appVersion, true)); diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 785d5aacb4..f0e45d26aa 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -178,8 +178,8 @@ public class SpringApplication { "org.springframework.web.context.ConfigurableWebApplicationContext" }; /** - * The class name of application context that will be used by default for - * reactive web environments. + * The class name of application context that will be used by default for reactive web + * environments. */ public static final String DEFAULT_REACTIVE_WEB_CONTEXT_CLASS = "org.springframework." + "boot.context.embedded.EmbeddedReactiveWebApplicationContext"; @@ -207,7 +207,7 @@ public class SpringApplication { private static final Set SERVLET_ENVIRONMENT_SOURCE_NAMES; static { - Set names = new HashSet(); + Set 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); @@ -216,7 +216,7 @@ public class SpringApplication { private static final Log logger = LogFactory.getLog(SpringApplication.class); - private final Set sources = new LinkedHashSet(); + private final Set sources = new LinkedHashSet<>(); private Class mainApplicationClass; @@ -248,7 +248,7 @@ public class SpringApplication { private Map defaultProperties; - private Set additionalProfiles = new HashSet(); + private Set additionalProfiles = new HashSet<>(); /** * Create a new {@link SpringApplication} instance. The application context will load @@ -431,7 +431,7 @@ public class SpringApplication { Class[] parameterTypes, Object... args) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); // Use names and ensure unique to protect against duplicates - Set names = new LinkedHashSet( + Set names = new LinkedHashSet<>( SpringFactoriesLoader.loadFactoryNames(type, classLoader)); List instances = createSpringFactoriesInstances(type, parameterTypes, classLoader, args, names); @@ -443,7 +443,7 @@ public class SpringApplication { private List createSpringFactoriesInstances(Class type, Class[] parameterTypes, ClassLoader classLoader, Object[] args, Set names) { - List instances = new ArrayList(names.size()); + List instances = new ArrayList<>(names.size()); for (String name : names) { try { Class instanceClass = ClassUtils.forName(name, classLoader); @@ -513,7 +513,7 @@ public class SpringApplication { } private void removeAllPropertySources(MutablePropertySources propertySources) { - Set names = new HashSet(); + Set names = new HashSet<>(); for (PropertySource propertySource : propertySources) { names.add(propertySource.getName()); } @@ -564,7 +564,7 @@ public class SpringApplication { protected void configureProfiles(ConfigurableEnvironment environment, String[] args) { environment.getActiveProfiles(); // ensure they are initialized // But these ones should go first (last wins in a property key clash) - Set profiles = new LinkedHashSet(this.additionalProfiles); + Set profiles = new LinkedHashSet<>(this.additionalProfiles); profiles.addAll(Arrays.asList(environment.getActiveProfiles())); environment.setActiveProfiles(profiles.toArray(new String[profiles.size()])); } @@ -625,14 +625,14 @@ public class SpringApplication { if (contextClass == null) { try { switch (this.webApplicationType) { - case SERVLET: - contextClass = Class.forName(DEFAULT_WEB_CONTEXT_CLASS); - break; - case REACTIVE: - contextClass = Class.forName(DEFAULT_REACTIVE_WEB_CONTEXT_CLASS); - break; - default: - contextClass = Class.forName(DEFAULT_CONTEXT_CLASS); + case SERVLET: + contextClass = Class.forName(DEFAULT_WEB_CONTEXT_CLASS); + break; + case REACTIVE: + contextClass = Class.forName(DEFAULT_REACTIVE_WEB_CONTEXT_CLASS); + break; + default: + contextClass = Class.forName(DEFAULT_CONTEXT_CLASS); } } catch (ClassNotFoundException ex) { @@ -820,11 +820,11 @@ public class SpringApplication { } private void callRunners(ApplicationContext context, ApplicationArguments args) { - List runners = new ArrayList(); + List runners = new ArrayList<>(); runners.addAll(context.getBeansOfType(ApplicationRunner.class).values()); runners.addAll(context.getBeansOfType(CommandLineRunner.class).values()); AnnotationAwareOrderComparator.sort(runners); - for (Object runner : new LinkedHashSet(runners)) { + for (Object runner : new LinkedHashSet<>(runners)) { if (runner instanceof ApplicationRunner) { callRunner((ApplicationRunner) runner, args); } @@ -1090,7 +1090,7 @@ public class SpringApplication { * @param defaultProperties some {@link Properties} */ public void setDefaultProperties(Properties defaultProperties) { - this.defaultProperties = new HashMap(); + this.defaultProperties = new HashMap<>(); for (Object key : Collections.list(defaultProperties.propertyNames())) { this.defaultProperties.put((String) key, defaultProperties.get(key)); } @@ -1102,7 +1102,7 @@ public class SpringApplication { * @param profiles the additional profiles to set */ public void setAdditionalProfiles(String... profiles) { - this.additionalProfiles = new LinkedHashSet(Arrays.asList(profiles)); + this.additionalProfiles = new LinkedHashSet<>(Arrays.asList(profiles)); } /** @@ -1187,7 +1187,7 @@ public class SpringApplication { */ public void setInitializers( Collection> initializers) { - this.initializers = new ArrayList>(); + this.initializers = new ArrayList<>(); this.initializers.addAll(initializers); } @@ -1215,7 +1215,7 @@ public class SpringApplication { * @param listeners the listeners to set */ public void setListeners(Collection> listeners) { - this.listeners = new ArrayList>(); + this.listeners = new ArrayList<>(); this.listeners.addAll(listeners); } @@ -1322,10 +1322,10 @@ public class SpringApplication { } private static Set asUnmodifiableOrderedSet(Collection elements) { - List list = new ArrayList(); + List list = new ArrayList<>(); list.addAll(elements); Collections.sort(list, AnnotationAwareOrderComparator.INSTANCE); - return new LinkedHashSet(list); + return new LinkedHashSet<>(list); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java index cea4d5f314..2a82056210 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -123,7 +123,7 @@ class SpringApplicationBannerPrinter { */ private static class Banners implements Banner { - private final List banners = new ArrayList(); + private final List banners = new ArrayList<>(); public void addIfNotNull(Banner banner) { if (banner != null) { diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationRunListeners.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationRunListeners.java index f6fc9e7179..c744059479 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplicationRunListeners.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplicationRunListeners.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -40,7 +40,7 @@ class SpringApplicationRunListeners { SpringApplicationRunListeners(Log log, Collection listeners) { this.log = log; - this.listeners = new ArrayList(listeners); + this.listeners = new ArrayList<>(listeners); } public void starting() { diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java b/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java index af7948b24c..c0172547a4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringBootExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -35,7 +35,7 @@ class SpringBootExceptionHandler implements UncaughtExceptionHandler { private static Set LOG_CONFIGURATION_MESSAGES; static { - Set messages = new HashSet(); + Set messages = new HashSet<>(); messages.add("Logback configuration error detected"); LOG_CONFIGURATION_MESSAGES = Collections.unmodifiableSet(messages); } @@ -44,7 +44,7 @@ class SpringBootExceptionHandler implements UncaughtExceptionHandler { private final UncaughtExceptionHandler parent; - private final List loggedExceptions = new ArrayList(); + private final List loggedExceptions = new ArrayList<>(); private int exitCode = 0; diff --git a/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java index 7a562a5503..b7dabb3917 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java +++ b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -39,7 +39,7 @@ public final class AnsiColors { private static final Map ANSI_COLOR_MAP; static { - Map colorMap = new LinkedHashMap(); + Map colorMap = new LinkedHashMap<>(); colorMap.put(AnsiColor.BLACK, new LabColor(0x000000)); colorMap.put(AnsiColor.RED, new LabColor(0xAA0000)); colorMap.put(AnsiColor.GREEN, new LabColor(0x00AA00)); diff --git a/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiPropertySource.java b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiPropertySource.java index efefd4a4e5..baa0c6ae2f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiPropertySource.java +++ b/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiPropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -41,14 +41,13 @@ public class AnsiPropertySource extends PropertySource { private static final Iterable> MAPPED_ENUMS; static { - List> enums = new ArrayList>(); - enums.add(new MappedEnum("AnsiStyle.", AnsiStyle.class)); - enums.add(new MappedEnum("AnsiColor.", AnsiColor.class)); - enums.add( - new MappedEnum("AnsiBackground.", AnsiBackground.class)); - enums.add(new MappedEnum("Ansi.", AnsiStyle.class)); - enums.add(new MappedEnum("Ansi.", AnsiColor.class)); - enums.add(new MappedEnum("Ansi.BG_", AnsiBackground.class)); + List> enums = new ArrayList<>(); + enums.add(new MappedEnum<>("AnsiStyle.", AnsiStyle.class)); + enums.add(new MappedEnum<>("AnsiColor.", AnsiColor.class)); + enums.add(new MappedEnum<>("AnsiBackground.", AnsiBackground.class)); + enums.add(new MappedEnum<>("Ansi.", AnsiStyle.class)); + enums.add(new MappedEnum<>("Ansi.", AnsiColor.class)); + enums.add(new MappedEnum<>("Ansi.BG_", AnsiBackground.class)); MAPPED_ENUMS = Collections.unmodifiableList(enums); } diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcher.java b/spring-boot/src/main/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcher.java index 859d57be0c..58b80d2f93 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcher.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/DefaultPropertyNamePatternsMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -42,7 +42,7 @@ class DefaultPropertyNamePatternsMatcher implements PropertyNamePatternsMatcher protected DefaultPropertyNamePatternsMatcher(char[] delimiters, boolean ignoreCase, String... names) { - this(delimiters, ignoreCase, new HashSet(Arrays.asList(names))); + this(delimiters, ignoreCase, new HashSet<>(Arrays.asList(names))); } DefaultPropertyNamePatternsMatcher(char[] delimiters, boolean ignoreCase, diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java index 3b266f4b28..be8fd600d8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java @@ -258,7 +258,7 @@ public class PropertiesConfigurationFactory } private Set getNames(Iterable prefixes) { - Set names = new LinkedHashSet(); + Set names = new LinkedHashSet<>(); if (this.target != null) { PropertyDescriptor[] descriptors = BeanUtils .getPropertyDescriptors(this.target.getClass()); @@ -304,7 +304,7 @@ public class PropertiesConfigurationFactory // We can filter properties to those starting with the target name, but // we can't do a complete filter since we need to trigger the // unknown fields check - Set relaxedNames = new HashSet(); + Set relaxedNames = new HashSet<>(); for (String relaxedTargetName : relaxedTargetNames) { relaxedNames.add(relaxedTargetName); } diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourceUtils.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourceUtils.java index e7449add66..fb30e91d90 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourceUtils.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 abstract class PropertySourceUtils { public static Map getSubProperties(PropertySources propertySources, String rootPrefix, String keyPrefix) { RelaxedNames keyPrefixes = new RelaxedNames(keyPrefix); - Map subProperties = new LinkedHashMap(); + Map subProperties = new LinkedHashMap<>(); for (PropertySource source : propertySources) { if (source instanceof EnumerablePropertySource) { for (String name : ((EnumerablePropertySource) source) diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesBinder.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesBinder.java index c23bbd248d..8e59e80ea9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesBinder.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -88,7 +88,7 @@ public class PropertySourcesBinder { * @return the keys matching the prefix */ public Map extractAll(String prefix) { - Map content = new LinkedHashMap(); + Map content = new LinkedHashMap<>(); bindTo(prefix, content); return content; } @@ -101,7 +101,7 @@ public class PropertySourcesBinder { * @param target the object to bind to */ public void bindTo(String prefix, Object target) { - PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory( + PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory<>( target); if (StringUtils.hasText(prefix)) { factory.setTargetName(prefix); diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java index 710197bedf..ce0b73cab5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java @@ -52,9 +52,9 @@ public class PropertySourcesPropertyValues implements PropertyValues { private final PropertyNamePatternsMatcher includes; - private final Map propertyValues = new LinkedHashMap(); + private final Map propertyValues = new LinkedHashMap<>(); - private final ConcurrentHashMap> collectionOwners = new ConcurrentHashMap>(); + private final ConcurrentHashMap> collectionOwners = new ConcurrentHashMap<>(); private final boolean resolvePlaceholders; diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java index fc1ca4133a..48fe904bbc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedDataBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -64,7 +64,7 @@ public class RelaxedDataBinder extends DataBinder { private boolean ignoreNestedProperties; - private MultiValueMap nameAliases = new LinkedMultiValueMap(); + private MultiValueMap nameAliases = new LinkedMultiValueMap<>(); /** * Create a new {@link RelaxedDataBinder} instance. @@ -107,7 +107,7 @@ public class RelaxedDataBinder extends DataBinder { * @param aliases a map of property name to aliases */ public void setNameAliases(Map> aliases) { - this.nameAliases = new LinkedMultiValueMap(aliases); + this.nameAliases = new LinkedMultiValueMap<>(aliases); } /** @@ -147,8 +147,8 @@ public class RelaxedDataBinder extends DataBinder { wrapper.setConversionService( new RelaxedConversionService(getConversionService())); wrapper.setAutoGrowNestedPaths(true); - List sortedValues = new ArrayList(); - Set modifiedNames = new HashSet(); + List sortedValues = new ArrayList<>(); + Set modifiedNames = new HashSet<>(); List sortedNames = getSortedPropertyNames(propertyValues); for (String name : sortedNames) { PropertyValue propertyValue = propertyValues.getPropertyValue(name); @@ -161,7 +161,7 @@ public class RelaxedDataBinder extends DataBinder { } private List getSortedPropertyNames(MutablePropertyValues propertyValues) { - List names = new LinkedList(); + List names = new LinkedList<>(); for (PropertyValue propertyValue : propertyValues.getPropertyValueList()) { names.add(propertyValue.getName()); } @@ -178,7 +178,7 @@ public class RelaxedDataBinder extends DataBinder { * @param names the names to sort */ private void sortPropertyNames(List names) { - for (String name : new ArrayList(names)) { + for (String name : new ArrayList<>(names)) { int propertyIndex = names.indexOf(name); BeanPath path = new BeanPath(name); for (String prefix : path.prefixes()) { @@ -343,7 +343,7 @@ public class RelaxedDataBinder extends DataBinder { } Object extend = new LinkedHashMap(); if (!elementDescriptor.isMap() && path.isArrayIndex(index)) { - extend = new ArrayList(); + extend = new ArrayList<>(); } wrapper.setPropertyValue(path.prefix(index + 1), extend); } @@ -372,7 +372,7 @@ public class RelaxedDataBinder extends DataBinder { } Object extend = new LinkedHashMap(); if (descriptor.isCollection()) { - extend = new ArrayList(); + extend = new ArrayList<>(); } if (descriptor.getType().equals(Object.class) && path.isLastNode(index)) { extend = BLANK; @@ -438,7 +438,7 @@ public class RelaxedDataBinder extends DataBinder { if (aliases == null) { return Collections.singleton(name); } - List nameAndAliases = new ArrayList(aliases.size() + 1); + List nameAndAliases = new ArrayList<>(aliases.size() + 1); nameAndAliases.add(name); nameAndAliases.addAll(aliases); return nameAndAliases; @@ -486,7 +486,7 @@ public class RelaxedDataBinder extends DataBinder { } public List prefixes() { - List prefixes = new ArrayList(); + List prefixes = new ArrayList<>(); for (int index = 1; index < this.nodes.size(); index++) { prefixes.add(prefix(index)); } @@ -498,7 +498,7 @@ public class RelaxedDataBinder extends DataBinder { } private List splitPath(String path) { - List nodes = new ArrayList(); + List nodes = new ArrayList<>(); String current = extractIndexedPaths(path, nodes); for (String name : StringUtils.delimitedListToStringArray(current, ".")) { if (StringUtils.hasText(name)) { @@ -532,7 +532,7 @@ public class RelaxedDataBinder extends DataBinder { } public void collapseKeys(int index) { - List revised = new ArrayList(); + List revised = new ArrayList<>(); for (int i = 0; i < index; i++) { revised.add(this.nodes.get(i)); } @@ -683,7 +683,7 @@ public class RelaxedDataBinder extends DataBinder { private static final Set BENIGN_PROPERTY_SOURCE_NAMES; static { - Set names = new HashSet(); + Set names = new HashSet<>(); names.add(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME); names.add(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); BENIGN_PROPERTY_SOURCE_NAMES = Collections.unmodifiableSet(names); diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java index 07f793c5b8..bd77de3900 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java @@ -41,7 +41,7 @@ public final class RelaxedNames implements Iterable { private final String name; - private final Set values = new LinkedHashSet(); + private final Set values = new LinkedHashSet<>(); /** * Create a new {@link RelaxedNames} instance. diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java b/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java index fc27b860db..63fdf39b5e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/YamlConfigurationFactory.java @@ -91,8 +91,7 @@ public class YamlConfigurationFactory * @param propertyAliases the property aliases */ public void setPropertyAliases(Map, Map> propertyAliases) { - this.propertyAliases = new HashMap, Map>( - propertyAliases); + this.propertyAliases = new HashMap<>(propertyAliases); } /** diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java b/spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java index dabd103dd7..6d0688342d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/YamlJavaBeanPropertyConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ import org.yaml.snakeyaml.nodes.NodeId; */ public class YamlJavaBeanPropertyConstructor extends Constructor { - private final Map, Map> properties = new HashMap, Map>(); + private final Map, Map> properties = new HashMap<>(); private final PropertyUtils propertyUtils = new PropertyUtils(); @@ -66,7 +66,7 @@ public class YamlJavaBeanPropertyConstructor extends Constructor { protected final void addPropertyAlias(String alias, Class type, String name) { Map typeMap = this.properties.get(type); if (typeMap == null) { - typeMap = new HashMap(); + typeMap = new HashMap<>(); this.properties.put(type, typeMap); } try { diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java index 0872aee2e7..ad95daa3c3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -89,8 +89,7 @@ public class ParentContextCloserApplicationListener private WeakReference childContext; public ContextCloserListener(ConfigurableApplicationContext childContext) { - this.childContext = new WeakReference( - childContext); + this.childContext = new WeakReference<>(childContext); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java index 34b8b8506a..bc189681c4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java @@ -72,13 +72,13 @@ public class SpringApplicationBuilder { private final AtomicBoolean running = new AtomicBoolean(false); - private final Set sources = new LinkedHashSet(); + private final Set sources = new LinkedHashSet<>(); - private final Map defaultProperties = new LinkedHashMap(); + private final Map defaultProperties = new LinkedHashMap<>(); private ConfigurableEnvironment environment; - private Set additionalProfiles = new LinkedHashSet(); + private Set additionalProfiles = new LinkedHashSet<>(); private boolean registerShutdownHookApplied; @@ -278,7 +278,7 @@ public class SpringApplicationBuilder { * @return the current builder */ public SpringApplicationBuilder sources(Object... sources) { - this.sources.addAll(new LinkedHashSet(Arrays.asList(sources))); + this.sources.addAll(new LinkedHashSet<>(Arrays.asList(sources))); return this; } @@ -398,7 +398,7 @@ public class SpringApplicationBuilder { } private Map getMapFromKeyValuePairs(String[] properties) { - Map map = new HashMap(); + Map map = new HashMap<>(); for (String property : properties) { int index = lowestIndexOf(property, ":", "="); String key = property.substring(0, index > 0 ? index : property.length()); @@ -430,7 +430,7 @@ public class SpringApplicationBuilder { } private Map getMapFromProperties(Properties properties) { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); for (Object key : Collections.list(properties.propertyNames())) { map.put((String) key, properties.get(key)); } @@ -468,7 +468,7 @@ public class SpringApplicationBuilder { private SpringApplicationBuilder additionalProfiles( Collection additionalProfiles) { - this.additionalProfiles = new LinkedHashSet(additionalProfiles); + this.additionalProfiles = new LinkedHashSet<>(additionalProfiles); this.application.setAdditionalProfiles(this.additionalProfiles .toArray(new String[this.additionalProfiles.size()])); return this; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java index 73ba57fbb4..ecacf8b246 100755 --- a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java @@ -134,7 +134,7 @@ public class ConfigurationWarningsApplicationContextInitializer private static final Set PROBLEM_PACKAGES; static { - Set packages = new HashSet(); + Set packages = new HashSet<>(); packages.add("org.springframework"); packages.add("org"); PROBLEM_PACKAGES = Collections.unmodifiableSet(packages); @@ -155,7 +155,7 @@ public class ConfigurationWarningsApplicationContextInitializer protected Set getComponentScanningPackages( BeanDefinitionRegistry registry) { - Set packages = new LinkedHashSet(); + Set packages = new LinkedHashSet<>(); String[] names = registry.getBeanDefinitionNames(); for (String name : names) { BeanDefinition definition = registry.getBeanDefinition(name); @@ -197,7 +197,7 @@ public class ConfigurationWarningsApplicationContextInitializer } private List getProblematicPackages(Set scannedPackages) { - List problematicPackages = new ArrayList(); + List problematicPackages = new ArrayList<>(); for (String scannedPackage : scannedPackages) { if (isProblematicPackage(scannedPackage)) { problematicPackages.add(getDisplayName(scannedPackage)); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/GenericReactiveWebApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/context/GenericReactiveWebApplicationContext.java index 52f5b44cbc..8b06e4971b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/GenericReactiveWebApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/GenericReactiveWebApplicationContext.java @@ -25,9 +25,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext * @author Stephane Nicoll * @since 2.0.0 */ -public class GenericReactiveWebApplicationContext - extends AnnotationConfigApplicationContext - implements ReactiveWebApplicationContext { +public class GenericReactiveWebApplicationContext extends + AnnotationConfigApplicationContext implements ReactiveWebApplicationContext { public GenericReactiveWebApplicationContext() { super(); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index cac0167225..f55e4c473b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -301,7 +301,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, this.propertiesLoader = new PropertySourcesLoader(); this.activatedProfiles = false; this.profiles = Collections.asLifoQueue(new LinkedList()); - this.processedProfiles = new LinkedList(); + this.processedProfiles = new LinkedList<>(); // Pre-existing active profiles set via Environment.setActiveProfiles() // are additional profiles and config files are allowed to add more if @@ -351,7 +351,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, // properties) take precedence over those added in config files. SpringProfiles springProfiles = bindSpringProfiles( this.environment.getPropertySources()); - Set activeProfiles = new LinkedHashSet( + Set activeProfiles = new LinkedHashSet<>( springProfiles.getActiveProfiles()); activeProfiles.addAll(springProfiles.getIncludeProfiles()); maybeActivateProfiles(activeProfiles); @@ -372,7 +372,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, */ private List getUnprocessedActiveProfiles( Set initialActiveProfiles) { - List unprocessedActiveProfiles = new ArrayList(); + List unprocessedActiveProfiles = new ArrayList<>(); for (String profileName : this.environment.getActiveProfiles()) { Profile profile = new Profile(profileName); if (!initialActiveProfiles.contains(profile)) { @@ -490,7 +490,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, } private List resolvePlaceholders(List values) { - List resolved = new ArrayList(); + List resolved = new ArrayList<>(); for (String value : values) { resolved.add(this.environment.resolvePlaceholders(value)); } @@ -545,7 +545,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, private void prependProfile(ConfigurableEnvironment environment, Profile profile) { - Set profiles = new LinkedHashSet(); + Set profiles = new LinkedHashSet<>(); environment.getActiveProfiles(); // ensure they are initialized // But this one should go first (last wins in a property key clash) profiles.add(profile.getName()); @@ -554,7 +554,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, } private Set getSearchLocations() { - Set locations = new LinkedHashSet(); + Set locations = new LinkedHashSet<>(); // User-configured settings take precedence, so we do them first if (this.environment.containsProperty(CONFIG_LOCATION_PROPERTY)) { for (String path : asResolvedSet( @@ -587,11 +587,11 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, StringUtils.commaDelimitedListToStringArray(value != null ? this.environment.resolvePlaceholders(value) : fallback))); Collections.reverse(list); - return new LinkedHashSet(list); + return new LinkedHashSet<>(list); } private void addConfigurationProperties(MutablePropertySources sources) { - List> reorderedSources = new ArrayList>(); + List> reorderedSources = new ArrayList<>(); for (PropertySource item : sources) { reorderedSources.add(item); } @@ -674,7 +674,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, ConfigurationPropertySources(Collection> sources) { super(APPLICATION_CONFIGURATION_PROPERTY_SOURCE_NAME, sources); this.sources = sources; - List names = new ArrayList(); + List names = new ArrayList<>(); for (PropertySource source : sources) { if (source instanceof EnumerablePropertySource) { names.addAll(Arrays.asList( @@ -728,9 +728,9 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, */ static final class SpringProfiles { - private List active = new ArrayList(); + private List active = new ArrayList<>(); - private List include = new ArrayList(); + private List include = new ArrayList<>(); public List getActive() { return this.active; @@ -757,12 +757,12 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, } private Set asProfileSet(List profileNames) { - List profiles = new ArrayList(); + List profiles = new ArrayList<>(); for (String profileName : profileNames) { profiles.add(new Profile(profileName)); } Collections.reverse(profiles); - return new LinkedHashSet(profiles); + return new LinkedHashSet<>(profiles); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java index 8a845b487a..5d2fa55ad0 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2017 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 DelegatingApplicationContextInitializer implements private List> getInitializerClasses(ConfigurableEnvironment env) { String classNames = env.getProperty(PROPERTY_NAME); - List> classes = new ArrayList>(); + List> classes = new ArrayList<>(); if (StringUtils.hasLength(classNames)) { for (String className : StringUtils.tokenizeToStringArray(classNames, ",")) { classes.add(getInitializerClass(className)); @@ -84,7 +84,7 @@ public class DelegatingApplicationContextInitializer implements private void applyInitializerClasses(ConfigurableApplicationContext context, List> initializerClasses) { Class contextClass = context.getClass(); - List> initializers = new ArrayList>(); + List> initializers = new ArrayList<>(); for (Class initializerClass : initializerClasses) { initializers.add(instantiateInitializer(contextClass, initializerClass)); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java index 08264ba694..bfa1f7ed4a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/DelegatingApplicationListener.java @@ -76,7 +76,7 @@ public class DelegatingApplicationListener return Collections.emptyList(); } String classNames = environment.getProperty(PROPERTY_NAME); - List> listeners = new ArrayList>(); + List> listeners = new ArrayList<>(); if (StringUtils.hasLength(classNames)) { for (String className : StringUtils.commaDelimitedListToSet(classNames)) { try { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java index 1718460d0d..a6d32682f8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableEmbeddedServletContainer.java @@ -60,11 +60,11 @@ public abstract class AbstractConfigurableEmbeddedServletContainer private int port = 8080; - private List initializers = new ArrayList(); + private List initializers = new ArrayList<>(); private File documentRoot; - private Set errorPages = new LinkedHashSet(); + private Set errorPages = new LinkedHashSet<>(); private MimeMappings mimeMappings = new MimeMappings(MimeMappings.DEFAULT); @@ -86,7 +86,7 @@ public abstract class AbstractConfigurableEmbeddedServletContainer private String serverHeader; - private Map localeCharsetMappings = new HashMap(); + private Map localeCharsetMappings = new HashMap<>(); /** * Create a new {@link AbstractConfigurableEmbeddedServletContainer} instance. @@ -219,7 +219,7 @@ public abstract class AbstractConfigurableEmbeddedServletContainer @Override public void setInitializers(List initializers) { Assert.notNull(initializers, "Initializers must not be null"); - this.initializers = new ArrayList(initializers); + this.initializers = new ArrayList<>(initializers); } @Override @@ -245,7 +245,7 @@ public abstract class AbstractConfigurableEmbeddedServletContainer @Override public void setErrorPages(Set errorPages) { Assert.notNull(errorPages, "ErrorPages must not be null"); - this.errorPages = new LinkedHashSet(errorPages); + this.errorPages = new LinkedHashSet<>(errorPages); } @Override @@ -357,7 +357,7 @@ public abstract class AbstractConfigurableEmbeddedServletContainer */ protected final ServletContextInitializer[] mergeInitializers( ServletContextInitializer... initializers) { - List mergedInitializers = new ArrayList(); + List mergedInitializers = new ArrayList<>(); mergedInitializers.addAll(Arrays.asList(initializers)); mergedInitializers.addAll(this.initializers); return mergedInitializers diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableReactiveWebServer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableReactiveWebServer.java index 20ce1af5d7..1dd9db0312 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableReactiveWebServer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractConfigurableReactiveWebServer.java @@ -35,7 +35,7 @@ public class AbstractConfigurableReactiveWebServer private int port = 8080; - private Set errorPages = new LinkedHashSet(); + private Set errorPages = new LinkedHashSet<>(); private InetAddress address; @@ -91,7 +91,7 @@ public class AbstractConfigurableReactiveWebServer @Override public void setErrorPages(Set errorPages) { Assert.notNull(errorPages, "ErrorPages must not be null"); - this.errorPages = new LinkedHashSet(errorPages); + this.errorPages = new LinkedHashSet<>(errorPages); } @Override diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java index 5bb072cf42..87fa06faef 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java @@ -92,7 +92,7 @@ public abstract class AbstractEmbeddedServletContainerFactory protected List getUrlsOfJarsWithMetaInfResources() { ClassLoader classLoader = getClass().getClassLoader(); - List staticResourceUrls = new ArrayList(); + List staticResourceUrls = new ArrayList<>(); if (classLoader instanceof URLClassLoader) { for (URL url : ((URLClassLoader) classLoader).getURLs()) { try { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedReactiveWebApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedReactiveWebApplicationContext.java index 4c3be617be..a469bf0af5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedReactiveWebApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedReactiveWebApplicationContext.java @@ -23,8 +23,8 @@ import org.springframework.http.server.reactive.HttpHandler; import org.springframework.util.StringUtils; /** - * A {@link GenericReactiveWebApplicationContext} that can be used to bootstrap - * itself from a contained embedded web server factory bean. + * A {@link GenericReactiveWebApplicationContext} that can be used to bootstrap itself + * from a contained embedded web server factory bean. * * @author Brian Clozel * @since 2.0.0 @@ -60,7 +60,8 @@ public class EmbeddedReactiveWebApplicationContext createEmbeddedServletContainer(); } catch (Throwable ex) { - throw new ApplicationContextException("Unable to start reactive web server", ex); + throw new ApplicationContextException("Unable to start reactive web server", + ex); } } @@ -90,9 +91,9 @@ public class EmbeddedReactiveWebApplicationContext } /** - * Return the {@link ReactiveWebServerFactory} that should be used to create - * the reactive web server. By default this method searches for a suitable bean - * in the context itself. + * Return the {@link ReactiveWebServerFactory} that should be used to create the + * reactive web server. By default this method searches for a suitable bean in the + * context itself. * @return a {@link ReactiveWebServerFactory} (never {@code null}) */ protected ReactiveWebServerFactory getReactiveWebServerFactory() { @@ -114,15 +115,13 @@ public class EmbeddedReactiveWebApplicationContext } /** - * Return the {@link HttpHandler} that should be used to process - * the reactive web server. By default this method searches for a suitable bean - * in the context itself. + * Return the {@link HttpHandler} that should be used to process the reactive web + * server. By default this method searches for a suitable bean in the context itself. * @return a {@link HttpHandler} (never {@code null} */ protected HttpHandler getHttpHandler() { // Use bean names so that we don't consider the hierarchy - String[] beanNames = getBeanFactory() - .getBeanNamesForType(HttpHandler.class); + String[] beanNames = getBeanFactory().getBeanNamesForType(HttpHandler.class); if (beanNames.length == 0) { throw new ApplicationContextException( "Unable to start ReactiveWebApplicationContext due to missing HttpHandler bean."); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java index 329f4e3c0d..a897623dfd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java @@ -77,11 +77,8 @@ public class EmbeddedServletContainerCustomizerBeanPostProcessor private Collection getCustomizers() { if (this.customizers == null) { // Look up does not include the parent context - this.customizers = new ArrayList( - this.beanFactory - .getBeansOfType(EmbeddedServletContainerCustomizer.class, - false, false) - .values()); + this.customizers = new ArrayList<>(this.beanFactory.getBeansOfType( + EmbeddedServletContainerCustomizer.class, false, false).values()); Collections.sort(this.customizers, AnnotationAwareOrderComparator.INSTANCE); this.customizers = Collections.unmodifiableList(this.customizers); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerFactory.java index a0095cb2ab..57ff7ee5d8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerFactory.java @@ -37,8 +37,8 @@ import org.springframework.boot.web.servlet.ServletContextInitializer; public interface EmbeddedServletContainerFactory { /** - * Gets a new fully configured but paused {@link EmbeddedWebServer} instance. - * Clients should not be able to connect to the returned server until + * Gets a new fully configured but paused {@link EmbeddedWebServer} instance. Clients + * should not be able to connect to the returned server until * {@link EmbeddedWebServer#start()} is called (which happens when the * {@link ApplicationContext} has been fully refreshed). * @param initializers {@link ServletContextInitializer}s that should be applied as diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java index b09c1526fb..b59f000338 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java @@ -57,8 +57,8 @@ import org.springframework.web.context.support.WebApplicationContextUtils; * A {@link WebApplicationContext} that can be used to bootstrap itself from a contained * {@link EmbeddedServletContainerFactory} bean. *

- * This context will create, initialize and run an {@link EmbeddedWebServer} by - * searching for a single {@link EmbeddedServletContainerFactory} bean within the + * This context will create, initialize and run an {@link EmbeddedWebServer} by searching + * for a single {@link EmbeddedServletContainerFactory} bean within the * {@link ApplicationContext} itself. The {@link EmbeddedServletContainerFactory} is free * to use standard Spring concepts (such as dependency injection, lifecycle callbacks and * property placeholder variables). @@ -359,7 +359,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext private static final Set SCOPES; static { - Set scopes = new LinkedHashSet(); + Set scopes = new LinkedHashSet<>(); scopes.add(WebApplicationContext.SCOPE_REQUEST); scopes.add(WebApplicationContext.SCOPE_SESSION); SCOPES = Collections.unmodifiableSet(scopes); @@ -367,7 +367,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext private final ConfigurableListableBeanFactory beanFactory; - private final Map scopes = new HashMap(); + private final Map scopes = new HashMap<>(); public ExistingWebApplicationScopes(ConfigurableListableBeanFactory beanFactory) { this.beanFactory = beanFactory; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/Jsp.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/Jsp.java index ee247e1f78..0c8f1e4eeb 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/Jsp.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/Jsp.java @@ -38,7 +38,7 @@ public class Jsp { /** * Init parameters used to configure the JSP servlet. */ - private Map initParameters = new HashMap(); + private Map initParameters = new HashMap<>(); /** * Whether or not the JSP servlet should be registered with the embedded servlet diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java index f390ca3970..06f2215663 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/MimeMappings.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -225,7 +225,7 @@ public final class MimeMappings implements Iterable { * Create a new empty {@link MimeMappings} instance. */ public MimeMappings() { - this.map = new LinkedHashMap(); + this.map = new LinkedHashMap<>(); } /** @@ -243,7 +243,7 @@ public final class MimeMappings implements Iterable { */ public MimeMappings(Map mappings) { Assert.notNull(mappings, "Mappings must not be null"); - this.map = new LinkedHashMap(); + this.map = new LinkedHashMap<>(); for (Map.Entry entry : mappings.entrySet()) { add(entry.getKey(), entry.getValue()); } @@ -256,8 +256,7 @@ public final class MimeMappings implements Iterable { */ private MimeMappings(MimeMappings mappings, boolean mutable) { Assert.notNull(mappings, "Mappings must not be null"); - this.map = (mutable - ? new LinkedHashMap(mappings.map) + this.map = (mutable ? new LinkedHashMap<>(mappings.map) : Collections.unmodifiableMap(mappings.map)); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ReactiveWebServerCustomizerBeanPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ReactiveWebServerCustomizerBeanPostProcessor.java index c47a30c436..1d11c10421 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ReactiveWebServerCustomizerBeanPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ReactiveWebServerCustomizerBeanPostProcessor.java @@ -72,7 +72,7 @@ public class ReactiveWebServerCustomizerBeanPostProcessor private Collection getCustomizers() { if (this.customizers == null) { // Look up does not include the parent context - this.customizers = new ArrayList(this.beanFactory + this.customizers = new ArrayList<>(this.beanFactory .getBeansOfType(ReactiveWebServerCustomizer.class, false, false) .values()); Collections.sort(this.customizers, AnnotationAwareOrderComparator.INSTANCE); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/Servlet.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/Servlet.java index ce98e106c0..adf56f85f3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/Servlet.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/Servlet.java @@ -35,7 +35,7 @@ public class Servlet { /** * ServletContext parameters. */ - private final Map contextParameters = new HashMap(); + private final Map contextParameters = new HashMap<>(); /** * Context path of the application. @@ -136,5 +136,4 @@ public class Servlet { return result; } - } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/SslStoreProvider.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/SslStoreProvider.java index 3e0ae57c71..476aa1f384 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/SslStoreProvider.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/SslStoreProvider.java @@ -19,8 +19,8 @@ package org.springframework.boot.context.embedded; import java.security.KeyStore; /** - * Interface to provide SSL key stores for an {@link EmbeddedWebServer} to use. Can - * be used when file based key stores cannot be used. + * Interface to provide SSL key stores for an {@link EmbeddedWebServer} to use. Can be + * used when file based key stores cannot be used. * * @author Phillip Webb * @since 1.4.0 diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java index 063d6542be..3984bbadb5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java @@ -36,9 +36,9 @@ import org.springframework.util.ReflectionUtils; import org.springframework.util.StringUtils; /** - * {@link EmbeddedWebServer} that can be used to control an embedded Jetty server. - * Usually this class should be created using the - * {@link JettyEmbeddedServletContainerFactory} and not directly. + * {@link EmbeddedWebServer} that can be used to control an embedded Jetty server. Usually + * this class should be created using the {@link JettyEmbeddedServletContainerFactory} and + * not directly. * * @author Phillip Webb * @author Dave Syer diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java index 67961dce50..143dd12031 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java @@ -103,7 +103,7 @@ import org.springframework.util.StringUtils; public class JettyEmbeddedServletContainerFactory extends AbstractEmbeddedServletContainerFactory implements ResourceLoaderAware { - private List configurations = new ArrayList(); + private List configurations = new ArrayList<>(); private boolean useForwardHeaders; @@ -117,7 +117,7 @@ public class JettyEmbeddedServletContainerFactory */ private int selectors = -1; - private List jettyServerCustomizers = new ArrayList(); + private List jettyServerCustomizers = new ArrayList<>(); private ResourceLoader resourceLoader; @@ -387,7 +387,7 @@ public class JettyEmbeddedServletContainerFactory File root = getValidDocumentRoot(); root = (root != null ? root : createTempDir("jetty-docbase")); try { - List resources = new ArrayList(); + List resources = new ArrayList<>(); resources.add( root.isDirectory() ? Resource.newResource(root.getCanonicalFile()) : JarResource.newJarResource(Resource.newResource(root))); @@ -450,7 +450,7 @@ public class JettyEmbeddedServletContainerFactory */ protected Configuration[] getWebAppContextConfigurations(WebAppContext webAppContext, ServletContextInitializer... initializers) { - List configurations = new ArrayList(); + List configurations = new ArrayList<>(); configurations.add( getServletContextInitializerConfiguration(webAppContext, initializers)); configurations.addAll(getConfigurations()); @@ -570,7 +570,7 @@ public class JettyEmbeddedServletContainerFactory public void setServerCustomizers( Collection customizers) { Assert.notNull(customizers, "Customizers must not be null"); - this.jettyServerCustomizers = new ArrayList(customizers); + this.jettyServerCustomizers = new ArrayList<>(customizers); } /** @@ -600,7 +600,7 @@ public class JettyEmbeddedServletContainerFactory */ public void setConfigurations(Collection configurations) { Assert.notNull(configurations, "Configurations must not be null"); - this.configurations = new ArrayList(configurations); + this.configurations = new ArrayList<>(configurations); } /** diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/package-info.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/package-info.java index 2c7d373b8e..fce2d0b53b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/package-info.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/package-info.java @@ -15,8 +15,7 @@ */ /** - * Support for Jetty - * {@link org.springframework.boot.context.embedded.EmbeddedWebServer + * Support for Jetty {@link org.springframework.boot.context.embedded.EmbeddedWebServer * EmbeddedServletContainers}. * * @see org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TldSkipPatterns.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TldSkipPatterns.java index ada51d6972..143556c98f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TldSkipPatterns.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TldSkipPatterns.java @@ -31,7 +31,7 @@ final class TldSkipPatterns { static { // Same as Tomcat - Set patterns = new LinkedHashSet(); + Set patterns = new LinkedHashSet<>(); patterns.add("ant-*.jar"); patterns.add("aspectj*.jar"); patterns.add("commons-beanutils*.jar"); @@ -75,7 +75,7 @@ final class TldSkipPatterns { static { // Additional typical for Spring Boot applications - Set patterns = new LinkedHashSet(); + Set patterns = new LinkedHashSet<>(); patterns.add("antlr-*.jar"); patterns.add("aopalliance-*.jar"); patterns.add("aspectjrt-*.jar"); @@ -127,7 +127,7 @@ final class TldSkipPatterns { static final Set DEFAULT; static { - Set patterns = new LinkedHashSet(); + Set patterns = new LinkedHashSet<>(); patterns.addAll(TOMCAT); patterns.addAll(ADDITIONAL); DEFAULT = Collections.unmodifiableSet(patterns); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java index 1b5052b3d8..0cd8be5c1e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java @@ -56,7 +56,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedWebServer { private final Object monitor = new Object(); - private final Map serviceConnectors = new HashMap(); + private final Map serviceConnectors = new HashMap<>(); private final Tomcat tomcat; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java index 64e2d8f22c..4d84190327 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java @@ -108,24 +108,23 @@ public class TomcatEmbeddedServletContainerFactory private File baseDirectory; - private List engineValves = new ArrayList(); + private List engineValves = new ArrayList<>(); - private List contextValves = new ArrayList(); + private List contextValves = new ArrayList<>(); - private List contextLifecycleListeners = new ArrayList(); + private List contextLifecycleListeners = new ArrayList<>(); - private List tomcatContextCustomizers = new ArrayList(); + private List tomcatContextCustomizers = new ArrayList<>(); - private List tomcatConnectorCustomizers = new ArrayList(); + private List tomcatConnectorCustomizers = new ArrayList<>(); - private List additionalTomcatConnectors = new ArrayList(); + private List additionalTomcatConnectors = new ArrayList<>(); private ResourceLoader resourceLoader; private String protocol = DEFAULT_PROTOCOL; - private Set tldSkipPatterns = new LinkedHashSet( - TldSkipPatterns.DEFAULT); + private Set tldSkipPatterns = new LinkedHashSet<>(TldSkipPatterns.DEFAULT); private Charset uriEncoding = DEFAULT_CHARSET; @@ -575,7 +574,7 @@ public class TomcatEmbeddedServletContainerFactory */ public void setTldSkipPatterns(Collection patterns) { Assert.notNull(patterns, "Patterns must not be null"); - this.tldSkipPatterns = new LinkedHashSet(patterns); + this.tldSkipPatterns = new LinkedHashSet<>(patterns); } /** @@ -605,7 +604,7 @@ public class TomcatEmbeddedServletContainerFactory */ public void setEngineValves(Collection engineValves) { Assert.notNull(engineValves, "Valves must not be null"); - this.engineValves = new ArrayList(engineValves); + this.engineValves = new ArrayList<>(engineValves); } /** @@ -633,7 +632,7 @@ public class TomcatEmbeddedServletContainerFactory */ public void setContextValves(Collection contextValves) { Assert.notNull(contextValves, "Valves must not be null"); - this.contextValves = new ArrayList(contextValves); + this.contextValves = new ArrayList<>(contextValves); } /** @@ -664,8 +663,7 @@ public class TomcatEmbeddedServletContainerFactory Collection contextLifecycleListeners) { Assert.notNull(contextLifecycleListeners, "ContextLifecycleListeners must not be null"); - this.contextLifecycleListeners = new ArrayList( - contextLifecycleListeners); + this.contextLifecycleListeners = new ArrayList<>(contextLifecycleListeners); } /** @@ -697,8 +695,7 @@ public class TomcatEmbeddedServletContainerFactory Collection tomcatContextCustomizers) { Assert.notNull(tomcatContextCustomizers, "TomcatContextCustomizers must not be null"); - this.tomcatContextCustomizers = new ArrayList( - tomcatContextCustomizers); + this.tomcatContextCustomizers = new ArrayList<>(tomcatContextCustomizers); } /** @@ -731,8 +728,7 @@ public class TomcatEmbeddedServletContainerFactory Collection tomcatConnectorCustomizers) { Assert.notNull(tomcatConnectorCustomizers, "TomcatConnectorCustomizers must not be null"); - this.tomcatConnectorCustomizers = new ArrayList( - tomcatConnectorCustomizers); + this.tomcatConnectorCustomizers = new ArrayList<>(tomcatConnectorCustomizers); } /** diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatWebServer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatWebServer.java index 1b5c21a123..0e94284165 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatWebServer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatWebServer.java @@ -54,7 +54,7 @@ public class TomcatWebServer implements EmbeddedWebServer { private final Object monitor = new Object(); - private final Map serviceConnectors = new HashMap(); + private final Map serviceConnectors = new HashMap<>(); private final Tomcat tomcat; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/package-info.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/package-info.java index bb22ecf666..38f950d811 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/package-info.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/package-info.java @@ -15,8 +15,7 @@ */ /** - * Support for Tomcat - * {@link org.springframework.boot.context.embedded.EmbeddedWebServer + * Support for Tomcat {@link org.springframework.boot.context.embedded.EmbeddedWebServer * EmbeddedServletContainers}. * * @see org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java index afd16c98bb..fb0afe4f4c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -71,7 +71,7 @@ public class FileSessionPersistence implements SessionPersistenceManager { private void save(Map sessionData, ObjectOutputStream stream) throws IOException { - Map session = new LinkedHashMap(); + Map session = new LinkedHashMap<>(); for (Map.Entry entry : sessionData.entrySet()) { session.put(entry.getKey(), new SerializablePersistentSession(entry.getValue())); @@ -110,7 +110,7 @@ public class FileSessionPersistence implements SessionPersistenceManager { throws ClassNotFoundException, IOException { Map session = readSession(stream); long time = System.currentTimeMillis(); - Map result = new LinkedHashMap(); + Map result = new LinkedHashMap<>(); for (Map.Entry entry : session .entrySet()) { PersistentSession entrySession = entry.getValue().getPersistentSession(); @@ -152,8 +152,7 @@ public class FileSessionPersistence implements SessionPersistenceManager { SerializablePersistentSession(PersistentSession session) { this.expiration = session.getExpiration(); - this.sessionData = new LinkedHashMap( - session.getSessionData()); + this.sessionData = new LinkedHashMap<>(session.getSessionData()); } public PersistentSession getPersistentSession() { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java index 4f21074b65..130582bf49 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java @@ -218,7 +218,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedWebServer { } private Predicate[] getCompressionPredicates(Compression compression) { - List predicates = new ArrayList(); + List predicates = new ArrayList<>(); predicates.add(new MaxSizePredicate(compression.getMinResponseSize())); predicates.add(new CompressibleMimeTypePredicate(compression.getMimeTypes())); if (compression.getExcludedUserAgents() != null) { @@ -240,7 +240,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedWebServer { } private List getActualPorts() { - List ports = new ArrayList(); + List ports = new ArrayList<>(); try { if (!this.autoStart) { ports.add(new Port(-1, "unknown")); @@ -276,7 +276,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedWebServer { } private List getConfiguredPorts() { - List ports = new ArrayList(); + List ports = new ArrayList<>(); for (Object listener : extractListeners()) { try { ports.add(getPortFromListener(listener)); @@ -384,7 +384,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedWebServer { private final List mimeTypes; CompressibleMimeTypePredicate(String[] mimeTypes) { - this.mimeTypes = new ArrayList(mimeTypes.length); + this.mimeTypes = new ArrayList<>(mimeTypes.length); for (String mimeTypeString : mimeTypes) { this.mimeTypes.add(MimeTypeUtils.parseMimeType(mimeTypeString)); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java index 603d7e8154..f33fc180c4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java @@ -102,9 +102,9 @@ public class UndertowEmbeddedServletContainerFactory private static final Set> NO_CLASSES = Collections.emptySet(); - private List builderCustomizers = new ArrayList(); + private List builderCustomizers = new ArrayList<>(); - private List deploymentInfoCustomizers = new ArrayList(); + private List deploymentInfoCustomizers = new ArrayList<>(); private ResourceLoader resourceLoader; @@ -167,7 +167,7 @@ public class UndertowEmbeddedServletContainerFactory public void setBuilderCustomizers( Collection customizers) { Assert.notNull(customizers, "Customizers must not be null"); - this.builderCustomizers = new ArrayList(customizers); + this.builderCustomizers = new ArrayList<>(customizers); } /** @@ -198,8 +198,7 @@ public class UndertowEmbeddedServletContainerFactory public void setDeploymentInfoCustomizers( Collection customizers) { Assert.notNull(customizers, "Customizers must not be null"); - this.deploymentInfoCustomizers = new ArrayList( - customizers); + this.deploymentInfoCustomizers = new ArrayList<>(customizers); } /** diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowWebServer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowWebServer.java index d6926556a8..cd562aed05 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowWebServer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowWebServer.java @@ -124,7 +124,7 @@ public class UndertowWebServer implements EmbeddedWebServer { } private List getActualPorts() { - List ports = new ArrayList(); + List ports = new ArrayList<>(); try { if (!this.autoStart) { ports.add(new UndertowWebServer.Port(-1, "unknown")); @@ -161,7 +161,7 @@ public class UndertowWebServer implements EmbeddedWebServer { } private List getConfiguredPorts() { - List ports = new ArrayList(); + List ports = new ArrayList<>(); for (Object listener : extractListeners()) { try { ports.add(getPortFromListener(listener)); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/package-info.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/package-info.java index dd03018228..1cc029ba69 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/package-info.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/package-info.java @@ -15,8 +15,7 @@ */ /** - * Support for Undertow - * {@link org.springframework.boot.context.embedded.EmbeddedWebServer + * Support for Undertow {@link org.springframework.boot.context.embedded.EmbeddedWebServer * EmbeddedServletContainers}. * * @see org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java index 67aa3b0e5a..536ab0a2a6 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetaData.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -41,7 +41,7 @@ public class ConfigurationBeanFactoryMetaData implements BeanFactoryPostProcesso private ConfigurableListableBeanFactory beanFactory; - private Map beans = new HashMap(); + private Map beans = new HashMap<>(); @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) @@ -59,7 +59,7 @@ public class ConfigurationBeanFactoryMetaData implements BeanFactoryPostProcesso public Map getBeansWithFactoryAnnotation( Class type) { - Map result = new HashMap(); + Map result = new HashMap<>(); for (String name : this.beans.keySet()) { if (findFactoryAnnotation(name, type) != null) { result.put(name, this.beanFactory.getBean(name)); @@ -78,7 +78,7 @@ public class ConfigurationBeanFactoryMetaData implements BeanFactoryPostProcesso if (!this.beans.containsKey(beanName)) { return null; } - final AtomicReference found = new AtomicReference(null); + final AtomicReference found = new AtomicReference<>(null); MetaData meta = this.beans.get(beanName); final String factory = meta.getMethod(); Class type = this.beanFactory.getType(meta.getBean()); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java index 2248200c1c..c1e358d1df 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -307,7 +307,7 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc private void postProcessBeforeInitialization(Object bean, String beanName, ConfigurationProperties annotation) { Object target = bean; - PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory( + PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory<>( target); factory.setPropertySources(this.propertySources); factory.setValidator(determineValidator(bean)); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java index aaf1471d6b..12e0f1a996 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java @@ -79,8 +79,8 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { String prefix = extractPrefix(type); String name = (StringUtils.hasText(prefix) ? prefix + "-" + type.getName() : type.getName()); - if (!containsBeanDefinition( - (ConfigurableListableBeanFactory) registry, name)) { + if (!containsBeanDefinition((ConfigurableListableBeanFactory) registry, + name)) { registerBeanDefinition(registry, type, name); } } @@ -96,7 +96,7 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { } private List> collectClasses(List list) { - ArrayList> result = new ArrayList>(); + ArrayList> result = new ArrayList<>(); for (Object object : list) { for (Object value : (Object[]) object) { if (value instanceof Class && value != void.class) { diff --git a/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java b/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java index cc22ee27da..477857170b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java +++ b/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java @@ -73,7 +73,7 @@ public final class FailureAnalyzers { private List loadFailureAnalyzers(ClassLoader classLoader) { List analyzerNames = SpringFactoriesLoader .loadFactoryNames(FailureAnalyzer.class, classLoader); - List analyzers = new ArrayList(); + List analyzers = new ArrayList<>(); for (String analyzerName : analyzerNames) { try { Constructor constructor = ClassUtils.forName(analyzerName, classLoader) diff --git a/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java b/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java index 47d803ccd2..2ccbe58633 100644 --- a/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java +++ b/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -39,7 +39,7 @@ class BeanCurrentlyInCreationFailureAnalyzer @Override protected FailureAnalysis analyze(Throwable rootFailure, BeanCurrentlyInCreationException cause) { - List cycle = new ArrayList(); + List cycle = new ArrayList<>(); Throwable candidate = rootFailure; int cycleStart = -1; while (candidate != null) { diff --git a/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java b/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java index 4db0d2b841..a6f8ac04be 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/EnumerableCompositePropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -57,9 +57,8 @@ public class EnumerableCompositePropertySource public String[] getPropertyNames() { String[] result = this.names; if (result == null) { - List names = new ArrayList(); - for (PropertySource source : new ArrayList>( - getSource())) { + List names = new ArrayList<>(); + for (PropertySource source : new ArrayList<>(getSource())) { if (source instanceof EnumerablePropertySource) { names.addAll(Arrays.asList( ((EnumerablePropertySource) source).getPropertyNames())); diff --git a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java index 37c20533f0..2b394e64c8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -200,7 +200,7 @@ public class PropertySourcesLoader { * @return the file extensions */ public Set getAllFileExtensions() { - Set fileExtensions = new LinkedHashSet(); + Set fileExtensions = new LinkedHashSet<>(); for (PropertySourceLoader loader : this.loaders) { fileExtensions.addAll(Arrays.asList(loader.getFileExtensions())); } diff --git a/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java index cea6ffb64c..3dba6bafb8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -102,7 +102,7 @@ public class SpringApplicationJsonEnvironmentPostProcessor * @return the flattened map */ private Map flatten(Map map) { - Map result = new LinkedHashMap(); + Map result = new LinkedHashMap<>(); flatten(null, result, map); return result; } diff --git a/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java b/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java index af8a3d1db0..8573108fa3 100755 --- a/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -97,7 +97,7 @@ public class YamlPropertySourceLoader implements PropertySourceLoader { } public Map process() { - final Map result = new LinkedHashMap(); + final Map result = new LinkedHashMap<>(); process(new MatchCallback() { @Override public void process(Properties properties, Map map) { diff --git a/spring-boot/src/main/java/org/springframework/boot/json/BasicJsonParser.java b/spring-boot/src/main/java/org/springframework/boot/json/BasicJsonParser.java index e3ffc4af0f..c6d0ca2ba0 100644 --- a/spring-boot/src/main/java/org/springframework/boot/json/BasicJsonParser.java +++ b/spring-boot/src/main/java/org/springframework/boot/json/BasicJsonParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 BasicJsonParser implements JsonParser { } private List parseListInternal(String json) { - List list = new ArrayList(); + List list = new ArrayList<>(); json = trimLeadingCharacter(trimTrailingCharacter(json, ']'), '['); for (String value : tokenize(json)) { list.add(parseInternal(value)); @@ -107,7 +107,7 @@ public class BasicJsonParser implements JsonParser { } private Map parseMapInternal(String json) { - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); json = trimLeadingCharacter(trimTrailingCharacter(json, '}'), '{'); for (String pair : tokenize(json)) { String[] values = StringUtils.trimArrayElements(StringUtils.split(pair, ":")); @@ -124,7 +124,7 @@ public class BasicJsonParser implements JsonParser { } private List tokenize(String json) { - List list = new ArrayList(); + List list = new ArrayList<>(); int index = 0; int inObject = 0; int inList = 0; diff --git a/spring-boot/src/main/java/org/springframework/boot/json/JsonJsonParser.java b/spring-boot/src/main/java/org/springframework/boot/json/JsonJsonParser.java index 9a41190b29..405bad36ee 100644 --- a/spring-boot/src/main/java/org/springframework/boot/json/JsonJsonParser.java +++ b/spring-boot/src/main/java/org/springframework/boot/json/JsonJsonParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -35,7 +35,7 @@ public class JsonJsonParser implements JsonParser { @Override public Map parseMap(String json) { - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); putAll(map, new JSONObject(json)); return map; } @@ -45,12 +45,12 @@ public class JsonJsonParser implements JsonParser { String name = key.toString(); Object value = object.get(name); if (value instanceof JSONObject) { - Map nested = new LinkedHashMap(); + Map nested = new LinkedHashMap<>(); putAll(nested, (JSONObject) value); value = nested; } if (value instanceof JSONArray) { - List nested = new ArrayList(); + List nested = new ArrayList<>(); addAll(nested, (JSONArray) value); value = nested; } @@ -62,12 +62,12 @@ public class JsonJsonParser implements JsonParser { for (int i = 0; i < array.length(); i++) { Object value = array.get(i); if (value instanceof JSONObject) { - Map nested = new LinkedHashMap(); + Map nested = new LinkedHashMap<>(); putAll(nested, (JSONObject) value); value = nested; } if (value instanceof JSONArray) { - List nested = new ArrayList(); + List nested = new ArrayList<>(); addAll(nested, (JSONArray) value); value = nested; } @@ -77,7 +77,7 @@ public class JsonJsonParser implements JsonParser { @Override public List parseList(String json) { - List nested = new ArrayList(); + List nested = new ArrayList<>(); addAll(nested, new JSONArray(json)); return nested; } diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java index dc2ba8587a..22dd96db3f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -60,7 +60,7 @@ public class AtomikosDependsOnBeanFactoryPostProcessor private void addTransactionManagerDependencies( ConfigurableListableBeanFactory beanFactory, String transactionManager) { BeanDefinition bean = beanFactory.getBeanDefinition(transactionManager); - Set dependsOn = new LinkedHashSet(asList(bean.getDependsOn())); + Set dependsOn = new LinkedHashSet<>(asList(bean.getDependsOn())); int initialSize = dependsOn.size(); addDependencies(beanFactory, "javax.jms.ConnectionFactory", dependsOn); addDependencies(beanFactory, "javax.sql.DataSource", dependsOn); @@ -75,8 +75,7 @@ public class AtomikosDependsOnBeanFactoryPostProcessor "com.atomikos.jms.extra.MessageDrivenContainer"); for (String messageDrivenContainer : messageDrivenContainers) { BeanDefinition bean = beanFactory.getBeanDefinition(messageDrivenContainer); - Set dependsOn = new LinkedHashSet( - asList(bean.getDependsOn())); + Set dependsOn = new LinkedHashSet<>(asList(bean.getDependsOn())); dependsOn.addAll(asList(transactionManagers)); bean.setDependsOn(dependsOn.toArray(new String[dependsOn.size()])); } diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java index c45b7c8957..5b6fc59baf 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosProperties.java @@ -36,7 +36,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "spring.jta.atomikos.properties") public class AtomikosProperties { - private final Map values = new TreeMap(); + private final Map values = new TreeMap<>(); /** * Transaction manager implementation that should be started. diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java index 93e4ac22ef..0f148fb64e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -47,7 +47,7 @@ import org.springframework.util.StringUtils; public class PoolingConnectionFactoryBean extends PoolingConnectionFactory implements BeanNameAware, InitializingBean, DisposableBean { - private static final ThreadLocal source = new ThreadLocal(); + private static final ThreadLocal source = new ThreadLocal<>(); private String beanName; diff --git a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java index 108277cdc5..b9054c17f2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/jta/bitronix/PoolingDataSourceBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -49,7 +49,7 @@ import org.springframework.util.StringUtils; public class PoolingDataSourceBean extends PoolingDataSource implements BeanNameAware, InitializingBean { - private static final ThreadLocal source = new ThreadLocal(); + private static final ThreadLocal source = new ThreadLocal<>(); private XADataSource dataSource; diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java index bb6d40e8e6..38dcb4910b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java @@ -194,8 +194,8 @@ public abstract class AbstractLoggingSystem extends LoggingSystem { private final Map nativeToSystem; public LogLevels() { - this.systemToNative = new HashMap(); - this.nativeToSystem = new HashMap(); + this.systemToNative = new HashMap<>(); + this.nativeToSystem = new HashMap<>(); } public void map(LogLevel system, T nativeLevel) { @@ -214,7 +214,7 @@ public abstract class AbstractLoggingSystem extends LoggingSystem { } public Set getSupported() { - return new LinkedHashSet(this.nativeToSystem.values()); + return new LinkedHashSet<>(this.nativeToSystem.values()); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java b/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java index 3bd3056d5d..c30e9b674c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -31,7 +31,7 @@ import org.apache.commons.logging.LogFactory; */ public class DeferredLog implements Log { - private List lines = new ArrayList(); + private List lines = new ArrayList<>(); @Override public boolean isTraceEnabled() { diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java index 9ea1cb6c93..5e9bbe26b0 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java @@ -102,7 +102,8 @@ public final class LoggerConfiguration { rtn = rtn && ObjectUtils.nullSafeEquals(this.name, other.name); rtn = rtn && ObjectUtils.nullSafeEquals(this.configuredLevel, other.configuredLevel); - rtn = rtn && ObjectUtils.nullSafeEquals(this.effectiveLevel, other.effectiveLevel); + rtn = rtn && ObjectUtils.nullSafeEquals(this.effectiveLevel, + other.effectiveLevel); return rtn; } return super.equals(obj); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java index 5553b58b9c..9625b3c1bc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java @@ -155,7 +155,7 @@ public class LoggingApplicationListener implements GenericApplicationListener { private static AtomicBoolean shutdownHookRegistered = new AtomicBoolean(false); static { - LOG_LEVEL_LOGGERS = new LinkedMultiValueMap(); + LOG_LEVEL_LOGGERS = new LinkedMultiValueMap<>(); LOG_LEVEL_LOGGERS.add(LogLevel.DEBUG, "org.springframework.boot"); LOG_LEVEL_LOGGERS.add(LogLevel.TRACE, "org.springframework"); LOG_LEVEL_LOGGERS.add(LogLevel.TRACE, "org.apache.tomcat"); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java index 4d33be2ff7..c21f8bba14 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -57,7 +57,7 @@ public abstract class LoggingSystem { private static final Map SYSTEMS; static { - Map systems = new LinkedHashMap(); + Map systems = new LinkedHashMap<>(); systems.put("ch.qos.logback.core.Appender", "org.springframework.boot.logging.logback.LogbackLoggingSystem"); systems.put("org.apache.logging.log4j.core.impl.Log4jContextFactory", diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java index 451afd5ff9..16d3941a7e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/java/JavaLoggingSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -48,7 +48,7 @@ import org.springframework.util.StringUtils; */ public class JavaLoggingSystem extends AbstractLoggingSystem { - private static final LogLevels LEVELS = new LogLevels(); + private static final LogLevels LEVELS = new LogLevels<>(); static { LEVELS.map(LogLevel.TRACE, Level.FINEST); @@ -129,7 +129,7 @@ public class JavaLoggingSystem extends AbstractLoggingSystem { @Override public List getLoggerConfigurations() { - List result = new ArrayList(); + List result = new ArrayList<>(); Enumeration names = LogManager.getLogManager().getLoggerNames(); while (names.hasMoreElements()) { result.add(getLoggerConfiguration(names.nextElement())); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java index af4c305ec6..5cdce0a85c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ public final class ColorConverter extends LogEventPatternConverter { private static final Map ELEMENTS; static { - Map elements = new HashMap(); + Map elements = new HashMap<>(); elements.put("faint", AnsiStyle.FAINT); elements.put("red", AnsiColor.RED); elements.put("green", AnsiColor.GREEN); @@ -66,7 +66,7 @@ public final class ColorConverter extends LogEventPatternConverter { private static final Map LEVELS; static { - Map levels = new HashMap(); + Map levels = new HashMap<>(); levels.put(Level.FATAL.intLevel(), AnsiColor.RED); levels.put(Level.ERROR.intLevel(), AnsiColor.RED); levels.put(Level.WARN.intLevel(), AnsiColor.YELLOW); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java index 66b2d59743..b78142cc1a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java @@ -62,7 +62,7 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem { private static final String FILE_PROTOCOL = "file"; - private static final LogLevels LEVELS = new LogLevels(); + private static final LogLevels LEVELS = new LogLevels<>(); static { LEVELS.map(LogLevel.TRACE, Level.TRACE); @@ -111,7 +111,7 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem { } private String[] getCurrentlySupportedConfigLocations() { - List supportedConfigLocations = new ArrayList(); + List supportedConfigLocations = new ArrayList<>(); if (isClassAvailable("com.fasterxml.jackson.dataformat.yaml.YAMLParser")) { Collections.addAll(supportedConfigLocations, "log4j2.yaml", "log4j2.yml"); } @@ -215,7 +215,7 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem { @Override public List getLoggerConfigurations() { - List result = new ArrayList(); + List result = new ArrayList<>(); Configuration configuration = getLoggerContext().getConfiguration(); for (LoggerConfig loggerConfig : configuration.getLoggers().values()) { result.add(convertLoggerConfiguration(loggerConfig)); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java index aaac78b3a3..7bc70e1d20 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2017 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. @@ -41,7 +41,7 @@ public class ColorConverter extends CompositeConverter { private static final Map ELEMENTS; static { - Map elements = new HashMap(); + Map elements = new HashMap<>(); elements.put("faint", AnsiStyle.FAINT); elements.put("red", AnsiColor.RED); elements.put("green", AnsiColor.GREEN); @@ -55,7 +55,7 @@ public class ColorConverter extends CompositeConverter { private static final Map LEVELS; static { - Map levels = new HashMap(); + Map levels = new HashMap<>(); levels.put(Level.ERROR_INTEGER, AnsiColor.RED); levels.put(Level.WARN_INTEGER, AnsiColor.YELLOW); LEVELS = Collections.unmodifiableMap(levels); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java index 7c6036c6f2..ec1451bfb1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/DefaultLogbackConfiguration.java @@ -111,7 +111,7 @@ class DefaultLogbackConfiguration { } private Appender consoleAppender(LogbackConfigurator config) { - ConsoleAppender appender = new ConsoleAppender(); + ConsoleAppender appender = new ConsoleAppender<>(); PatternLayoutEncoder encoder = new PatternLayoutEncoder(); String logPattern = this.patterns.getProperty("console", CONSOLE_LOG_PATTERN); encoder.setPattern(OptionHelper.substVars(logPattern, config.getContext())); @@ -124,7 +124,7 @@ class DefaultLogbackConfiguration { private Appender fileAppender(LogbackConfigurator config, String logFile) { - RollingFileAppender appender = new RollingFileAppender(); + RollingFileAppender appender = new RollingFileAppender<>(); PatternLayoutEncoder encoder = new PatternLayoutEncoder(); String logPattern = this.patterns.getProperty("file", FILE_LOG_PATTERN); encoder.setPattern(OptionHelper.substVars(logPattern, config.getContext())); @@ -148,7 +148,7 @@ class DefaultLogbackConfiguration { private void setMaxFileSize(RollingFileAppender appender, LogbackConfigurator config) { - SizeBasedTriggeringPolicy triggeringPolicy = new SizeBasedTriggeringPolicy(); + SizeBasedTriggeringPolicy triggeringPolicy = new SizeBasedTriggeringPolicy<>(); try { triggeringPolicy.setMaxFileSize(FileSize.valueOf("10MB")); } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java index a08ef6efff..e7ee50510e 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -93,7 +93,7 @@ public class LevelRemappingAppender extends AppenderBase { */ public void setRemapLevels(String remapLevels) { Assert.hasLength(remapLevels, "RemapLevels must not be empty"); - this.remapLevels = new HashMap(); + this.remapLevels = new HashMap<>(); for (String remap : StringUtils.commaDelimitedListToStringArray(remapLevels)) { String[] split = StringUtils.split(remap, "->"); Assert.notNull(split, "Remap element '" + remap + "' must contain '->'"); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java index a8c2d7771e..a075f78be7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackConfigurator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -63,7 +63,7 @@ class LogbackConfigurator { Map registry = (Map) this.context .getObject(CoreConstants.PATTERN_RULE_REGISTRY); if (registry == null) { - registry = new HashMap(); + registry = new HashMap<>(); this.context.putObject(CoreConstants.PATTERN_RULE_REGISTRY, registry); } registry.put(conversionWord, converterClass.getName()); diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index c88a8db80b..3ea9cca505 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -60,7 +60,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { private static final String CONFIGURATION_FILE_PROPERTY = "logback.configurationFile"; - private static final LogLevels LEVELS = new LogLevels(); + private static final LogLevels LEVELS = new LogLevels<>(); static { LEVELS.map(LogLevel.TRACE, Level.TRACE); @@ -213,7 +213,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { @Override public List getLoggerConfigurations() { - List result = new ArrayList(); + List result = new ArrayList<>(); for (ch.qos.logback.classic.Logger logger : getLoggerContext().getLoggerList()) { result.add(getLoggerConfiguration(logger)); } diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java index 4ab29581c1..abc6070b0f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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 @@ class SpringProfileAction extends Action implements InPlayListener { } ic.pushObject(this); this.acceptsProfile = acceptsProfiles(ic, attributes); - this.events = new ArrayList(); + this.events = new ArrayList<>(); ic.addInPlayListener(this); } diff --git a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java index ebc691a177..af046592db 100644 --- a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java @@ -84,7 +84,7 @@ public class EntityManagerFactoryBuilder { URL persistenceUnitRootLocation) { this.jpaVendorAdapter = jpaVendorAdapter; this.persistenceUnitManager = persistenceUnitManager; - this.jpaProperties = new LinkedHashMap(jpaProperties); + this.jpaProperties = new LinkedHashMap<>(jpaProperties); this.persistenceUnitRootLocation = persistenceUnitRootLocation; } @@ -111,7 +111,7 @@ public class EntityManagerFactoryBuilder { private String persistenceUnit; - private Map properties = new HashMap(); + private Map properties = new HashMap<>(); private boolean jta; @@ -135,7 +135,7 @@ public class EntityManagerFactoryBuilder { * @return the builder for fluent usage */ public Builder packages(Class... basePackageClasses) { - Set packages = new HashSet(); + Set packages = new HashSet<>(); for (Class type : basePackageClasses) { packages.add(ClassUtils.getPackageName(type)); } diff --git a/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java b/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java index 18073ee275..afb0a2f565 100644 --- a/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java +++ b/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -69,7 +69,7 @@ public class ApplicationPidFileWriter private static final List FILE_PROPERTIES; static { - List properties = new ArrayList(); + List properties = new ArrayList<>(); properties.add(new SpringProperty("spring.pid.", "file")); properties.add(new SpringProperty("spring.", "pidfile")); properties.add(new SystemProperty("PIDFILE")); @@ -79,7 +79,7 @@ public class ApplicationPidFileWriter private static final List FAIL_ON_WRITE_ERROR_PROPERTIES; static { - List properties = new ArrayList(); + List properties = new ArrayList<>(); properties.add(new SpringProperty("spring.pid.", "fail-on-write-error")); properties.add(new SystemProperty("PID_FAIL_ON_WRITE_ERROR")); FAIL_ON_WRITE_ERROR_PROPERTIES = Collections.unmodifiableList(properties); diff --git a/spring-boot/src/main/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactory.java b/spring-boot/src/main/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactory.java index 6bcde54ea1..0a93bd7179 100644 --- a/spring-boot/src/main/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -39,7 +39,7 @@ import org.springframework.util.ConcurrentReferenceHashMap; public class ConcurrentReferenceCachingMetadataReaderFactory extends SimpleMetadataReaderFactory { - private final Map cache = new ConcurrentReferenceHashMap(); + private final Map cache = new ConcurrentReferenceHashMap<>(); /** * Create a new {@link ConcurrentReferenceCachingMetadataReaderFactory} instance for diff --git a/spring-boot/src/main/java/org/springframework/boot/validation/MessageInterpolatorFactory.java b/spring-boot/src/main/java/org/springframework/boot/validation/MessageInterpolatorFactory.java index c9c2ed9155..fb023b5740 100644 --- a/spring-boot/src/main/java/org/springframework/boot/validation/MessageInterpolatorFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/validation/MessageInterpolatorFactory.java @@ -41,7 +41,7 @@ public class MessageInterpolatorFactory implements ObjectFactory FALLBACKS; static { - Set fallbacks = new LinkedHashSet(); + Set fallbacks = new LinkedHashSet<>(); fallbacks.add("org.hibernate.validator.messageinterpolation" + ".ParameterMessageInterpolator"); FALLBACKS = Collections.unmodifiableSet(fallbacks); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java b/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java index 939a3d1503..c3df825a52 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -65,7 +65,7 @@ public class RestTemplateBuilder { private static final Map REQUEST_FACTORY_CANDIDATES; static { - Map candidates = new LinkedHashMap(); + Map candidates = new LinkedHashMap<>(); candidates.put("org.apache.http.client.HttpClient", "org.springframework.http.client.HttpComponentsClientHttpRequestFactory"); candidates.put("okhttp3.OkHttpClient", @@ -111,8 +111,8 @@ public class RestTemplateBuilder { this.uriTemplateHandler = null; this.errorHandler = null; this.basicAuthorization = null; - this.restTemplateCustomizers = Collections.unmodifiableSet( - new LinkedHashSet(Arrays.asList(customizers))); + this.restTemplateCustomizers = Collections + .unmodifiableSet(new LinkedHashSet<>(Arrays.asList(customizers))); this.requestFactoryCustomizers = Collections.emptySet(); this.interceptors = Collections.emptySet(); } @@ -237,8 +237,8 @@ public class RestTemplateBuilder { */ public RestTemplateBuilder defaultMessageConverters() { return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, - Collections.unmodifiableSet(new LinkedHashSet>( - new RestTemplate().getMessageConverters())), + Collections.unmodifiableSet( + new LinkedHashSet<>(new RestTemplate().getMessageConverters())), this.requestFactory, this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.restTemplateCustomizers, this.requestFactoryCustomizers, this.interceptors); @@ -274,8 +274,8 @@ public class RestTemplateBuilder { return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, this.messageConverters, this.requestFactory, this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.restTemplateCustomizers, - this.requestFactoryCustomizers, Collections.unmodifiableSet( - new LinkedHashSet(interceptors))); + this.requestFactoryCustomizers, + Collections.unmodifiableSet(new LinkedHashSet<>(interceptors))); } /** @@ -525,8 +525,7 @@ public class RestTemplateBuilder { public T configure(T restTemplate) { configureRequestFactory(restTemplate); if (!CollectionUtils.isEmpty(this.messageConverters)) { - restTemplate.setMessageConverters( - new ArrayList>(this.messageConverters)); + restTemplate.setMessageConverters(new ArrayList<>(this.messageConverters)); } if (this.uriTemplateHandler != null) { restTemplate.setUriTemplateHandler(this.uriTemplateHandler); @@ -599,14 +598,14 @@ public class RestTemplateBuilder { } private Set append(Set set, T addition) { - Set result = new LinkedHashSet( + Set result = new LinkedHashSet<>( set == null ? Collections.emptySet() : set); result.add(addition); return Collections.unmodifiableSet(result); } private Set append(Set set, Collection additions) { - Set result = new LinkedHashSet( + Set result = new LinkedHashSet<>( set == null ? Collections.emptySet() : set); result.addAll(additions); return Collections.unmodifiableSet(result); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java index 7e7b2c8ee5..ce02d8f5d1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java @@ -52,11 +52,11 @@ abstract class AbstractFilterRegistrationBean extends Registra private static final String[] DEFAULT_URL_MAPPINGS = { "/*" }; - private Set> servletRegistrationBeans = new LinkedHashSet>(); + private Set> servletRegistrationBeans = new LinkedHashSet<>(); - private Set servletNames = new LinkedHashSet(); + private Set servletNames = new LinkedHashSet<>(); - private Set urlPatterns = new LinkedHashSet(); + private Set urlPatterns = new LinkedHashSet<>(); private EnumSet dispatcherTypes; @@ -82,8 +82,7 @@ abstract class AbstractFilterRegistrationBean extends Registra Collection> servletRegistrationBeans) { Assert.notNull(servletRegistrationBeans, "ServletRegistrationBeans must not be null"); - this.servletRegistrationBeans = new LinkedHashSet>( - servletRegistrationBeans); + this.servletRegistrationBeans = new LinkedHashSet<>(servletRegistrationBeans); } /** @@ -118,7 +117,7 @@ abstract class AbstractFilterRegistrationBean extends Registra */ public void setServletNames(Collection servletNames) { Assert.notNull(servletNames, "ServletNames must not be null"); - this.servletNames = new LinkedHashSet(servletNames); + this.servletNames = new LinkedHashSet<>(servletNames); } /** @@ -148,7 +147,7 @@ abstract class AbstractFilterRegistrationBean extends Registra */ public void setUrlPatterns(Collection urlPatterns) { Assert.notNull(urlPatterns, "UrlPatterns must not be null"); - this.urlPatterns = new LinkedHashSet(urlPatterns); + this.urlPatterns = new LinkedHashSet<>(urlPatterns); } /** @@ -243,7 +242,7 @@ abstract class AbstractFilterRegistrationBean extends Registra if (dispatcherTypes == null) { dispatcherTypes = EnumSet.of(DispatcherType.REQUEST); } - Set servletNames = new LinkedHashSet(); + Set servletNames = new LinkedHashSet<>(); for (ServletRegistrationBean servletRegistrationBean : this.servletRegistrationBeans) { servletNames.add(servletRegistrationBean.getServletName()); } diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ErrorPageRegistrarBeanPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ErrorPageRegistrarBeanPostProcessor.java index f314cafe0f..3b3b96300a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ErrorPageRegistrarBeanPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ErrorPageRegistrarBeanPostProcessor.java @@ -76,7 +76,7 @@ public class ErrorPageRegistrarBeanPostProcessor private Collection getRegistrars() { if (this.registrars == null) { // Look up does not include the parent context - this.registrars = new ArrayList(this.beanFactory + this.registrars = new ArrayList<>(this.beanFactory .getBeansOfType(ErrorPageRegistrar.class, false, false).values()); Collections.sort(this.registrars, AnnotationAwareOrderComparator.INSTANCE); this.registrars = Collections.unmodifiableList(this.registrars); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/RegistrationBean.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/RegistrationBean.java index 1f2f25082b..8c9c8911ea 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/RegistrationBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/RegistrationBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -45,7 +45,7 @@ public abstract class RegistrationBean implements ServletContextInitializer, Ord private boolean enabled = true; - private Map initParameters = new LinkedHashMap(); + private Map initParameters = new LinkedHashMap<>(); /** * Set the name of this registration. If not specified the bean name will be used. @@ -98,7 +98,7 @@ public abstract class RegistrationBean implements ServletContextInitializer, Ord */ public void setInitParameters(Map initParameters) { Assert.notNull(initParameters, "InitParameters must not be null"); - this.initParameters = new LinkedHashMap(initParameters); + this.initParameters = new LinkedHashMap<>(initParameters); } /** diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java index 275defb3a8..fac24430c1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ abstract class ServletComponentHandler { protected final Map extractInitParameters( Map attributes) { - Map initParameters = new HashMap(); + Map initParameters = new HashMap<>(); for (AnnotationAttributes initParam : (AnnotationAttributes[]) attributes .get("initParams")) { String name = (String) initParam.get("name"); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java index abc4b90d07..1d3448461d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentRegisteringPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,7 +46,7 @@ class ServletComponentRegisteringPostProcessor private static final List HANDLERS; static { - List handlers = new ArrayList(); + List handlers = new ArrayList<>(); handlers.add(new WebServletHandler()); handlers.add(new WebFilterHandler()); handlers.add(new WebListenerHandler()); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java index f3c6b98ac7..dc1d887cee 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletComponentScanRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -78,7 +78,7 @@ class ServletComponentScanRegistrar implements ImportBeanDefinitionRegistrar { metadata.getAnnotationAttributes(ServletComponentScan.class.getName())); String[] basePackages = attributes.getStringArray("basePackages"); Class[] basePackageClasses = attributes.getClassArray("basePackageClasses"); - Set packagesToScan = new LinkedHashSet(); + Set packagesToScan = new LinkedHashSet<>(); packagesToScan.addAll(Arrays.asList(basePackages)); for (Class basePackageClass : basePackageClasses) { packagesToScan.add(ClassUtils.getPackageName(basePackageClass)); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java index ba9e0c6b92..450199aa36 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java @@ -68,17 +68,17 @@ public class ServletContextInitializerBeans /** * Seen bean instances or bean names. */ - private final Set seen = new HashSet(); + private final Set seen = new HashSet<>(); private final MultiValueMap, ServletContextInitializer> initializers; private List sortedList; public ServletContextInitializerBeans(ListableBeanFactory beanFactory) { - this.initializers = new LinkedMultiValueMap, ServletContextInitializer>(); + this.initializers = new LinkedMultiValueMap<>(); addServletContextInitializerBeans(beanFactory); addAdaptableBeans(beanFactory); - List sortedInitializers = new ArrayList(); + List sortedInitializers = new ArrayList<>(); for (Map.Entry> entry : this.initializers .entrySet()) { AnnotationAwareOrderComparator.sort(entry.getValue()); @@ -217,7 +217,7 @@ public class ServletContextInitializerBeans private List> getOrderedBeansOfType( ListableBeanFactory beanFactory, Class type, Set excludes) { - List> beans = new ArrayList>(); + List> beans = new ArrayList<>(); Comparator> comparator = new Comparator>() { @Override @@ -228,7 +228,7 @@ public class ServletContextInitializerBeans }; String[] names = beanFactory.getBeanNamesForType(type, true, false); - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); for (String name : names) { if (!excludes.contains(name) && !ScopedProxyUtils.isScopedTarget(name)) { T bean = beanFactory.getBean(name, type); @@ -282,8 +282,8 @@ public class ServletContextInitializerBeans if (name.equals(DISPATCHER_SERVLET_NAME)) { url = "/"; // always map the main dispatcherServlet to "/" } - ServletRegistrationBean bean = new ServletRegistrationBean( - source, url); + ServletRegistrationBean bean = new ServletRegistrationBean<>(source, + url); bean.setMultipartConfig(this.multipartConfig); return bean; } @@ -299,7 +299,7 @@ public class ServletContextInitializerBeans @Override public RegistrationBean createRegistrationBean(String name, Filter source, int totalNumberOfSourceBeans) { - return new FilterRegistrationBean(source); + return new FilterRegistrationBean<>(source); } } @@ -313,7 +313,7 @@ public class ServletContextInitializerBeans @Override public RegistrationBean createRegistrationBean(String name, EventListener source, int totalNumberOfSourceBeans) { - return new ServletListenerRegistrationBean(source); + return new ServletListenerRegistrationBean<>(source); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java index 35ef5ce576..6cef047dad 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -66,7 +66,7 @@ public class ServletListenerRegistrationBean private static final Set> SUPPORTED_TYPES; static { - Set> types = new HashSet>(); + Set> types = new HashSet<>(); types.add(ServletContextAttributeListener.class); types.add(ServletRequestListener.class); types.add(ServletRequestAttributeListener.class); diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletRegistrationBean.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletRegistrationBean.java index b908623810..65e57845f3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletRegistrationBean.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletRegistrationBean.java @@ -60,7 +60,7 @@ public class ServletRegistrationBean extends RegistrationBean private T servlet; - private Set urlMappings = new LinkedHashSet(); + private Set urlMappings = new LinkedHashSet<>(); private boolean alwaysMapUrl = true; @@ -125,7 +125,7 @@ public class ServletRegistrationBean extends RegistrationBean */ public void setUrlMappings(Collection urlMappings) { Assert.notNull(urlMappings, "UrlMappings must not be null"); - this.urlMappings = new LinkedHashSet(urlMappings); + this.urlMappings = new LinkedHashSet<>(urlMappings); } /** diff --git a/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java b/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java index 682c166f2a..717f635beb 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java @@ -77,9 +77,9 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry { private String global; - private final Map statuses = new HashMap(); + private final Map statuses = new HashMap<>(); - private final Map, String> exceptions = new HashMap, String>(); + private final Map, String> exceptions = new HashMap<>(); private final OncePerRequestFilter delegate = new OncePerRequestFilter() { diff --git a/spring-boot/src/main/java/org/springframework/boot/yaml/SpringProfileDocumentMatcher.java b/spring-boot/src/main/java/org/springframework/boot/yaml/SpringProfileDocumentMatcher.java index 5fe82aa0e3..26340bdba4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/yaml/SpringProfileDocumentMatcher.java +++ b/spring-boot/src/main/java/org/springframework/boot/yaml/SpringProfileDocumentMatcher.java @@ -60,7 +60,7 @@ public class SpringProfileDocumentMatcher implements DocumentMatcher { } public void addActiveProfiles(String... profiles) { - LinkedHashSet set = new LinkedHashSet( + LinkedHashSet set = new LinkedHashSet<>( Arrays.asList(this.activeProfiles)); Collections.addAll(set, profiles); this.activeProfiles = set.toArray(new String[set.size()]); @@ -97,14 +97,14 @@ public class SpringProfileDocumentMatcher implements DocumentMatcher { private ProfilesMatcher getProfilesMatcher() { return this.activeProfiles.length == 0 ? new EmptyProfilesMatcher() : new ActiveProfilesMatcher( - new HashSet(Arrays.asList(this.activeProfiles))); + new HashSet<>(Arrays.asList(this.activeProfiles))); } private Set extractProfiles(List profiles, ProfileType type) { if (CollectionUtils.isEmpty(profiles)) { return null; } - Set extractedProfiles = new HashSet(); + Set extractedProfiles = new HashSet<>(); for (String candidate : profiles) { ProfileType candidateType = ProfileType.POSITIVE; if (candidate.startsWith("!")) { @@ -198,7 +198,7 @@ public class SpringProfileDocumentMatcher implements DocumentMatcher { */ static class SpringProperties { - private List profiles = new ArrayList(); + private List profiles = new ArrayList<>(); public List getProfiles() { return this.profiles; diff --git a/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java b/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java index e8779d7064..79dfe1a82e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/DefaultApplicationArgumentsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -55,7 +55,7 @@ public class DefaultApplicationArgumentsTests { @Test public void optionNames() throws Exception { ApplicationArguments arguments = new DefaultApplicationArguments(ARGS); - Set expected = new HashSet(Arrays.asList("foo", "debug")); + Set expected = new HashSet<>(Arrays.asList("foo", "debug")); assertThat(arguments.getOptionNames()).isEqualTo(expected); } diff --git a/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java b/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java index 176a074a72..cb8c77b103 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -76,7 +76,7 @@ public class SimpleMainTests { } private String[] getArgs(String... args) { - List list = new ArrayList(Arrays.asList( + List list = new ArrayList<>(Arrays.asList( "--spring.main.webEnvironment=false", "--spring.main.showBanner=OFF", "--spring.main.registerShutdownHook=false")); if (args.length > 0) { diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index e87b286409..2824d64b70 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -304,7 +304,7 @@ public class SpringApplicationTests { public void specificApplicationContextInitializer() throws Exception { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); - final AtomicReference reference = new AtomicReference(); + final AtomicReference reference = new AtomicReference<>(); application.setInitializers(Arrays.asList( new ApplicationContextInitializer() { @Override @@ -322,7 +322,7 @@ public class SpringApplicationTests { public void applicationRunningEventListener() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); - final AtomicReference reference = new AtomicReference(); + final AtomicReference reference = new AtomicReference<>(); class ApplicationReadyEventListener implements ApplicationListener { @@ -341,7 +341,7 @@ public class SpringApplicationTests { public void contextRefreshedEventListener() throws Exception { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); - final AtomicReference reference = new AtomicReference(); + final AtomicReference reference = new AtomicReference<>(); class InitializerListener implements ApplicationListener { @Override @@ -362,7 +362,7 @@ public class SpringApplicationTests { public void eventsOrder() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); - final List events = new ArrayList(); + final List events = new ArrayList<>(); class ApplicationRunningEventListener implements ApplicationListener { @@ -749,7 +749,7 @@ public class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleConfig.class, ListenerConfig.class); application.setApplicationContextClass(SpyApplicationContext.class); - final LinkedHashSet events = new LinkedHashSet(); + final LinkedHashSet events = new LinkedHashSet<>(); application.addListeners(new ApplicationListener() { @Override @@ -769,7 +769,7 @@ public class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleConfig.class, ListenerConfig.class, Multicaster.class); application.setApplicationContextClass(SpyApplicationContext.class); - final LinkedHashSet events = new LinkedHashSet(); + final LinkedHashSet events = new LinkedHashSet<>(); application.addListeners(new ApplicationListener() { @Override @@ -1238,7 +1238,7 @@ public class SpringApplicationTests { private static class MockResourceLoader implements ResourceLoader { - private final Map resources = new HashMap(); + private final Map resources = new HashMap<>(); public void addResource(String source, String path) { this.resources.put(source, new ClassPathResource(path, getClass())); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/BindingPreparationTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/BindingPreparationTests.java index a0bb1810fa..0c7640fbf0 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/BindingPreparationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/BindingPreparationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -186,7 +186,7 @@ public class BindingPreparationTests { // what the user is trying to bind it to, e.g. if nested[foo][bar] then it's a map wrapper.setPropertyValue("nested[foo]", new LinkedHashMap()); // But it might equally well be a collection, if nested[foo][0] - wrapper.setPropertyValue("nested[foo]", new ArrayList()); + wrapper.setPropertyValue("nested[foo]", new ArrayList<>()); // Then it would have to be actually bound to get the list to auto-grow wrapper.setPropertyValue("nested[foo][0]", "bar"); assertThat(wrapper.getPropertyValue("nested[foo][0]")).isNotNull(); @@ -222,7 +222,7 @@ public class BindingPreparationTests { @Ignore("Work in progress") public void testExpressionLists() throws Exception { TargetWithNestedMapOfListOfString target = new TargetWithNestedMapOfListOfString(); - LinkedHashMap> map = new LinkedHashMap>(); + LinkedHashMap> map = new LinkedHashMap<>(); // map.put("foo", Arrays.asList("bar")); target.setNested(map); SpelExpressionParser parser = new SpelExpressionParser(); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java index aa547f3099..03e661ba8f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryMapTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -108,7 +108,7 @@ public class PropertiesConfigurationFactoryMapTests { } private void setupFactory() throws IOException { - this.factory = new PropertiesConfigurationFactory(Foo.class); + this.factory = new PropertiesConfigurationFactory<>(Foo.class); this.factory.setValidator(this.validator); this.factory.setTargetName(this.targetName); this.factory.setIgnoreUnknownFields(this.ignoreUnknownFields); @@ -118,7 +118,7 @@ public class PropertiesConfigurationFactoryMapTests { // Foo needs to be public and to have setters for all properties public static class Foo { - private Map map = new HashMap(); + private Map map = new HashMap<>(); public Map getMap() { return this.map; diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryParameterizedTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryParameterizedTests.java index 056abf5e9c..6f6645918d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryParameterizedTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryParameterizedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -45,7 +45,7 @@ public class PropertiesConfigurationFactoryParameterizedTests { private String targetName; - private PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory( + private PropertiesConfigurationFactory factory = new PropertiesConfigurationFactory<>( Foo.class); @Parameters diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryPerformanceTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryPerformanceTests.java index f8e8a7ea6c..73dfb1b76b 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryPerformanceTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryPerformanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -75,7 +75,7 @@ public class PropertiesConfigurationFactoryPerformanceTests { } private void setupFactory() throws IOException { - this.factory = new PropertiesConfigurationFactory(Foo.class); + this.factory = new PropertiesConfigurationFactory<>(Foo.class); this.factory.setValidator(this.validator); this.factory.setTargetName(this.targetName); this.factory.setIgnoreUnknownFields(this.ignoreUnknownFields); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java index 8a4e36e7ac..06a0136a35 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertiesConfigurationFactoryTests.java @@ -215,7 +215,7 @@ public class PropertiesConfigurationFactoryTests { } private void setupFactory() throws IOException { - this.factory = new PropertiesConfigurationFactory(Foo.class); + this.factory = new PropertiesConfigurationFactory<>(Foo.class); this.factory.setValidator(this.validator); this.factory.setTargetName(this.targetName); this.factory.setIgnoreUnknownFields(this.ignoreUnknownFields); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java index 5a94321c05..536111c3d5 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -81,7 +81,7 @@ public class PropertySourcesPropertyValuesTests { @Test public void testOrderPreserved() { - LinkedHashMap map = new LinkedHashMap(); + LinkedHashMap map = new LinkedHashMap<>(); map.put("one", 1); map.put("two", 2); map.put("three", 3); @@ -92,7 +92,7 @@ public class PropertySourcesPropertyValuesTests { this.propertySources); PropertyValue[] values = propertyValues.getPropertyValues(); assertThat(values).hasSize(6); - Collection names = new ArrayList(); + Collection names = new ArrayList<>(); for (PropertyValue value : values) { names.add(value.getName()); } @@ -200,7 +200,7 @@ public class PropertySourcesPropertyValuesTests { public void testCollectionProperty() throws Exception { ListBean target = new ListBean(); DataBinder binder = new DataBinder(target); - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); map.put("list[0]", "v0"); map.put("list[1]", "v1"); this.propertySources.addFirst(new MapPropertySource("values", map)); @@ -212,9 +212,9 @@ public class PropertySourcesPropertyValuesTests { public void testFirstCollectionPropertyWins() throws Exception { ListBean target = new ListBean(); DataBinder binder = new DataBinder(target); - Map first = new LinkedHashMap(); + Map first = new LinkedHashMap<>(); first.put("list[0]", "f0"); - Map second = new LinkedHashMap(); + Map second = new LinkedHashMap<>(); second.put("list[0]", "s0"); second.put("list[1]", "s1"); this.propertySources.addFirst(new MapPropertySource("s", second)); @@ -227,9 +227,9 @@ public class PropertySourcesPropertyValuesTests { public void testFirstCollectionPropertyWinsNestedAttributes() throws Exception { ListTestBean target = new ListTestBean(); DataBinder binder = new DataBinder(target); - Map first = new LinkedHashMap(); + Map first = new LinkedHashMap<>(); first.put("list[0].description", "another description"); - Map second = new LinkedHashMap(); + Map second = new LinkedHashMap<>(); second.put("list[0].name", "first name"); second.put("list[0].description", "first description"); second.put("list[1].name", "second name"); @@ -283,7 +283,7 @@ public class PropertySourcesPropertyValuesTests { public static class ListBean { - private List list = new ArrayList(); + private List list = new ArrayList<>(); public List getList() { return this.list; @@ -297,7 +297,7 @@ public class PropertySourcesPropertyValuesTests { public static class ListTestBean { - private List list = new ArrayList(); + private List list = new ArrayList<>(); public List getList() { return this.list; diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java index 3c3665891d..c2a9285b51 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedDataBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -520,7 +520,7 @@ public class RelaxedDataBinderTests { @Test public void testBindMap() throws Exception { - Map target = new LinkedHashMap(); + Map target = new LinkedHashMap<>(); BindingResult result = bind(target, "spam: bar\n" + "vanilla.value: 123", "vanilla"); assertThat(result.getErrorCount()).isEqualTo(0); @@ -529,7 +529,7 @@ public class RelaxedDataBinderTests { @Test public void testBindMapWithClashInProperties() throws Exception { - Map target = new LinkedHashMap(); + Map target = new LinkedHashMap<>(); BindingResult result = bind(target, "vanilla.spam: bar\n" + "vanilla.spam.value: 123", "vanilla"); assertThat(result.getErrorCount()).isEqualTo(0); @@ -540,7 +540,7 @@ public class RelaxedDataBinderTests { @Test public void testBindMapWithDeepClashInProperties() throws Exception { - Map target = new LinkedHashMap(); + Map target = new LinkedHashMap<>(); BindingResult result = bind(target, "vanilla.spam.foo: bar\n" + "vanilla.spam.foo.value: 123", "vanilla"); assertThat(result.getErrorCount()).isEqualTo(0); @@ -551,7 +551,7 @@ public class RelaxedDataBinderTests { @Test public void testBindMapWithDifferentDeepClashInProperties() throws Exception { - Map target = new LinkedHashMap(); + Map target = new LinkedHashMap<>(); BindingResult result = bind(target, "vanilla.spam.bar: bar\n" + "vanilla.spam.bar.value: 123", "vanilla"); assertThat(result.getErrorCount()).isEqualTo(0); @@ -562,7 +562,7 @@ public class RelaxedDataBinderTests { @Test public void testBindShallowMap() throws Exception { - Map target = new LinkedHashMap(); + Map target = new LinkedHashMap<>(); BindingResult result = bind(target, "vanilla.spam: bar\n" + "vanilla.value: 123", "vanilla"); assertThat(result.getErrorCount()).isEqualTo(0); @@ -571,7 +571,7 @@ public class RelaxedDataBinderTests { @Test public void testBindMapNestedMap() throws Exception { - Map target = new LinkedHashMap(); + Map target = new LinkedHashMap<>(); BindingResult result = bind(target, "spam: bar\n" + "vanilla.foo.value: 123", "vanilla"); assertThat(result.getErrorCount()).isEqualTo(0); @@ -583,7 +583,7 @@ public class RelaxedDataBinderTests { @SuppressWarnings("unchecked") @Test public void testBindOverlappingNestedMaps() throws Exception { - Map target = new LinkedHashMap(); + Map target = new LinkedHashMap<>(); BindingResult result = bind(target, "a.b.c.d: abc\na.b.c1.d1: efg"); assertThat(result.getErrorCount()).isEqualTo(0); @@ -941,7 +941,7 @@ public class RelaxedDataBinderTests { public static class TargetWithReadOnlyNestedList { - private final List nested = new ArrayList(); + private final List nested = new ArrayList<>(); public List getNested() { return this.nested; @@ -961,7 +961,7 @@ public class RelaxedDataBinderTests { public static class TargetWithReadOnlyNestedCollection { - private final Collection nested = new ArrayList(); + private final Collection nested = new ArrayList<>(); public Collection getNested() { return this.nested; @@ -971,7 +971,7 @@ public class RelaxedDataBinderTests { public static class TargetWithNestedSet { - private Set nested = new LinkedHashSet(); + private Set nested = new LinkedHashSet<>(); public Set getNested() { return this.nested; diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java index 353a5f54a1..a73d0c8829 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/RelaxedPropertyResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ public class RelaxedPropertyResolverTests { @Before public void setup() { this.environment = new StandardEnvironment(); - this.source = new LinkedHashMap(); + this.source = new LinkedHashMap<>(); this.source.put("myString", "value"); this.source.put("myobject", "object"); this.source.put("myInteger", 123); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/SpringApplicationBindContextLoader.java b/spring-boot/src/test/java/org/springframework/boot/bind/SpringApplicationBindContextLoader.java index 4667e6234d..ad44ba61ec 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/SpringApplicationBindContextLoader.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/SpringApplicationBindContextLoader.java @@ -50,7 +50,7 @@ class SpringApplicationBindContextLoader extends AbstractContextLoader { application.setSources( new LinkedHashSet(Arrays.asList(config.getClasses()))); ConfigurableEnvironment environment = new StandardEnvironment(); - Map properties = new LinkedHashMap(); + Map properties = new LinkedHashMap<>(); properties.put("spring.jmx.enabled", "false"); properties.putAll(TestPropertySourceUtils .convertInlinedPropertiesToMap(config.getPropertySourceProperties())); diff --git a/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java index 34fee841e6..eb4270acc7 100644 --- a/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/bind/YamlConfigurationFactoryTests.java @@ -42,11 +42,10 @@ public class YamlConfigurationFactoryTests { private Validator validator; - private final Map, Map> aliases = new HashMap, Map>(); + private final Map, Map> aliases = new HashMap<>(); private Foo createFoo(final String yaml) throws Exception { - YamlConfigurationFactory factory = new YamlConfigurationFactory( - Foo.class); + YamlConfigurationFactory factory = new YamlConfigurationFactory<>(Foo.class); factory.setYaml(yaml); factory.setPropertyAliases(this.aliases); factory.setValidator(this.validator); @@ -56,8 +55,7 @@ public class YamlConfigurationFactoryTests { } private Jee createJee(final String yaml) throws Exception { - YamlConfigurationFactory factory = new YamlConfigurationFactory( - Jee.class); + YamlConfigurationFactory factory = new YamlConfigurationFactory<>(Jee.class); factory.setYaml(yaml); factory.setPropertyAliases(this.aliases); factory.setValidator(this.validator); diff --git a/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java b/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java index caa492d30f..37f52fe72d 100644 --- a/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java @@ -284,7 +284,8 @@ public class SpringApplicationBuilderTests { @Test public void initializersCreatedOnceForChild() throws Exception { SpringApplicationBuilder application = new SpringApplicationBuilder( - ExampleConfig.class).child(ChildConfig.class).web(WebApplicationType.NONE); + ExampleConfig.class).child(ChildConfig.class) + .web(WebApplicationType.NONE); this.context = application.run(); assertThat(application.application().getInitializers()).hasSize(5); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java index ef7bb22e58..5d6e337444 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -149,7 +149,7 @@ public class ConfigurationWarningsApplicationContextInitializerTests { protected Set getComponentScanningPackages( BeanDefinitionRegistry registry) { Set scannedPackages = super.getComponentScanningPackages(registry); - Set result = new LinkedHashSet(); + Set result = new LinkedHashSet<>(); for (String scannedPackage : scannedPackages) { if (scannedPackage.endsWith("dflt")) { result.add(""); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java index 086f8cb7cf..a544a8035c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java @@ -62,7 +62,7 @@ public class AnsiOutputApplicationListenerTests { public void enabled() { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); - Map props = new HashMap(); + Map props = new HashMap<>(); props.put("spring.output.ansi.enabled", "ALWAYS"); application.setDefaultProperties(props); this.context = application.run(); @@ -73,7 +73,7 @@ public class AnsiOutputApplicationListenerTests { public void disabled() throws Exception { SpringApplication application = new SpringApplication(Config.class); application.setWebApplicationType(WebApplicationType.NONE); - Map props = new HashMap(); + Map props = new HashMap<>(); props.put("spring.output.ansi.enabled", "never"); application.setDefaultProperties(props); this.context = application.run(); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java index a13e833b77..36e447b9ed 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java @@ -508,7 +508,7 @@ public class ConfigFileApplicationListenerTests { Collection> sources = propertySource .getSource(); assertThat(sources).hasSize(2); - List names = new ArrayList(); + List names = new ArrayList<>(); for (org.springframework.core.env.PropertySource source : sources) { if (source instanceof EnumerableCompositePropertySource) { for (org.springframework.core.env.PropertySource nested : ((EnumerableCompositePropertySource) source) @@ -818,7 +818,7 @@ public class ConfigFileApplicationListenerTests { @Test public void activeProfilesCanBeConfiguredUsingPlaceholdersResolvedAgainstTheEnvironment() throws Exception { - Map source = new HashMap(); + Map source = new HashMap<>(); source.put("activeProfile", "testPropertySource"); org.springframework.core.env.PropertySource propertySource = new MapPropertySource( "test", source); @@ -911,7 +911,7 @@ public class ConfigFileApplicationListenerTests { @Override List loadPostProcessors() { - return new ArrayList( + return new ArrayList<>( Arrays.asList(new LowestPrecedenceEnvironmentPostProcessor())); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java index 8ab2157bb3..0405e8031b 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java @@ -236,7 +236,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { public void startServletAndFilter() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); this.container = factory.getEmbeddedServletContainer(exampleServletRegistration(), - new FilterRegistrationBean(new ExampleFilter())); + new FilterRegistrationBean<>(new ExampleFilter())); this.container.start(); assertThat(getResponse(getLocalUrl("/hello"))).isEqualTo("[Hello World]"); } @@ -409,9 +409,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { Ssl ssl = getSsl(null, "password", "classpath:test.jks"); ssl.setEnabled(false); factory.setSsl(ssl); - this.container = factory - .getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(true, false), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( new SSLContextBuilder() @@ -428,9 +427,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { public void sslGetScheme() throws Exception { // gh-2232 AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks")); - this.container = factory - .getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(true, false), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( new SSLContextBuilder() @@ -447,9 +445,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { public void serverHeaderIsDisabledByDefaultWhenUsingSsl() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks")); - this.container = factory - .getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(true, false), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( new SSLContextBuilder() @@ -466,9 +463,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.setServerHeader("MyServer"); factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks")); - this.container = factory - .getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(true, false), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( new SSLContextBuilder() @@ -689,9 +685,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks", null, protocols, ciphers)); - this.container = factory - .getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(true, false), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); this.container.start(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( @@ -811,9 +806,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { Compression compression = new Compression(); compression.setEnabled(true); factory.setCompression(compression); - this.container = factory - .getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(false, true), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean<>(new ExampleServlet(false, true), "/hello")); this.container.start(); TestGzipInputStreamFactory inputStreamFactory = new TestGzipInputStreamFactory(); Map contentDecoderMap = Collections @@ -845,7 +839,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { @Test public void rootServletContextResource() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); - final AtomicReference rootResource = new AtomicReference(); + final AtomicReference rootResource = new AtomicReference<>(); this.container = factory .getEmbeddedServletContainer(new ServletContextInitializer() { @Override @@ -934,7 +928,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { @Test public void localeCharsetMappingsAreConfigured() throws Exception { AbstractEmbeddedServletContainerFactory factory = getFactory(); - Map mappings = new HashMap(); + Map mappings = new HashMap<>(); mappings.put(Locale.GERMAN, Charset.forName("UTF-8")); factory.setLocaleCharsetMappings(mappings); this.container = factory.getEmbeddedServletContainer(); @@ -944,7 +938,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { @Test public void jspServletInitParameters() throws Exception { - Map initParameters = new HashMap(); + Map initParameters = new HashMap<>(); initParameters.put("a", "alpha"); AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.getJsp().setInitParameters(initParameters); @@ -1123,9 +1117,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { protected void assertForwardHeaderIsUsed(EmbeddedServletContainerFactory factory) throws IOException, URISyntaxException { - this.container = factory - .getEmbeddedServletContainer(new ServletRegistrationBean( - new ExampleServlet(true, false), "/hello")); + this.container = factory.getEmbeddedServletContainer( + new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); this.container.start(); assertThat(getResponse(getLocalUrl("/hello"), "X-Forwarded-For:140.211.11.130")) .contains("remoteaddr=140.211.11.130"); @@ -1137,13 +1130,12 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { throws Exception; protected ServletContextInitializer exampleServletRegistration() { - return new ServletRegistrationBean(new ExampleServlet(), - "/hello"); + return new ServletRegistrationBean<>(new ExampleServlet(), "/hello"); } @SuppressWarnings("serial") private ServletContextInitializer errorServletRegistration() { - ServletRegistrationBean bean = new ServletRegistrationBean( + ServletRegistrationBean bean = new ServletRegistrationBean<>( new ExampleServlet() { @Override @@ -1158,7 +1150,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { } protected final ServletContextInitializer sessionServletRegistration() { - ServletRegistrationBean bean = new ServletRegistrationBean( + ServletRegistrationBean bean = new ServletRegistrationBean<>( new ExampleServlet() { @Override diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java index a2f71c8161..4c53f0c2ed 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java @@ -191,7 +191,7 @@ public class EmbeddedServletContainerMvcIntegrationTests { @Bean public ServletRegistrationBean dispatcherRegistration() { - ServletRegistrationBean registration = new ServletRegistrationBean( + ServletRegistrationBean registration = new ServletRegistrationBean<>( dispatcherServlet()); registration.addUrlMappings("/spring/*"); return registration; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java index 522b1c278c..e3cb540451 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java @@ -228,7 +228,7 @@ public class EmbeddedWebApplicationContextTests { addEmbeddedServletContainerFactoryBean(); OrderedFilter filter = new OrderedFilter(); this.context.registerBeanDefinition("filterBean", beanDefinition(filter)); - FilterRegistrationBean registration = new FilterRegistrationBean(); + FilterRegistrationBean registration = new FilterRegistrationBean<>(); registration.setFilter(mock(Filter.class)); registration.setOrder(100); this.context.registerBeanDefinition("filterRegistrationBean", @@ -387,7 +387,7 @@ public class EmbeddedWebApplicationContextTests { addEmbeddedServletContainerFactoryBean(); Servlet servlet = mock(Servlet.class); Filter filter = mock(Filter.class); - ServletRegistrationBean initializer = new ServletRegistrationBean( + ServletRegistrationBean initializer = new ServletRegistrationBean<>( servlet, "/foo"); this.context.registerBeanDefinition("initializerBean", beanDefinition(initializer)); @@ -404,8 +404,7 @@ public class EmbeddedWebApplicationContextTests { public void filterRegistrationBeansSkipsRegisteredFilters() throws Exception { addEmbeddedServletContainerFactoryBean(); Filter filter = mock(Filter.class); - FilterRegistrationBean initializer = new FilterRegistrationBean( - filter); + FilterRegistrationBean initializer = new FilterRegistrationBean<>(filter); this.context.registerBeanDefinition("initializerBean", beanDefinition(initializer)); this.context.registerBeanDefinition("filterBean", beanDefinition(filter)); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MimeMappingsTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MimeMappingsTests.java index 65bbe3db0b..295cdf8bdd 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MimeMappingsTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MimeMappingsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,7 +54,7 @@ public class MimeMappingsTests { @Test public void createFromMap() throws Exception { - Map mappings = new HashMap(); + Map mappings = new HashMap<>(); mappings.put("foo", "bar"); MimeMappings clone = new MimeMappings(mappings); mappings.put("baz", "bar"); @@ -67,7 +67,7 @@ public class MimeMappingsTests { MimeMappings mappings = new MimeMappings(); mappings.add("foo", "bar"); mappings.add("baz", "boo"); - List mappingList = new ArrayList(); + List mappingList = new ArrayList<>(); for (MimeMappings.Mapping mapping : mappings) { mappingList.add(mapping); } @@ -82,7 +82,7 @@ public class MimeMappingsTests { MimeMappings mappings = new MimeMappings(); mappings.add("foo", "bar"); mappings.add("baz", "boo"); - List mappingList = new ArrayList(); + List mappingList = new ArrayList<>(); mappingList.addAll(mappings.getAll()); assertThat(mappingList.get(0).getExtension()).isEqualTo("foo"); assertThat(mappingList.get(0).getMimeType()).isEqualTo("bar"); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java index af3c28095c..064893f4c7 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java @@ -86,9 +86,9 @@ public class MockEmbeddedServletContainerFactory private final ServletContextInitializer[] initializers; - private final List registeredServlets = new ArrayList(); + private final List registeredServlets = new ArrayList<>(); - private final List registeredFilters = new ArrayList(); + private final List registeredFilters = new ArrayList<>(); private final int port; @@ -126,7 +126,7 @@ public class MockEmbeddedServletContainerFactory return registeredFilter.getRegistration(); } }); - final Map initParameters = new HashMap(); + final Map initParameters = new HashMap<>(); given(this.servletContext.setInitParameter(anyString(), anyString())) .will(new Answer() { @Override @@ -199,7 +199,7 @@ public class MockEmbeddedServletContainerFactory private static class EmptyEnumeration implements Enumeration { - static final EmptyEnumeration EMPTY_ENUMERATION = new EmptyEnumeration(); + static final EmptyEnumeration EMPTY_ENUMERATION = new EmptyEnumeration<>(); @Override public boolean hasMoreElements() { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistenceTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistenceTests.java index e0c470e01e..482c1706e4 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistenceTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistenceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -63,8 +63,8 @@ public class FileSessionPersistenceTests { @Test public void persistAndLoad() throws Exception { - Map sessionData = new LinkedHashMap(); - Map data = new LinkedHashMap(); + Map sessionData = new LinkedHashMap<>(); + Map data = new LinkedHashMap<>(); data.put("spring", "boot"); PersistentSession session = new PersistentSession(this.expiration, data); sessionData.put("abc", session); @@ -79,8 +79,8 @@ public class FileSessionPersistenceTests { @Test public void dontRestoreExpired() throws Exception { Date expired = new Date(System.currentTimeMillis() - 1000); - Map sessionData = new LinkedHashMap(); - Map data = new LinkedHashMap(); + Map sessionData = new LinkedHashMap<>(); + Map data = new LinkedHashMap<>(); data.put("spring", "boot"); PersistentSession session = new PersistentSession(expired, data); sessionData.put("abc", session); @@ -94,7 +94,7 @@ public class FileSessionPersistenceTests { @Test public void deleteFileOnClear() throws Exception { File sessionFile = new File(this.dir, "test.session"); - Map sessionData = new LinkedHashMap(); + Map sessionData = new LinkedHashMap<>(); this.persistence.persistSessions("test", sessionData); assertThat(sessionFile.exists()).isTrue(); this.persistence.clear("test"); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java index a3c9a98875..bd4891fed8 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactoryTests.java @@ -73,8 +73,7 @@ public class UndertowEmbeddedServletContainerFactoryTests AbstractEmbeddedServletContainerFactory factory = getFactory(); factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/hello")); this.container = factory.getEmbeddedServletContainer( - new ServletRegistrationBean(new ExampleServlet(), - "/hello")); + new ServletRegistrationBean<>(new ExampleServlet(), "/hello")); this.container.start(); assertThat(getResponse(getLocalUrl("/hello"))).isEqualTo("Hello World"); assertThat(getResponse(getLocalUrl("/not-found"))).isEqualTo("Hello World"); @@ -153,7 +152,7 @@ public class UndertowEmbeddedServletContainerFactoryTests @Test public void defaultContextPath() throws Exception { UndertowEmbeddedServletContainerFactory factory = getFactory(); - final AtomicReference contextPath = new AtomicReference(); + final AtomicReference contextPath = new AtomicReference<>(); factory.addDeploymentInfoCustomizers(new UndertowDeploymentInfoCustomizer() { @Override @@ -200,8 +199,7 @@ public class UndertowEmbeddedServletContainerFactoryTests factory.setAccessLogDirectory(accessLogDirectory); assertThat(accessLogDirectory.listFiles()).isEmpty(); this.container = factory.getEmbeddedServletContainer( - new ServletRegistrationBean(new ExampleServlet(), - "/hello")); + new ServletRegistrationBean<>(new ExampleServlet(), "/hello")); this.container.start(); assertThat(getResponse(getLocalUrl("/hello"))).isEqualTo("Hello World"); File accessLog = new File(accessLogDirectory, expectedFile); @@ -281,8 +279,7 @@ public class UndertowEmbeddedServletContainerFactoryTests protected Collection getExpectedMimeMappings() { // Unlike Tomcat and Jetty, Undertow performs a case-sensitive match on file // extension so it has a mapping for "z" and "Z". - Set expectedMappings = new HashSet( - super.getExpectedMimeMappings()); + Set expectedMappings = new HashSet<>(super.getExpectedMimeMappings()); expectedMappings.add(new Mapping("Z", "application/x-compress")); return expectedMappings; } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java index 956512fa88..3f3b16befc 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesTests.java @@ -228,7 +228,7 @@ public class EnableConfigurationPropertiesTests { @Test public void testCollectionPropertiesBindingWithOver256Elements() { this.context.register(TestConfiguration.class); - List pairs = new ArrayList(); + List pairs = new ArrayList<>(); pairs.add("name:foo"); for (int i = 0; i < 1000; i++) { pairs.add("list[" + i + "]:" + i); @@ -290,11 +290,9 @@ public class EnableConfigurationPropertiesTests { @Test public void testBindingWithParentContext() { - AnnotationConfigApplicationContext parent = - new AnnotationConfigApplicationContext(); + AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext(); parent.register(TestConfiguration.class); - TestPropertySourceUtils.addInlinedPropertiesToEnvironment(parent, - "name=parent"); + TestPropertySourceUtils.addInlinedPropertiesToEnvironment(parent, "name=parent"); parent.refresh(); this.context.setParent(parent); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, @@ -303,8 +301,7 @@ public class EnableConfigurationPropertiesTests { this.context.refresh(); assertThat(this.context.getBeanNamesForType(TestProperties.class).length) .isEqualTo(0); - assertThat(parent.getBeanNamesForType(TestProperties.class).length) - .isEqualTo(1); + assertThat(parent.getBeanNamesForType(TestProperties.class).length).isEqualTo(1); assertThat(this.context.getBean(TestConsumer.class).getName()) .isEqualTo("parent"); parent.close(); @@ -626,7 +623,7 @@ public class EnableConfigurationPropertiesTests { private int[] array; - private final List list = new ArrayList(); + private final List list = new ArrayList<>(); // No getter - you should be able to bind to a write-only bean diff --git a/spring-boot/src/test/java/org/springframework/boot/diagnostics/FailureAnalyzersIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/diagnostics/FailureAnalyzersIntegrationTests.java index fcda319c33..7da7e32b35 100644 --- a/spring-boot/src/test/java/org/springframework/boot/diagnostics/FailureAnalyzersIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/diagnostics/FailureAnalyzersIntegrationTests.java @@ -43,8 +43,8 @@ public class FailureAnalyzersIntegrationTests { @Test public void analysisIsPerformed() { try { - new SpringApplicationBuilder(TestConfiguration.class).web(WebApplicationType.NONE) - .run(); + new SpringApplicationBuilder(TestConfiguration.class) + .web(WebApplicationType.NONE).run(); fail("Application started successfully"); } catch (Exception ex) { diff --git a/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java b/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java index 0067c03d39..4b7fca5564 100644 --- a/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -121,7 +121,7 @@ public class BeanCurrentlyInCreationFailureAnalyzerTests { BufferedReader lineReader = new BufferedReader( new StringReader(analysis.getDescription())); try { - List lines = new ArrayList(); + List lines = new ArrayList<>(); String line; while ((line = lineReader.readLine()) != null) { lines.add(line); diff --git a/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java b/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java index 5804df513e..fa824a1770 100644 --- a/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -50,7 +50,7 @@ public class YamlPropertySourceLoaderTests { @Test public void orderedItems() throws Exception { StringBuilder yaml = new StringBuilder(); - List expected = new ArrayList(); + List expected = new ArrayList<>(); for (char c = 'a'; c <= 'z'; c++) { yaml.append(c + ": value" + c + "\n"); expected.add(String.valueOf(c)); diff --git a/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java b/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java index 1b6bf6e4cc..d7f0048cde 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -48,7 +48,7 @@ public class JsonObjectDeserializerTests { @Rule public ExpectedException thrown = ExpectedException.none(); - private TestJsonObjectDeserializer testDeserializer = new TestJsonObjectDeserializer(); + private TestJsonObjectDeserializer testDeserializer = new TestJsonObjectDeserializer<>(); @Test public void deserializeObjectShouldReadJson() throws Exception { diff --git a/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java b/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java index e4bcfa109c..e9b0480655 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 @@ public class DatabaseDriverClassNameTests { @Parameters(name = "{0} {2}") public static List parameters() { DatabaseDriver[] databaseDrivers = DatabaseDriver.values(); - List parameters = new ArrayList(); + List parameters = new ArrayList<>(); for (DatabaseDriver databaseDriver : databaseDrivers) { if (excludedDrivers.contains(databaseDriver)) { continue; @@ -83,7 +83,7 @@ public class DatabaseDriverClassNameTests { // Use ASM to avoid unwanted side-effects of loading JDBC drivers ClassReader classReader = new ClassReader( getClass().getResourceAsStream("/" + className + ".class")); - List interfaceNames = new ArrayList(); + List interfaceNames = new ArrayList<>(); for (String name : classReader.getInterfaces()) { interfaceNames.add(name); interfaceNames.addAll(getInterfaceNames(name)); diff --git a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java index 9b1c8fbf3e..e7413d92f1 100644 --- a/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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,9 +59,9 @@ public class AtomikosDependsOnBeanFactoryPostProcessorTests { assertThat(expected).as("No dependsOn expected for " + bean).isEmpty(); return; } - HashSet dependsOn = new HashSet( + HashSet dependsOn = new HashSet<>( Arrays.asList(definition.getDependsOn())); - assertThat(dependsOn).isEqualTo(new HashSet(Arrays.asList(expected))); + assertThat(dependsOn).isEqualTo(new HashSet<>(Arrays.asList(expected))); } @Configuration diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java index e661c77e2c..8d59dc3be7 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -78,7 +78,7 @@ public class LogFileTests { } private PropertyResolver getPropertyResolver(String file, String path) { - Map properties = new LinkedHashMap(); + Map properties = new LinkedHashMap<>(); properties.put("logging.file", file); properties.put("logging.path", path); PropertySource propertySource = new MapPropertySource("properties", diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java index 5f3e7baf66..2938ce72fe 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java @@ -284,7 +284,7 @@ public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { private static class TestLog4J2LoggingSystem extends Log4J2LoggingSystem { - private List availableClasses = new ArrayList(); + private List availableClasses = new ArrayList<>(); TestLog4J2LoggingSystem() { super(TestLog4J2LoggingSystem.class.getClassLoader()); diff --git a/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java b/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java index 441e3eed84..a06c1a7089 100644 --- a/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java @@ -129,7 +129,7 @@ public class EmbeddedServerPortFileWriterTests { } private Set collectFileNames(File directory) { - Set names = new HashSet(); + Set names = new HashSet<>(); if (directory.isDirectory()) { for (File file : directory.listFiles()) { names.add(file.getName()); diff --git a/spring-boot/src/test/java/org/springframework/boot/testutil/InternalOutputCapture.java b/spring-boot/src/test/java/org/springframework/boot/testutil/InternalOutputCapture.java index 608a4079d2..34158b3a16 100644 --- a/spring-boot/src/test/java/org/springframework/boot/testutil/InternalOutputCapture.java +++ b/spring-boot/src/test/java/org/springframework/boot/testutil/InternalOutputCapture.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -48,7 +48,7 @@ public class InternalOutputCapture implements TestRule { private ByteArrayOutputStream copy; - private List> matchers = new ArrayList>(); + private List> matchers = new ArrayList<>(); @Override public Statement apply(final Statement base, Description description) { diff --git a/spring-boot/src/test/java/org/springframework/boot/testutil/Matched.java b/spring-boot/src/test/java/org/springframework/boot/testutil/Matched.java index 85652869b0..2bf302739e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/testutil/Matched.java +++ b/spring-boot/src/test/java/org/springframework/boot/testutil/Matched.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -54,7 +54,7 @@ public final class Matched extends Condition { } public static Condition by(Matcher matcher) { - return new Matched(matcher); + return new Matched<>(matcher); } } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java b/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java index 97eede3323..2b73ebaa01 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java @@ -80,7 +80,7 @@ public class RootUriTemplateHandlerTests { @Test public void expandMapVariablesShouldPrefixRoot() throws Exception { - HashMap uriVariables = new HashMap(); + HashMap uriVariables = new HashMap<>(); URI expanded = this.handler.expand("/hello", uriVariables); verify(this.delegate).expand("http://example.com/hello", uriVariables); assertThat(expanded).isEqualTo(this.uri); @@ -89,7 +89,7 @@ public class RootUriTemplateHandlerTests { @Test public void expandMapVariablesWhenPathDoesNotStartWithSlashShouldNotPrefixRoot() throws Exception { - HashMap uriVariables = new HashMap(); + HashMap uriVariables = new HashMap<>(); URI expanded = this.handler.expand("http://spring.io/hello", uriVariables); verify(this.delegate).expand("http://spring.io/hello", uriVariables); assertThat(expanded).isEqualTo(this.uri); diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java index 23ee2a0fea..1539d6a419 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java @@ -83,9 +83,9 @@ public abstract class AbstractFilterRegistrationBeanTests { bean.setAsyncSupported(false); bean.setInitParameters(Collections.singletonMap("a", "b")); bean.addInitParameter("c", "d"); - bean.setUrlPatterns(new LinkedHashSet(Arrays.asList("/a", "/b"))); + bean.setUrlPatterns(new LinkedHashSet<>(Arrays.asList("/a", "/b"))); bean.addUrlPatterns("/c"); - bean.setServletNames(new LinkedHashSet(Arrays.asList("s1", "s2"))); + bean.setServletNames(new LinkedHashSet<>(Arrays.asList("s1", "s2"))); bean.addServletNames("s3"); bean.setServletRegistrationBeans( Collections.singleton(mockServletRegistration("s4"))); @@ -94,7 +94,7 @@ public abstract class AbstractFilterRegistrationBeanTests { bean.onStartup(this.servletContext); verify(this.servletContext).addFilter(eq("test"), getExpectedFilter()); verify(this.registration).setAsyncSupported(false); - Map expectedInitParameters = new HashMap(); + Map expectedInitParameters = new HashMap<>(); expectedInitParameters.put("a", "b"); expectedInitParameters.put("c", "d"); verify(this.registration).setInitParameters(expectedInitParameters); @@ -221,7 +221,7 @@ public abstract class AbstractFilterRegistrationBeanTests { ServletRegistrationBean... servletRegistrationBeans); protected final ServletRegistrationBean mockServletRegistration(String name) { - ServletRegistrationBean bean = new ServletRegistrationBean(); + ServletRegistrationBean bean = new ServletRegistrationBean<>(); bean.setName(name); return bean; } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java index 10881d1e8e..5b8bc310d3 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/DelegatingFilterProxyRegistrationBeanTests.java @@ -48,7 +48,7 @@ import static org.mockito.ArgumentMatchers.isA; public class DelegatingFilterProxyRegistrationBeanTests extends AbstractFilterRegistrationBeanTests { - private static ThreadLocal mockFilterInitialized = new ThreadLocal(); + private static ThreadLocal mockFilterInitialized = new ThreadLocal<>(); private GenericWebApplicationContext applicationContext = new GenericWebApplicationContext( new MockServletContext()); diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/FilterRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/FilterRegistrationBeanTests.java index 19459f8a3c..6860c5253e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/FilterRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/FilterRegistrationBeanTests.java @@ -36,7 +36,7 @@ public class FilterRegistrationBeanTests extends AbstractFilterRegistrationBeanT @Test public void setFilter() throws Exception { - FilterRegistrationBean bean = new FilterRegistrationBean(); + FilterRegistrationBean bean = new FilterRegistrationBean<>(); bean.setFilter(this.filter); bean.onStartup(this.servletContext); verify(this.servletContext).addFilter("mockFilter", this.filter); @@ -44,7 +44,7 @@ public class FilterRegistrationBeanTests extends AbstractFilterRegistrationBeanT @Test public void setFilterMustNotBeNull() throws Exception { - FilterRegistrationBean bean = new FilterRegistrationBean(); + FilterRegistrationBean bean = new FilterRegistrationBean<>(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Filter must not be null"); bean.onStartup(this.servletContext); @@ -54,22 +54,20 @@ public class FilterRegistrationBeanTests extends AbstractFilterRegistrationBeanT public void constructFilterMustNotBeNull() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Filter must not be null"); - new FilterRegistrationBean(null); + new FilterRegistrationBean<>(null); } @Test public void createServletRegistrationBeanMustNotBeNull() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("ServletRegistrationBeans must not be null"); - new FilterRegistrationBean(this.filter, - (ServletRegistrationBean[]) null); + new FilterRegistrationBean<>(this.filter, (ServletRegistrationBean[]) null); } @Override protected AbstractFilterRegistrationBean createFilterRegistrationBean( ServletRegistrationBean... servletRegistrationBeans) { - return new FilterRegistrationBean(this.filter, - servletRegistrationBeans); + return new FilterRegistrationBean<>(this.filter, servletRegistrationBeans); } @Override diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBeanTests.java index 17d4ebf981..65643fa313 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBeanTests.java @@ -55,7 +55,7 @@ public class ServletListenerRegistrationBeanTests { @Test public void startupWithDefaults() throws Exception { - ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean( + ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean<>( this.listener); bean.onStartup(this.servletContext); verify(this.servletContext).addListener(this.listener); @@ -63,7 +63,7 @@ public class ServletListenerRegistrationBeanTests { @Test public void disable() throws Exception { - ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean( + ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean<>( this.listener); bean.setEnabled(false); bean.onStartup(this.servletContext); diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java index 13af136d05..6331d46311 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java @@ -76,7 +76,7 @@ public class ServletRegistrationBeanTests { @Test public void startupWithDefaults() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean( + ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet); bean.onStartup(this.servletContext); verify(this.servletContext).addServlet("mockServlet", this.servlet); @@ -86,7 +86,7 @@ public class ServletRegistrationBeanTests { @Test public void startupWithDoubleRegistration() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean( + ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet); given(this.servletContext.addServlet(anyString(), (Servlet) any())) .willReturn(null); @@ -97,19 +97,19 @@ public class ServletRegistrationBeanTests { @Test public void startupWithSpecifiedValues() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean(); + ServletRegistrationBean bean = new ServletRegistrationBean<>(); bean.setName("test"); bean.setServlet(this.servlet); bean.setAsyncSupported(false); bean.setInitParameters(Collections.singletonMap("a", "b")); bean.addInitParameter("c", "d"); - bean.setUrlMappings(new LinkedHashSet(Arrays.asList("/a", "/b"))); + bean.setUrlMappings(new LinkedHashSet<>(Arrays.asList("/a", "/b"))); bean.addUrlMappings("/c"); bean.setLoadOnStartup(10); bean.onStartup(this.servletContext); verify(this.servletContext).addServlet("test", this.servlet); verify(this.registration).setAsyncSupported(false); - Map expectedInitParameters = new HashMap(); + Map expectedInitParameters = new HashMap<>(); expectedInitParameters.put("a", "b"); expectedInitParameters.put("c", "d"); verify(this.registration).setInitParameters(expectedInitParameters); @@ -119,7 +119,7 @@ public class ServletRegistrationBeanTests { @Test public void specificName() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean(); + ServletRegistrationBean bean = new ServletRegistrationBean<>(); bean.setName("specificName"); bean.setServlet(this.servlet); bean.onStartup(this.servletContext); @@ -128,7 +128,7 @@ public class ServletRegistrationBeanTests { @Test public void deducedName() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean(); + ServletRegistrationBean bean = new ServletRegistrationBean<>(); bean.setServlet(this.servlet); bean.onStartup(this.servletContext); verify(this.servletContext).addServlet("mockServlet", this.servlet); @@ -136,7 +136,7 @@ public class ServletRegistrationBeanTests { @Test public void disable() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean(); + ServletRegistrationBean bean = new ServletRegistrationBean<>(); bean.setServlet(this.servlet); bean.setEnabled(false); bean.onStartup(this.servletContext); @@ -145,7 +145,7 @@ public class ServletRegistrationBeanTests { @Test public void setServletMustNotBeNull() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean(); + ServletRegistrationBean bean = new ServletRegistrationBean<>(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Servlet must not be null"); bean.onStartup(this.servletContext); @@ -160,7 +160,7 @@ public class ServletRegistrationBeanTests { @Test public void setMappingMustNotBeNull() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean( + ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("UrlMappings must not be null"); @@ -171,12 +171,12 @@ public class ServletRegistrationBeanTests { public void createMappingMustNotBeNull() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("UrlMappings must not be null"); - new ServletRegistrationBean(this.servlet, (String[]) null); + new ServletRegistrationBean<>(this.servlet, (String[]) null); } @Test public void addMappingMustNotBeNull() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean( + ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("UrlMappings must not be null"); @@ -185,16 +185,16 @@ public class ServletRegistrationBeanTests { @Test public void setMappingReplacesValue() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean( + ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet, "/a", "/b"); - bean.setUrlMappings(new LinkedHashSet(Arrays.asList("/c", "/d"))); + bean.setUrlMappings(new LinkedHashSet<>(Arrays.asList("/c", "/d"))); bean.onStartup(this.servletContext); verify(this.registration).addMapping("/c", "/d"); } @Test public void modifyInitParameters() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean( + ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet, "/a", "/b"); bean.addInitParameter("a", "b"); bean.getInitParameters().put("a", "c"); @@ -204,7 +204,7 @@ public class ServletRegistrationBeanTests { @Test public void withoutDefaultMappings() throws Exception { - ServletRegistrationBean bean = new ServletRegistrationBean( + ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet, false); bean.onStartup(this.servletContext); verify(this.registration, never()).addMapping((String[]) any()); diff --git a/spring-boot/src/test/java/org/springframework/boot/web/support/ErrorPageFilterTests.java b/spring-boot/src/test/java/org/springframework/boot/web/support/ErrorPageFilterTests.java index 53182442d7..4a6ac79f3e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/support/ErrorPageFilterTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/support/ErrorPageFilterTests.java @@ -524,7 +524,7 @@ public class ErrorPageFilterTests { private void setUpAsyncDispatch() throws Exception { this.request.setAsyncSupported(true); this.request.setAsyncStarted(true); - DeferredResult result = new DeferredResult(); + DeferredResult result = new DeferredResult<>(); WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.request); asyncManager.setAsyncWebRequest( new StandardServletAsyncWebRequest(this.request, this.response)); @@ -538,7 +538,7 @@ public class ErrorPageFilterTests { private static final class DispatchRecordingMockHttpServletRequest extends MockHttpServletRequest { - private final Map dispatchers = new HashMap(); + private final Map dispatchers = new HashMap<>(); private DispatchRecordingMockHttpServletRequest() { super("GET", "/test/path"); @@ -559,7 +559,7 @@ public class ErrorPageFilterTests { private static final class AttributeCapturingRequestDispatcher extends MockRequestDispatcher { - private final Map requestAttributes = new HashMap(); + private final Map requestAttributes = new HashMap<>(); private AttributeCapturingRequestDispatcher(String resource) { super(resource);