Merge pull request #10494 from Johnny Lim

* gh-10494:
  Polish “Remove explicit type arguments”
  Remove explicit type arguments
pull/10764/head
Andy Wilkinson 7 years ago
commit 35c6b83fce

@ -67,7 +67,7 @@ public abstract class ManagementServerFactoryCustomizer<T extends ConfigurableWe
// the same place)
webServerFactoryCustomizer.customize(factory);
// Then reset the error pages
factory.setErrorPages(Collections.<ErrorPage>emptySet());
factory.setErrorPages(Collections.emptySet());
// and add the management-specific bits
customize(factory, managementServerProperties, serverProperties);
}

@ -38,7 +38,6 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.web.servlet.handler.AbstractHandlerMethodMapping;
import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
@ -59,8 +58,7 @@ public class RequestMappingEndpointTests {
mapping.setUrlMap(Collections.singletonMap("/foo", new Object()));
mapping.setApplicationContext(new StaticApplicationContext());
mapping.initApplicationContext();
this.endpoint.setHandlerMappings(
Collections.<AbstractUrlHandlerMapping>singletonList(mapping));
this.endpoint.setHandlerMappings(Collections.singletonList(mapping));
Map<String, Object> result = this.endpoint.mappings();
assertThat(result).hasSize(1);
@SuppressWarnings("unchecked")
@ -120,8 +118,7 @@ public class RequestMappingEndpointTests {
@Test
public void concreteMethodMappings() {
WebMvcEndpointHandlerMapping mapping = createHandlerMapping();
this.endpoint.setMethodMappings(
Collections.<AbstractHandlerMethodMapping<?>>singletonList(mapping));
this.endpoint.setMethodMappings(Collections.singletonList(mapping));
Map<String, Object> result = this.endpoint.mappings();
assertThat(result).hasSize(2);
assertThat(result.keySet())

@ -39,12 +39,12 @@ import org.springframework.context.ConfigurableApplicationContext;
public class ShutdownEndpoint implements ApplicationContextAware {
private static final Map<String, String> NO_CONTEXT_MESSAGE = Collections
.unmodifiableMap(Collections.<String, String>singletonMap("message",
"No context to shutdown."));
.unmodifiableMap(
Collections.singletonMap("message", "No context to shutdown."));
private static final Map<String, String> SHUTDOWN_MESSAGE = Collections
.unmodifiableMap(Collections.<String, String>singletonMap("message",
"Shutting down, bye..."));
.unmodifiableMap(
Collections.singletonMap("message", "Shutting down, bye..."));
private ConfigurableApplicationContext context;

@ -154,7 +154,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
return result;
}
catch (Exception ex) {
return new HashMap<>(Collections.<String, Object>singletonMap("error",
return new HashMap<>(Collections.singletonMap("error",
"Cannot serialize '" + prefix + "'"));
}
}

@ -106,7 +106,7 @@ public class AuditEventsEndpointWebIntegrationTests {
private AuditEvent createEvent(String instant, String principal, String type) {
return new AuditEvent(Date.from(Instant.parse(instant)), principal, type,
Collections.<String, Object>emptyMap());
Collections.emptyMap());
}
}

@ -36,8 +36,7 @@ public class AuditListenerTests {
@Test
public void testStoredEvents() {
AuditEventRepository repository = mock(AuditEventRepository.class);
AuditEvent event = new AuditEvent("principal", "type",
Collections.<String, Object>emptyMap());
AuditEvent event = new AuditEvent("principal", "type", Collections.emptyMap());
AuditListener listener = new AuditListener(repository);
listener.onApplicationEvent(new AuditApplicationEvent(event));
verify(repository).add(event);

@ -25,7 +25,6 @@ import org.mockito.ArgumentCaptor;
import org.springframework.boot.actuate.audit.listener.AuditApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.SecurityConfig;
import org.springframework.security.access.event.AbstractAuthorizationEvent;
import org.springframework.security.access.event.AuthenticationCredentialsNotFoundEvent;
@ -56,8 +55,7 @@ public class AuthorizationAuditListenerTests {
public void testAuthenticationCredentialsNotFound() {
AuditApplicationEvent event = handleAuthorizationEvent(
new AuthenticationCredentialsNotFoundEvent(this,
Collections.<ConfigAttribute>singletonList(
new SecurityConfig("USER")),
Collections.singletonList(new SecurityConfig("USER")),
new AuthenticationCredentialsNotFoundException("Bad user")));
assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
@ -67,8 +65,7 @@ public class AuthorizationAuditListenerTests {
public void testAuthorizationFailure() {
AuditApplicationEvent event = handleAuthorizationEvent(
new AuthorizationFailureEvent(this,
Collections.<ConfigAttribute>singletonList(
new SecurityConfig("USER")),
Collections.singletonList(new SecurityConfig("USER")),
new UsernamePasswordAuthenticationToken("user", "password"),
new AccessDeniedException("Bad user")));
assertThat(event.getAuditEvent().getType())
@ -83,8 +80,7 @@ public class AuthorizationAuditListenerTests {
authentication.setDetails(details);
AuditApplicationEvent event = handleAuthorizationEvent(
new AuthorizationFailureEvent(this,
Collections.<ConfigAttribute>singletonList(
new SecurityConfig("USER")),
Collections.singletonList(new SecurityConfig("USER")),
authentication, new AccessDeniedException("Bad user")));
assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthorizationAuditListener.AUTHORIZATION_FAILURE);

@ -35,9 +35,9 @@ public class InMemoryTraceRepositoryTests {
@Test
public void capacityLimited() {
this.repository.setCapacity(2);
this.repository.add(Collections.<String, Object>singletonMap("foo", "bar"));
this.repository.add(Collections.<String, Object>singletonMap("bar", "foo"));
this.repository.add(Collections.<String, Object>singletonMap("bar", "bar"));
this.repository.add(Collections.singletonMap("foo", "bar"));
this.repository.add(Collections.singletonMap("bar", "foo"));
this.repository.add(Collections.singletonMap("bar", "bar"));
List<Trace> traces = this.repository.findAll();
assertThat(traces).hasSize(2);
assertThat(traces.get(0).getInfo().get("bar")).isEqualTo("bar");
@ -48,9 +48,9 @@ public class InMemoryTraceRepositoryTests {
public void reverseFalse() {
this.repository.setReverse(false);
this.repository.setCapacity(2);
this.repository.add(Collections.<String, Object>singletonMap("foo", "bar"));
this.repository.add(Collections.<String, Object>singletonMap("bar", "foo"));
this.repository.add(Collections.<String, Object>singletonMap("bar", "bar"));
this.repository.add(Collections.singletonMap("foo", "bar"));
this.repository.add(Collections.singletonMap("bar", "foo"));
this.repository.add(Collections.singletonMap("bar", "bar"));
List<Trace> traces = this.repository.findAll();
assertThat(traces).hasSize(2);
assertThat(traces.get(1).getInfo().get("bar")).isEqualTo("bar");

@ -33,7 +33,7 @@ public class TraceEndpointTests {
@Test
public void trace() throws Exception {
TraceRepository repository = new InMemoryTraceRepository();
repository.add(Collections.<String, Object>singletonMap("a", "b"));
repository.add(Collections.singletonMap("a", "b"));
Trace trace = new TraceEndpoint(repository).traces().getTraces().get(0);
assertThat(trace.getInfo().get("a")).isEqualTo("b");
}

@ -131,7 +131,7 @@ public abstract class AutoConfigurationPackages {
@Override
public Set<Object> determineImports(AnnotationMetadata metadata) {
return Collections.<Object>singleton(new PackageImport(metadata));
return Collections.singleton(new PackageImport(metadata));
}
}

@ -174,7 +174,7 @@ class AutoConfigurationSorter {
private Set<String> readBefore() {
if (wasProcessed()) {
return this.autoConfigurationMetadata.getSet(this.className,
"AutoConfigureBefore", Collections.<String>emptySet());
"AutoConfigureBefore", Collections.emptySet());
}
return getAnnotationValue(AutoConfigureBefore.class);
}
@ -182,7 +182,7 @@ class AutoConfigurationSorter {
private Set<String> readAfter() {
if (wasProcessed()) {
return this.autoConfigurationMetadata.getSet(this.className,
"AutoConfigureAfter", Collections.<String>emptySet());
"AutoConfigureAfter", Collections.emptySet());
}
return getAnnotationValue(AutoConfigureAfter.class);
}

@ -61,7 +61,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
Set<String> result = new LinkedHashSet<>();
result.addAll(getCandidateConfigurations(metadata, null));
result.removeAll(getExclusions(metadata, null));
return Collections.<Object>unmodifiableSet(result);
return Collections.unmodifiableSet(result);
}
@Override

@ -42,7 +42,7 @@ public class CacheManagerCustomizers {
public CacheManagerCustomizers(
List<? extends CacheManagerCustomizer<?>> customizers) {
this.customizers = (customizers != null ? new ArrayList<>(customizers)
: Collections.<CacheManagerCustomizer<?>>emptyList());
: Collections.emptyList());
}
/**

@ -62,7 +62,7 @@ public class EntityScanner {
throws ClassNotFoundException {
List<String> packages = getPackages();
if (packages.isEmpty()) {
return Collections.<Class<?>>emptySet();
return Collections.emptySet();
}
Set<Class<?>> entitySet = new HashSet<>();
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(

@ -103,8 +103,7 @@ public class HttpMessageConverters implements Iterable<HttpMessageConverter<?>>
public HttpMessageConverters(boolean addDefaultConverters,
Collection<HttpMessageConverter<?>> converters) {
List<HttpMessageConverter<?>> combined = getCombinedConverters(converters,
addDefaultConverters ? getDefaultConverters()
: Collections.<HttpMessageConverter<?>>emptyList());
addDefaultConverters ? getDefaultConverters() : Collections.emptyList());
combined = postProcessConverters(combined);
this.converters = Collections.unmodifiableList(combined);
}

@ -68,8 +68,8 @@ public class HttpMessageConvertersAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public HttpMessageConverters messageConverters() {
return new HttpMessageConverters(this.converters == null
? Collections.<HttpMessageConverter<?>>emptyList() : this.converters);
return new HttpMessageConverters(
this.converters == null ? Collections.emptyList() : this.converters);
}
@Configuration

@ -49,7 +49,7 @@ class ActiveMQConnectionFactoryFactory {
Assert.notNull(properties, "Properties must not be null");
this.properties = properties;
this.factoryCustomizers = (factoryCustomizers != null ? factoryCustomizers
: Collections.<ActiveMQConnectionFactoryCustomizer>emptyList());
: Collections.emptyList());
}
public <T extends ActiveMQConnectionFactory> T createConnectionFactory(

@ -56,8 +56,8 @@ public class LdapAutoConfiguration {
source.setPassword(this.properties.getPassword());
source.setBase(this.properties.getBase());
source.setUrls(this.properties.determineUrls(this.environment));
source.setBaseEnvironmentProperties(Collections
.<String, Object>unmodifiableMap(this.properties.getBaseEnvironment()));
source.setBaseEnvironmentProperties(
Collections.unmodifiableMap(this.properties.getBaseEnvironment()));
return source;
}

@ -258,8 +258,7 @@ public class EmbeddedMongoAutoConfiguration {
Set<Feature> features) {
Assert.notNull(version, "version must not be null");
this.version = version;
this.features = (features == null ? Collections.<Feature>emptySet()
: features);
this.features = (features == null ? Collections.emptySet() : features);
}
@Override

@ -62,8 +62,7 @@ public class BasicErrorController extends AbstractErrorController {
*/
public BasicErrorController(ErrorAttributes errorAttributes,
ErrorProperties errorProperties) {
this(errorAttributes, errorProperties,
Collections.<ErrorViewResolver>emptyList());
this(errorAttributes, errorProperties, Collections.emptyList());
}
/**

@ -248,8 +248,7 @@ public class AutoConfigurationImportSelectorTests {
@Override
protected List<AutoConfigurationImportListener> getAutoConfigurationImportListeners() {
return Collections.<AutoConfigurationImportListener>singletonList(
(event) -> this.lastEvent = event);
return Collections.singletonList((event) -> this.lastEvent = event);
}
public AutoConfigurationImportEvent getLastEvent() {

@ -935,8 +935,7 @@ public class CacheAutoConfigurationTests {
@Bean
public javax.cache.CacheManager customJCacheCacheManager() {
javax.cache.CacheManager cacheManager = mock(javax.cache.CacheManager.class);
given(cacheManager.getCacheNames())
.willReturn(Collections.<String>emptyList());
given(cacheManager.getCacheNames()).willReturn(Collections.emptyList());
return cacheManager;
}

@ -76,10 +76,10 @@ public class OnClassConditionAutoConfigurationImportFilterTests {
AutoConfigurationMetadata metadata = mock(AutoConfigurationMetadata.class);
given(metadata.wasProcessed("test.match")).willReturn(true);
given(metadata.getSet("test.match", "ConditionalOnClass"))
.willReturn(Collections.<String>singleton("java.io.InputStream"));
.willReturn(Collections.singleton("java.io.InputStream"));
given(metadata.wasProcessed("test.nomatch")).willReturn(true);
given(metadata.getSet("test.nomatch", "ConditionalOnClass"))
.willReturn(Collections.<String>singleton("java.io.DoesNotExist"));
.willReturn(Collections.singleton("java.io.DoesNotExist"));
return metadata;
}

@ -92,7 +92,7 @@ public class EntityScanPackagesTests {
throws Exception {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Registry must not be null");
EntityScanPackages.register(null, Collections.<String>emptyList());
EntityScanPackages.register(null, Collections.emptyList());
}
@Test

@ -102,8 +102,7 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
String[] dependsOn = ((BeanDefinitionRegistry) context
.getSourceApplicationContext()).getBeanDefinition("entityManagerFactory")
.getDependsOn();
return dependsOn != null ? Arrays.asList(dependsOn)
: Collections.<String>emptyList();
return dependsOn != null ? Arrays.asList(dependsOn) : Collections.emptyList();
}
@Configuration

@ -87,8 +87,7 @@ public class ActiveMQPropertiesTests {
private ActiveMQConnectionFactoryFactory createFactory(
ActiveMQProperties properties) {
return new ActiveMQConnectionFactoryFactory(properties,
Collections.<ActiveMQConnectionFactoryCustomizer>emptyList());
return new ActiveMQConnectionFactoryFactory(properties, Collections.emptyList());
}
}

@ -36,7 +36,7 @@ public class JndiPropertiesHidingClassLoader extends ClassLoader {
@Override
public Enumeration<URL> getResources(String name) throws IOException {
if ("jndi.properties".equals(name)) {
return Collections.enumeration(Collections.<URL>emptyList());
return Collections.enumeration(Collections.emptyList());
}
return super.getResources(name);
}

@ -89,7 +89,7 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
@Test
public void deviceDelegatingFreeMarkerViewResolver() throws Exception {
load(Collections.<Class<?>>singletonList(FreeMarkerAutoConfiguration.class),
load(Collections.singletonList(FreeMarkerAutoConfiguration.class),
"spring.mobile.devicedelegatingviewresolver.enabled:true");
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
.hasSize(2);
@ -100,7 +100,7 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
@Test
public void deviceDelegatingGroovyMarkupViewResolver() throws Exception {
load(Collections.<Class<?>>singletonList(GroovyTemplateAutoConfiguration.class),
load(Collections.singletonList(GroovyTemplateAutoConfiguration.class),
"spring.mobile.devicedelegatingviewresolver.enabled:true");
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
.hasSize(2);
@ -111,7 +111,7 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
@Test
public void deviceDelegatingMustacheViewResolver() throws Exception {
load(Collections.<Class<?>>singletonList(MustacheAutoConfiguration.class),
load(Collections.singletonList(MustacheAutoConfiguration.class),
"spring.mobile.devicedelegatingviewresolver.enabled:true");
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
.hasSize(2);
@ -122,7 +122,7 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
@Test
public void deviceDelegatingThymeleafViewResolver() throws Exception {
load(Collections.<Class<?>>singletonList(ThymeleafAutoConfiguration.class),
load(Collections.singletonList(ThymeleafAutoConfiguration.class),
"spring.mobile.devicedelegatingviewresolver.enabled:true");
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
.hasSize(2);

@ -38,7 +38,7 @@ import org.springframework.boot.cli.command.run.RunCommand;
*/
public class DefaultCommandFactory implements CommandFactory {
private static final List<Command> defaultCommands = Arrays.<Command>asList(
private static final List<Command> defaultCommands = Arrays.asList(
new VersionCommand(), new RunCommand(), new GrabCommand(), new JarCommand(),
new WarCommand(), new InstallCommand(), new UninstallCommand(),
new InitCommand());

@ -44,7 +44,7 @@ public final class Dependency {
* @param version the version
*/
public Dependency(String groupId, String artifactId, String version) {
this(groupId, artifactId, version, Collections.<Exclusion>emptyList());
this(groupId, artifactId, version, Collections.emptyList());
}
/**

@ -38,7 +38,7 @@ public abstract class GroovyTemplate {
public static String template(String name)
throws IOException, CompilationFailedException, ClassNotFoundException {
return template(name, Collections.<String, Object>emptyMap());
return template(name, Collections.emptyMap());
}
public static String template(String name, Map<String, ?> model)

@ -29,7 +29,7 @@ public class CustomCommandFactory implements CommandFactory {
@Override
public Collection<Command> getCommands() {
return Collections.<Command>singleton(new CustomCommand());
return Collections.singleton(new CustomCommand());
}
}

@ -43,8 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class ProjectGenerationRequestTests {
public static final Map<String, String> EMPTY_TAGS = Collections
.<String, String>emptyMap();
public static final Map<String, String> EMPTY_TAGS = Collections.emptyMap();
@Rule
public final ExpectedException thrown = ExpectedException.none();

@ -123,7 +123,7 @@ final class ChangeableUrls implements Iterable<URL> {
private static List<URL> getUrlsFromClassPathOfJarManifestIfPossible(URL url) {
JarFile jarFile = getJarFileIfPossible(url);
if (jarFile == null) {
return Collections.<URL>emptyList();
return Collections.emptyList();
}
try {
return getUrlsFromManifestClassPathAttribute(url, jarFile);
@ -152,7 +152,7 @@ final class ChangeableUrls implements Iterable<URL> {
JarFile jarFile) throws IOException {
Manifest manifest = jarFile.getManifest();
if (manifest == null) {
return Collections.<URL>emptyList();
return Collections.emptyList();
}
String classPath = manifest.getMainAttributes()
.getValue(Attributes.Name.CLASS_PATH);

@ -37,7 +37,6 @@ import org.springframework.boot.autoconfigure.web.ResourceProperties;
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
import org.springframework.boot.devtools.classpath.ClassPathChangedEvent;
import org.springframework.boot.devtools.classpath.ClassPathFileSystemWatcher;
import org.springframework.boot.devtools.filewatch.ChangedFiles;
import org.springframework.boot.devtools.livereload.LiveReloadServer;
import org.springframework.boot.devtools.restart.FailureHandler;
import org.springframework.boot.devtools.restart.MockRestartInitializer;
@ -146,7 +145,7 @@ public class LocalDevToolsAutoConfigurationTests {
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
reset(server);
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
Collections.<ChangedFiles>emptySet(), false);
Collections.emptySet(), false);
this.context.publishEvent(event);
verify(server).triggerReload();
}
@ -157,7 +156,7 @@ public class LocalDevToolsAutoConfigurationTests {
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
reset(server);
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
Collections.<ChangedFiles>emptySet(), true);
Collections.emptySet(), true);
this.context.publishEvent(event);
verify(server, never()).triggerReload();
}
@ -175,7 +174,7 @@ public class LocalDevToolsAutoConfigurationTests {
public void restartTriggeredOnClassPathChangeWithRestart() throws Exception {
this.context = initializeAndRun(Config.class);
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
Collections.<ChangedFiles>emptySet(), true);
Collections.emptySet(), true);
this.context.publishEvent(event);
verify(this.mockRestarter.getMock()).restart(any(FailureHandler.class));
}
@ -184,7 +183,7 @@ public class LocalDevToolsAutoConfigurationTests {
public void restartNotTriggeredOnClassPathChangeWithRestart() throws Exception {
this.context = initializeAndRun(Config.class);
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
Collections.<ChangedFiles>emptySet(), false);
Collections.emptySet(), false);
this.context.publishEvent(event);
verify(this.mockRestarter.getMock(), never()).restart();
}
@ -251,7 +250,7 @@ public class LocalDevToolsAutoConfigurationTests {
private ConfigurableApplicationContext initializeAndRun(Class<?> config,
String... args) {
return initializeAndRun(config, Collections.<String, Object>emptyMap(), args);
return initializeAndRun(config, Collections.emptyMap(), args);
}
private ConfigurableApplicationContext initializeAndRun(Class<?> config,

@ -99,8 +99,8 @@ public class DevToolPropertiesIntegrationTests {
SpringApplication application = new SpringApplication(
BeanConditionConfiguration.class);
application.setWebApplicationType(WebApplicationType.NONE);
application.setDefaultProperties(Collections.<String, Object>singletonMap(
"spring.devtools.remote.secret", "donttell"));
application.setDefaultProperties(
Collections.singletonMap("spring.devtools.remote.secret", "donttell"));
this.context = application.run();
this.context.getBean(MyBean.class);
}

@ -79,7 +79,7 @@ public class DispatcherTests {
public void accessManagerMustNotBeNull() throws Exception {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("AccessManager must not be null");
new Dispatcher(null, Collections.<HandlerMapper>emptyList());
new Dispatcher(null, Collections.emptyList());
}
@Test

@ -245,7 +245,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
Set<Class<?>> seen = new HashSet<>();
collectClassAnnotations(testClass, annotations, seen);
Set<Object> determinedImports = determineImports(annotations, testClass);
this.key = Collections.<Object>unmodifiableSet(
this.key = Collections.unmodifiableSet(
determinedImports != null ? determinedImports : annotations);
}
@ -321,7 +321,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
return null;
}
// The source itself is the import
return Collections.<Object>singleton(source.getName());
return Collections.singleton(source.getName());
}
@SuppressWarnings("unchecked")

@ -46,7 +46,7 @@ class DefinitionsParser {
private final Map<Definition, Field> definitionFields;
DefinitionsParser() {
this(Collections.<Definition>emptySet());
this(Collections.emptySet());
}
DefinitionsParser(Collection<? extends Definition> existing) {

@ -162,7 +162,7 @@ public class ImportsContextCustomizerTests {
@Override
public Set<Object> determineImports(AnnotationMetadata metadata) {
return Collections.<Object>singleton(TestConfig.class.getName());
return Collections.singleton(TestConfig.class.getName());
}
}

@ -46,7 +46,7 @@ public class JsonReaderTests extends AbstractConfigurationMetadataTests {
@Test
public void invalidMetadata() throws IOException {
this.thrown.expectCause(CoreMatchers.<Throwable>instanceOf(JSONException.class));
this.thrown.expectCause(CoreMatchers.instanceOf(JSONException.class));
readFor("invalid");
}

@ -77,8 +77,7 @@ public class ItemHint implements Comparable<ItemHint> {
}
public static ItemHint newHint(String name, ValueHint... values) {
return new ItemHint(name, Arrays.asList(values),
Collections.<ValueProvider>emptyList());
return new ItemHint(name, Arrays.asList(values), Collections.emptyList());
}
@Override

@ -818,13 +818,14 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
public void mergingOfHintWithProvider() throws Exception {
writeAdditionalHints(new ItemHint("simple.theName",
Collections.<ItemHint.ValueHint>emptyList(),
Arrays.asList(
new ItemHint.ValueProvider("first",
Collections.<String, Object>singletonMap("target",
"org.foo")),
new ItemHint.ValueProvider("second", null))));
writeAdditionalHints(
new ItemHint("simple.theName",
Collections
.emptyList(),
Arrays.asList(
new ItemHint.ValueProvider("first",
Collections.singletonMap("target", "org.foo")),
new ItemHint.ValueProvider("second", null))));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)

@ -57,9 +57,8 @@ public class JsonMarshallerTests {
metadata.add(new ItemHint("d", null,
Arrays.asList(
new ItemHint.ValueProvider("first",
Collections.<String, Object>singletonMap("target",
"foo")),
new ItemHint.ValueProvider("second", null))));
Collections.singletonMap("target", "foo")),
new ItemHint.ValueProvider("second", null))));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
JsonMarshaller marshaller = new JsonMarshaller();
marshaller.write(metadata, outputStream);

@ -43,7 +43,7 @@ public class DependencyFilterMojoTests {
@Test
public void filterDependencies() throws MojoExecutionException {
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
Collections.<Exclude>emptyList(), "com.foo", "exclude-id");
Collections.emptyList(), "com.foo", "exclude-id");
Artifact artifact = createArtifact("com.bar", "one");
Set<Artifact> artifacts = mojo.filterDependencies(
@ -56,7 +56,7 @@ public class DependencyFilterMojoTests {
@Test
public void filterGroupIdExactMatch() throws MojoExecutionException {
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
Collections.<Exclude>emptyList(), "com.foo", "");
Collections.emptyList(), "com.foo", "");
Artifact artifact = createArtifact("com.foo.bar", "one");
Set<Artifact> artifacts = mojo.filterDependencies(
@ -69,7 +69,7 @@ public class DependencyFilterMojoTests {
@Test
public void filterScopeKeepOrder() throws MojoExecutionException {
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
Collections.<Exclude>emptyList(), "", "",
Collections.emptyList(), "", "",
new ScopeFilter(null, Artifact.SCOPE_SYSTEM));
Artifact one = createArtifact("com.foo", "one");
Artifact two = createArtifact("com.foo", "two", Artifact.SCOPE_SYSTEM);
@ -81,7 +81,7 @@ public class DependencyFilterMojoTests {
@Test
public void filterArtifactIdKeepOrder() throws MojoExecutionException {
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
Collections.<Exclude>emptyList(), "", "one,three");
Collections.emptyList(), "", "one,three");
Artifact one = createArtifact("com.foo", "one");
Artifact two = createArtifact("com.foo", "two");
Artifact three = createArtifact("com.foo", "three");
@ -93,7 +93,7 @@ public class DependencyFilterMojoTests {
@Test
public void filterGroupIdKeepOrder() throws MojoExecutionException {
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
Collections.<Exclude>emptyList(), "com.foo", "");
Collections.emptyList(), "com.foo", "");
Artifact one = createArtifact("com.foo", "one");
Artifact two = createArtifact("com.bar", "two");
Artifact three = createArtifact("com.bar", "three");

@ -93,7 +93,7 @@ public abstract class MockServletWebServer {
given(this.servletContext.getInitParameter(anyString())).willAnswer(
(invocation) -> initParameters.get(invocation.getArgument(0)));
given(this.servletContext.getAttributeNames())
.willReturn(MockServletWebServer.<String>emptyEnumeration());
.willReturn(MockServletWebServer.emptyEnumeration());
given(this.servletContext.getNamedDispatcher("default"))
.willReturn(mock(RequestDispatcher.class));
for (Initializer initializer : this.initializers) {

@ -130,8 +130,8 @@ public class ResourceBanner implements Banner {
private PropertyResolver getTitleResolver(Class<?> sourceClass) {
MutablePropertySources sources = new MutablePropertySources();
String applicationTitle = getApplicationTitle(sourceClass);
Map<String, Object> titleMap = Collections.<String, Object>singletonMap(
"application.title", (applicationTitle == null ? "" : applicationTitle));
Map<String, Object> titleMap = Collections.singletonMap("application.title",
(applicationTitle == null ? "" : applicationTitle));
sources.addFirst(new MapPropertySource("title", titleMap));
return new PropertySourcesPropertyResolver(sources);
}

@ -42,8 +42,7 @@ public class CompositeDataSourcePoolMetadataProvider
*/
public CompositeDataSourcePoolMetadataProvider(
Collection<? extends DataSourcePoolMetadataProvider> providers) {
this.providers = (providers == null
? Collections.<DataSourcePoolMetadataProvider>emptyList()
this.providers = (providers == null ? Collections.emptyList()
: Collections.unmodifiableList(new ArrayList<>(providers)));
}

@ -98,7 +98,7 @@ public class AtomikosDependsOnBeanFactoryPostProcessor
}
private List<String> asList(String[] array) {
return (array == null ? Collections.<String>emptyList() : Arrays.asList(array));
return (array == null ? Collections.emptyList() : Arrays.asList(array));
}
@Override

@ -111,8 +111,8 @@ public class RestTemplateBuilder {
this.basicAuthorization = null;
this.restTemplateCustomizers = Collections
.unmodifiableSet(new LinkedHashSet<>(Arrays.asList(customizers)));
this.requestFactoryCustomizers = Collections.<RequestFactoryCustomizer>emptySet();
this.interceptors = Collections.<ClientHttpRequestInterceptor>emptySet();
this.requestFactoryCustomizers = Collections.emptySet();
this.interceptors = Collections.emptySet();
}
private RestTemplateBuilder(boolean detectRequestFactory, String rootUri,
@ -596,15 +596,13 @@ public class RestTemplateBuilder {
}
private <T> Set<T> append(Set<T> set, T addition) {
Set<T> result = new LinkedHashSet<>(
set == null ? Collections.<T>emptySet() : set);
Set<T> result = new LinkedHashSet<>(set == null ? Collections.emptySet() : set);
result.add(addition);
return Collections.unmodifiableSet(result);
}
private <T> Set<T> append(Set<T> set, Collection<? extends T> additions) {
Set<T> result = new LinkedHashSet<>(
set == null ? Collections.<T>emptySet() : set);
Set<T> result = new LinkedHashSet<>(set == null ? Collections.emptySet() : set);
result.addAll(additions);
return Collections.unmodifiableSet(result);
}

@ -120,7 +120,7 @@ public class ResourceBannerTests {
ResourceBanner banner = new MockResourceBanner(resource, bootVersion,
applicationVersion, applicationTitle);
ConfigurableEnvironment environment = new MockEnvironment();
Map<String, Object> source = Collections.<String, Object>singletonMap("a", "1");
Map<String, Object> source = Collections.singletonMap("a", "1");
environment.getPropertySources().addLast(new MapPropertySource("map", source));
ByteArrayOutputStream out = new ByteArrayOutputStream();
banner.printBanner(environment, getClass(), new PrintStream(out));

@ -485,7 +485,7 @@ public class SpringApplicationTests {
application.setWebApplicationType(WebApplicationType.NONE);
ConfigurableEnvironment environment = new StandardEnvironment();
environment.getPropertySources().addFirst(new MapPropertySource("commandLineArgs",
Collections.<String, Object>singletonMap("foo", "original")));
Collections.singletonMap("foo", "original")));
application.setEnvironment(environment);
this.context = application.run("--foo=bar", "--bar=foo");
assertThat(environment).has(

@ -79,7 +79,7 @@ public class SpringApplicationBuilderTests {
public void propertiesAsMap() throws Exception {
SpringApplicationBuilder application = new SpringApplicationBuilder()
.sources(ExampleConfig.class).contextClass(StaticApplicationContext.class)
.properties(Collections.<String, Object>singletonMap("bar", "foo"));
.properties(Collections.singletonMap("bar", "foo"));
this.context = application.run();
assertThat(this.context.getEnvironment().getProperty("bar")).isEqualTo("foo");
}

@ -738,8 +738,7 @@ public class ConfigFileApplicationListenerTests {
@Test
public void addBeforeDefaultProperties() throws Exception {
MapPropertySource defaultSource = new MapPropertySource("defaultProperties",
Collections.<String, Object>singletonMap("the.property",
"fromdefaultproperties"));
Collections.singletonMap("the.property", "fromdefaultproperties"));
this.environment.getPropertySources().addFirst(defaultSource);
this.initializer.setSearchNames("testproperties");
this.initializer.postProcessEnvironment(this.environment, this.application);

@ -211,7 +211,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
assertThat(first.getOne()).isEqualTo("foo");
source.put("example.one", "bar");
sources.addFirst(new MapPropertySource("extra",
Collections.<String, Object>singletonMap("example.two", "baz")));
Collections.singletonMap("example.two", "baz")));
PrototypeBean second = this.context.getBean(PrototypeBean.class);
assertThat(second.getOne()).isEqualTo("bar");
assertThat(second.getTwo()).isEqualTo("baz");

@ -123,7 +123,7 @@ public class EnableConfigurationPropertiesTests {
this.context.register(ExceptionIfInvalidTestConfiguration.class);
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
"name:foo");
this.thrown.expectCause(Matchers.<Throwable>instanceOf(BindException.class));
this.thrown.expectCause(Matchers.instanceOf(BindException.class));
this.context.refresh();
}

@ -46,9 +46,9 @@ public class ConfigurationPropertySourcesTests {
ConfigurableEnvironment environment = new StandardEnvironment();
MutablePropertySources sources = environment.getPropertySources();
sources.addLast(new SystemEnvironmentPropertySource("system",
Collections.<String, Object>singletonMap("SERVER_PORT", "1234")));
Collections.singletonMap("SERVER_PORT", "1234")));
sources.addLast(new MapPropertySource("config",
Collections.<String, Object>singletonMap("server.port", "4568")));
Collections.singletonMap("server.port", "4568")));
int size = sources.size();
ConfigurationPropertySources.attach(environment);
assertThat(sources.size()).isEqualTo(size + 1);
@ -66,8 +66,8 @@ public class ConfigurationPropertySourcesTests {
public void getWhenAttachedShouldReturnAttached() throws Exception {
ConfigurableEnvironment environment = new StandardEnvironment();
MutablePropertySources sources = environment.getPropertySources();
sources.addFirst(new MapPropertySource("test",
Collections.<String, Object>singletonMap("a", "b")));
sources.addFirst(
new MapPropertySource("test", Collections.singletonMap("a", "b")));
int expectedSize = sources.size();
ConfigurationPropertySources.attach(environment);
assertThat(ConfigurationPropertySources.get(environment)).hasSize(expectedSize);
@ -89,7 +89,7 @@ public class ConfigurationPropertySourcesTests {
public void fromPropertySourceShouldReturnSpringConfigurationPropertySource()
throws Exception {
PropertySource<?> source = new MapPropertySource("foo",
Collections.<String, Object>singletonMap("foo", "bar"));
Collections.singletonMap("foo", "bar"));
ConfigurationPropertySource configurationPropertySource = ConfigurationPropertySources
.from(source).iterator().next();
assertThat(configurationPropertySource)
@ -99,10 +99,10 @@ public class ConfigurationPropertySourcesTests {
@Test
public void fromPropertySourceShouldFlattenPropertySources() throws Exception {
StandardEnvironment environment = new StandardEnvironment();
environment.getPropertySources().addFirst(new MapPropertySource("foo",
Collections.<String, Object>singletonMap("foo", "bar")));
environment.getPropertySources().addFirst(new MapPropertySource("far",
Collections.<String, Object>singletonMap("far", "far")));
environment.getPropertySources().addFirst(
new MapPropertySource("foo", Collections.singletonMap("foo", "bar")));
environment.getPropertySources().addFirst(
new MapPropertySource("far", Collections.singletonMap("far", "far")));
MutablePropertySources sources = new MutablePropertySources();
sources.addFirst(new PropertySource<Environment>("env", environment) {
@ -112,8 +112,8 @@ public class ConfigurationPropertySourcesTests {
}
});
sources.addLast(new MapPropertySource("baz",
Collections.<String, Object>singletonMap("baz", "barf")));
sources.addLast(
new MapPropertySource("baz", Collections.singletonMap("baz", "barf")));
Iterable<ConfigurationPropertySource> configurationSources = ConfigurationPropertySources
.from(sources);
assertThat(configurationSources.iterator()).hasSize(5);

@ -53,8 +53,8 @@ public class SpringConfigurationPropertySourcesTests {
@Test
public void shouldAdaptPropertySource() throws Exception {
MutablePropertySources sources = new MutablePropertySources();
sources.addFirst(new MapPropertySource("test",
Collections.<String, Object>singletonMap("a", "b")));
sources.addFirst(
new MapPropertySource("test", Collections.singletonMap("a", "b")));
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(
sources).iterator();
ConfigurationPropertyName name = ConfigurationPropertyName.of("a");
@ -67,7 +67,7 @@ public class SpringConfigurationPropertySourcesTests {
public void shouldAdaptSystemEnvironmentPropertySource() throws Exception {
MutablePropertySources sources = new MutablePropertySources();
sources.addLast(new SystemEnvironmentPropertySource("system",
Collections.<String, Object>singletonMap("SERVER_PORT", "1234")));
Collections.singletonMap("SERVER_PORT", "1234")));
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(
sources).iterator();
ConfigurationPropertyName name = ConfigurationPropertyName.of("server.port");
@ -80,11 +80,11 @@ public class SpringConfigurationPropertySourcesTests {
public void shouldAdaptMultiplePropertySources() throws Exception {
MutablePropertySources sources = new MutablePropertySources();
sources.addLast(new SystemEnvironmentPropertySource("system",
Collections.<String, Object>singletonMap("SERVER_PORT", "1234")));
Collections.singletonMap("SERVER_PORT", "1234")));
sources.addLast(new MapPropertySource("test1",
Collections.<String, Object>singletonMap("server.po-rt", "4567")));
sources.addLast(new MapPropertySource("test2",
Collections.<String, Object>singletonMap("a", "b")));
Collections.singletonMap("server.po-rt", "4567")));
sources.addLast(
new MapPropertySource("test2", Collections.singletonMap("a", "b")));
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(
sources).iterator();
ConfigurationPropertyName name = ConfigurationPropertyName.of("server.port");
@ -101,10 +101,10 @@ public class SpringConfigurationPropertySourcesTests {
@Test
public void shouldFlattenEnvironment() throws Exception {
StandardEnvironment environment = new StandardEnvironment();
environment.getPropertySources().addFirst(new MapPropertySource("foo",
Collections.<String, Object>singletonMap("foo", "bar")));
environment.getPropertySources().addFirst(new MapPropertySource("far",
Collections.<String, Object>singletonMap("far", "far")));
environment.getPropertySources().addFirst(
new MapPropertySource("foo", Collections.singletonMap("foo", "bar")));
environment.getPropertySources().addFirst(
new MapPropertySource("far", Collections.singletonMap("far", "far")));
MutablePropertySources sources = new MutablePropertySources();
sources.addFirst(new PropertySource<Environment>("env", environment) {
@ -114,8 +114,8 @@ public class SpringConfigurationPropertySourcesTests {
}
});
sources.addLast(new MapPropertySource("baz",
Collections.<String, Object>singletonMap("baz", "barf")));
sources.addLast(
new MapPropertySource("baz", Collections.singletonMap("baz", "barf")));
SpringConfigurationPropertySources configurationSources = new SpringConfigurationPropertySources(
sources);
assertThat(configurationSources.iterator()).hasSize(5);
@ -124,11 +124,11 @@ public class SpringConfigurationPropertySourcesTests {
@Test
public void shouldTrackChanges() throws Exception {
MutablePropertySources sources = new MutablePropertySources();
sources.addLast(new MapPropertySource("test1",
Collections.<String, Object>singletonMap("a", "b")));
sources.addLast(
new MapPropertySource("test1", Collections.singletonMap("a", "b")));
assertThat(new SpringConfigurationPropertySources(sources).iterator()).hasSize(1);
sources.addLast(new MapPropertySource("test2",
Collections.<String, Object>singletonMap("b", "c")));
sources.addLast(
new MapPropertySource("test2", Collections.singletonMap("b", "c")));
assertThat(new SpringConfigurationPropertySources(sources).iterator()).hasSize(2);
}

@ -185,8 +185,7 @@ public class RestTemplateBuilderTests {
@Test
public void defaultMessageConvertersShouldSetDefaultList() throws Exception {
RestTemplate template = new RestTemplate(
Collections.<HttpMessageConverter<?>>singletonList(
new StringHttpMessageConverter()));
Collections.singletonList(new StringHttpMessageConverter()));
this.builder.defaultMessageConverters().configure(template);
assertThat(template.getMessageConverters())
.hasSameSizeAs(new RestTemplate().getMessageConverters());
@ -195,8 +194,7 @@ public class RestTemplateBuilderTests {
@Test
public void defaultMessageConvertersShouldClearExisting() throws Exception {
RestTemplate template = new RestTemplate(
Collections.<HttpMessageConverter<?>>singletonList(
new StringHttpMessageConverter()));
Collections.singletonList(new StringHttpMessageConverter()));
this.builder.additionalMessageConverters(this.messageConverter)
.defaultMessageConverters().configure(template);
assertThat(template.getMessageConverters())

@ -138,7 +138,7 @@ public class SpringBootServletInitializerTests {
given(servletContext.getInitParameter("spring.profiles.active"))
.willReturn("from-servlet-context");
given(servletContext.getAttributeNames())
.willReturn(Collections.enumeration(Collections.<String>emptyList()));
.willReturn(Collections.enumeration(Collections.emptyList()));
try (ConfigurableApplicationContext context = (ConfigurableApplicationContext) new PropertySourceVerifyingSpringBootServletInitializer()
.createRootApplicationContext(servletContext)) {
assertThat(context.getEnvironment().getActiveProfiles())

@ -74,7 +74,7 @@ public class SampleAtmosphereApplication {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
onStartup(Collections.<Class<?>>emptySet(), servletContext);
onStartup(Collections.emptySet(), servletContext);
}
}

Loading…
Cancel
Save