Replace explicit generics with diamond operator
Where possible, explicit generic declarations to use the Java 8 diamond operator. See gh-9781
This commit is contained in:
committed by
Phillip Webb
parent
eb35fc9fa6
commit
04fdec6f8b
@@ -134,7 +134,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
|
||||
AnnotationMetadata metadata) {
|
||||
MultiValueMap<Class<?>, Annotation> annotations = new LinkedMultiValueMap<>();
|
||||
Class<?> source = ClassUtils.resolveClassName(metadata.getClassName(), null);
|
||||
collectAnnotations(source, annotations, new HashSet<Class<?>>());
|
||||
collectAnnotations(source, annotations, new HashSet<>());
|
||||
return Collections.unmodifiableMap(annotations);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class JestProperties {
|
||||
/**
|
||||
* Comma-separated list of the Elasticsearch instances to use.
|
||||
*/
|
||||
private List<String> uris = new ArrayList<String>(
|
||||
private List<String> uris = new ArrayList<>(
|
||||
Collections.singletonList("http://localhost:9200"));
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,7 +73,7 @@ public class FlywayProperties {
|
||||
* SQL statements to execute to initialize a connection immediately after obtaining
|
||||
* it.
|
||||
*/
|
||||
private List<String> initSqls = new ArrayList<String>();
|
||||
private List<String> initSqls = new ArrayList<>();
|
||||
|
||||
public void setLocations(List<String> locations) {
|
||||
this.locations = locations;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class FreeMarkerTemplateAvailabilityProvider
|
||||
static final class FreeMarkerTemplateAvailabilityProperties
|
||||
extends TemplateAvailabilityProperties {
|
||||
|
||||
private List<String> templateLoaderPath = new ArrayList<String>(
|
||||
private List<String> templateLoaderPath = new ArrayList<>(
|
||||
Arrays.asList(FreeMarkerProperties.DEFAULT_TEMPLATE_LOADER_PATH));
|
||||
|
||||
FreeMarkerTemplateAvailabilityProperties() {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GroovyTemplateAvailabilityProvider
|
||||
static final class GroovyTemplateAvailabilityProperties
|
||||
extends TemplateAvailabilityProperties {
|
||||
|
||||
private List<String> resourceLoaderPath = new ArrayList<String>(
|
||||
private List<String> resourceLoaderPath = new ArrayList<>(
|
||||
Arrays.asList(GroovyTemplateProperties.DEFAULT_RESOURCE_LOADER_PATH));
|
||||
|
||||
GroovyTemplateAvailabilityProperties() {
|
||||
|
||||
@@ -181,8 +181,7 @@ public class EmbeddedLdapAutoConfiguration {
|
||||
private Map<String, Object> getLdapPorts(MutablePropertySources sources) {
|
||||
PropertySource<?> propertySource = sources.get(PROPERTY_SOURCE_NAME);
|
||||
if (propertySource == null) {
|
||||
propertySource = new MapPropertySource(PROPERTY_SOURCE_NAME,
|
||||
new HashMap<String, Object>());
|
||||
propertySource = new MapPropertySource(PROPERTY_SOURCE_NAME, new HashMap<>());
|
||||
sources.addFirst(propertySource);
|
||||
}
|
||||
return (Map<String, Object>) propertySource.getSource();
|
||||
|
||||
@@ -179,8 +179,7 @@ public class EmbeddedMongoAutoConfiguration {
|
||||
private Map<String, Object> getMongoPorts(MutablePropertySources sources) {
|
||||
PropertySource<?> propertySource = sources.get("mongo.ports");
|
||||
if (propertySource == null) {
|
||||
propertySource = new MapPropertySource("mongo.ports",
|
||||
new HashMap<String, Object>());
|
||||
propertySource = new MapPropertySource("mongo.ports", new HashMap<>());
|
||||
sources.addFirst(propertySource);
|
||||
}
|
||||
return (Map<String, Object>) propertySource.getSource();
|
||||
|
||||
@@ -64,7 +64,7 @@ public class UserInfoTokenServicesTests {
|
||||
public void init() {
|
||||
this.resource.setClientId("foo");
|
||||
given(this.template.getForEntity(any(String.class), eq(Map.class)))
|
||||
.willReturn(new ResponseEntity<Map>(this.map, HttpStatus.OK));
|
||||
.willReturn(new ResponseEntity<>(this.map, HttpStatus.OK));
|
||||
given(this.template.getAccessToken())
|
||||
.willReturn(new DefaultOAuth2AccessToken("FOO"));
|
||||
given(this.template.getResource()).willReturn(this.resource);
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ServerPropertiesTests {
|
||||
|
||||
@Test
|
||||
public void redirectContextRootIsNotConfiguredByDefault() throws Exception {
|
||||
bind(new HashMap<String, String>());
|
||||
bind(new HashMap<>());
|
||||
ServerProperties.Tomcat tomcat = this.properties.getTomcat();
|
||||
assertThat(tomcat.getRedirectContextRoot()).isNull();
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class ServerPropertiesTests {
|
||||
|
||||
@Test
|
||||
public void testCustomizeJettyAccessLog() throws Exception {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("server.jetty.accesslog.enabled", "true");
|
||||
map.put("server.jetty.accesslog.filename", "foo.txt");
|
||||
map.put("server.jetty.accesslog.file-date-format", "yyyymmdd");
|
||||
|
||||
@@ -107,7 +107,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
|
||||
@Test
|
||||
public void tomcatAccessLogFileDateFormatByDefault() {
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("server.tomcat.accesslog.enabled", "true");
|
||||
bindProperties(map);
|
||||
this.customizer.customize(factory);
|
||||
@@ -118,7 +118,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
|
||||
@Test
|
||||
public void tomcatAccessLogFileDateFormatCanBeRedefined() {
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("server.tomcat.accesslog.enabled", "true");
|
||||
map.put("server.tomcat.accesslog.file-date-format", "yyyy-MM-dd.HH");
|
||||
bindProperties(map);
|
||||
@@ -397,7 +397,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
|
||||
|
||||
@Test
|
||||
public void customTomcatDisableMaxHttpPostSize() {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("server.tomcat.max-http-post-size", "-1");
|
||||
bindProperties(map);
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
|
||||
|
||||
Reference in New Issue
Block a user