Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 AutowiredQualifierFooService implements FooService {
|
||||
|
||||
@Override
|
||||
public Future<String> asyncFoo(int id) {
|
||||
return new AsyncResult<String>(this.fooDao.findFoo(id));
|
||||
return new AsyncResult<>(this.fooDao.findFoo(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 FooServiceImpl implements FooService {
|
||||
public Future<String> asyncFoo(int id) {
|
||||
System.out.println(Thread.currentThread().getName());
|
||||
Assert.state(ServiceInvocationCounter.getThreadLocalCount() != null, "Thread-local counter not exposed");
|
||||
return new AsyncResult<String>(this.fooDao.findFoo(id));
|
||||
return new AsyncResult<>(this.fooDao.findFoo(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 ScopedProxyTestBean implements FooService {
|
||||
|
||||
@Override
|
||||
public Future<String> asyncFoo(int id) {
|
||||
return new AsyncResult<String>("bar");
|
||||
return new AsyncResult<>("bar");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 ServiceInvocationCounter {
|
||||
|
||||
private int useCount;
|
||||
|
||||
private static final ThreadLocal<Integer> threadLocalCount = new ThreadLocal<Integer>();
|
||||
private static final ThreadLocal<Integer> threadLocalCount = new ThreadLocal<>();
|
||||
|
||||
|
||||
@Pointcut("execution(* example.scannable.FooService+.*(..))")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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,19 +105,19 @@ public final class AfterReturningGenericTypeMatchingTests {
|
||||
class GenericReturnTypeVariationClass {
|
||||
|
||||
public Collection<String> getStrings() {
|
||||
return new ArrayList<String>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Collection<Integer> getIntegers() {
|
||||
return new ArrayList<Integer>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Collection<TestBean> getTestBeans() {
|
||||
return new ArrayList<TestBean>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Collection<Employee> getEmployees() {
|
||||
return new ArrayList<Employee>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -923,7 +923,7 @@ public abstract class AbstractAopProxyTests {
|
||||
pf2.addAdvisor(new DefaultIntroductionAdvisor(new TimestampIntroductionInterceptor()));
|
||||
ITestBean proxy2 = (ITestBean) createProxy(pf2);
|
||||
|
||||
HashMap<ITestBean, Object> h = new HashMap<ITestBean, Object>();
|
||||
HashMap<ITestBean, Object> h = new HashMap<>();
|
||||
Object value1 = "foo";
|
||||
Object value2 = "bar";
|
||||
assertNull(h.get(proxy1));
|
||||
@@ -1178,7 +1178,7 @@ public abstract class AbstractAopProxyTests {
|
||||
};
|
||||
|
||||
class NameSaver implements MethodInterceptor {
|
||||
private List<Object> names = new LinkedList<Object>();
|
||||
private List<Object> names = new LinkedList<>();
|
||||
|
||||
@Override
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
@@ -1357,17 +1357,17 @@ public abstract class AbstractAopProxyTests {
|
||||
}
|
||||
};
|
||||
AdvisedSupport pc = new AdvisedSupport(ITestBean.class);
|
||||
MapAwareMethodInterceptor mami1 = new MapAwareMethodInterceptor(new HashMap<String, String>(), new HashMap<String, String>());
|
||||
Map<String, String> firstValuesToAdd = new HashMap<String, String>();
|
||||
MapAwareMethodInterceptor mami1 = new MapAwareMethodInterceptor(new HashMap<>(), new HashMap<String, String>());
|
||||
Map<String, String> firstValuesToAdd = new HashMap<>();
|
||||
firstValuesToAdd.put("test", "");
|
||||
MapAwareMethodInterceptor mami2 = new MapAwareMethodInterceptor(new HashMap<String, String>(), firstValuesToAdd);
|
||||
MapAwareMethodInterceptor mami3 = new MapAwareMethodInterceptor(firstValuesToAdd, new HashMap<String, String>());
|
||||
MapAwareMethodInterceptor mami4 = new MapAwareMethodInterceptor(firstValuesToAdd, new HashMap<String, String>());
|
||||
Map<String, String> secondValuesToAdd = new HashMap<String, String>();
|
||||
MapAwareMethodInterceptor mami2 = new MapAwareMethodInterceptor(new HashMap<>(), firstValuesToAdd);
|
||||
MapAwareMethodInterceptor mami3 = new MapAwareMethodInterceptor(firstValuesToAdd, new HashMap<>());
|
||||
MapAwareMethodInterceptor mami4 = new MapAwareMethodInterceptor(firstValuesToAdd, new HashMap<>());
|
||||
Map<String, String> secondValuesToAdd = new HashMap<>();
|
||||
secondValuesToAdd.put("foo", "bar");
|
||||
secondValuesToAdd.put("cat", "dog");
|
||||
MapAwareMethodInterceptor mami5 = new MapAwareMethodInterceptor(firstValuesToAdd, secondValuesToAdd);
|
||||
Map<String, String> finalExpected = new HashMap<String, String>(firstValuesToAdd);
|
||||
Map<String, String> finalExpected = new HashMap<>(firstValuesToAdd);
|
||||
finalExpected.putAll(secondValuesToAdd);
|
||||
MapAwareMethodInterceptor mami6 = new MapAwareMethodInterceptor(finalExpected, secondValuesToAdd);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -714,7 +714,7 @@ public final class ProxyFactoryBeanTests {
|
||||
@SuppressWarnings("serial")
|
||||
public static class PointcutForVoid extends DefaultPointcutAdvisor {
|
||||
|
||||
public static List<String> methodNames = new LinkedList<String>();
|
||||
public static List<String> methodNames = new LinkedList<>();
|
||||
|
||||
public static void reset() {
|
||||
methodNames.clear();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 CacheTestUtils {
|
||||
*/
|
||||
public static CacheManager createSimpleCacheManager(String... cacheNames) {
|
||||
SimpleCacheManager result = new SimpleCacheManager();
|
||||
List<Cache> caches = new ArrayList<Cache>();
|
||||
List<Cache> caches = new ArrayList<>();
|
||||
for (String cacheName : cacheNames) {
|
||||
caches.add(new ConcurrentMapCache(cacheName));
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ public class ConfigurationClassPostProcessorTests {
|
||||
|
||||
@Bean
|
||||
public Repository<Object> genericRepo() {
|
||||
return new GenericRepository<Object>();
|
||||
return new GenericRepository<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -918,12 +918,12 @@ public class ConfigurationClassPostProcessorTests {
|
||||
|
||||
@Bean
|
||||
public Repository<? extends String> stringRepo() {
|
||||
return new Repository<String>();
|
||||
return new Repository<>();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Repository<? extends Number> numberRepo() {
|
||||
return new Repository<Number>();
|
||||
return new Repository<>();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -942,7 +942,7 @@ public class ConfigurationClassPostProcessorTests {
|
||||
|
||||
@Bean
|
||||
public Repository<? extends Number> numberRepo() {
|
||||
return new Repository<Number>();
|
||||
return new Repository<>();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -185,7 +185,7 @@ public class ConfigurationWithFactoryBeanAndAutowiringTests {
|
||||
@Bean
|
||||
public MyParameterizedFactoryBean<String> factoryBean() {
|
||||
Assert.notNull(dummyBean, "DummyBean was not injected.");
|
||||
return new MyParameterizedFactoryBean<String>("whatev");
|
||||
return new MyParameterizedFactoryBean<>("whatev");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 @@ import static org.mockito.Mockito.*;
|
||||
@SuppressWarnings("resource")
|
||||
public class ImportSelectorTests {
|
||||
|
||||
static Map<Class<?>, String> importFrom = new HashMap<Class<?>, String>();
|
||||
static Map<Class<?>, String> importFrom = new HashMap<>();
|
||||
|
||||
|
||||
@BeforeClass
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -163,8 +163,8 @@ public class Spr3775InitDestroyLifecycleTests {
|
||||
|
||||
public static class InitDestroyBean {
|
||||
|
||||
final List<String> initMethods = new ArrayList<String>();
|
||||
final List<String> destroyMethods = new ArrayList<String>();
|
||||
final List<String> initMethods = new ArrayList<>();
|
||||
final List<String> destroyMethods = new ArrayList<>();
|
||||
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
@@ -193,8 +193,8 @@ public class Spr3775InitDestroyLifecycleTests {
|
||||
|
||||
public static class CustomInitDestroyBean {
|
||||
|
||||
final List<String> initMethods = new ArrayList<String>();
|
||||
final List<String> destroyMethods = new ArrayList<String>();
|
||||
final List<String> initMethods = new ArrayList<>();
|
||||
final List<String> destroyMethods = new ArrayList<>();
|
||||
|
||||
public void customInit() throws Exception {
|
||||
this.initMethods.add("customInit");
|
||||
@@ -253,8 +253,8 @@ public class Spr3775InitDestroyLifecycleTests {
|
||||
|
||||
public static class AllInOneBean implements InitializingBean, DisposableBean {
|
||||
|
||||
final List<String> initMethods = new ArrayList<String>();
|
||||
final List<String> destroyMethods = new ArrayList<String>();
|
||||
final List<String> initMethods = new ArrayList<>();
|
||||
final List<String> destroyMethods = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
@PostConstruct
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -330,7 +330,7 @@ public class ScopingTests {
|
||||
|
||||
public boolean createNewScope = true;
|
||||
|
||||
private Map<String, Object> beans = new HashMap<String, Object>();
|
||||
private Map<String, Object> beans = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public Object get(String name, ObjectFactory<?> objectFactory) {
|
||||
|
||||
@@ -415,7 +415,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
|
||||
|
||||
public static class MyOrderedListener1 implements ApplicationListener<ApplicationEvent>, Ordered {
|
||||
|
||||
public final Set<ApplicationEvent> seenEvents = new HashSet<ApplicationEvent>();
|
||||
public final Set<ApplicationEvent> seenEvents = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
@@ -459,7 +459,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
|
||||
|
||||
public static class MyPayloadListener implements ApplicationListener<PayloadApplicationEvent> {
|
||||
|
||||
public final Set<Object> seenPayloads = new HashSet<Object>();
|
||||
public final Set<Object> seenPayloads = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(PayloadApplicationEvent event) {
|
||||
@@ -470,7 +470,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
|
||||
|
||||
public static class MyNonSingletonListener implements ApplicationListener<ApplicationEvent> {
|
||||
|
||||
public static final Set<ApplicationEvent> seenEvents = new HashSet<ApplicationEvent>();
|
||||
public static final Set<ApplicationEvent> seenEvents = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
@@ -482,7 +482,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
|
||||
@Order(5)
|
||||
public static class MyOrderedListener3 implements ApplicationListener<ApplicationEvent> {
|
||||
|
||||
public final Set<ApplicationEvent> seenEvents = new HashSet<ApplicationEvent>();
|
||||
public final Set<ApplicationEvent> seenEvents = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 MapAccessorTests {
|
||||
}
|
||||
|
||||
public static class MapGetter {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
|
||||
public MapGetter() {
|
||||
map.put("foo", "bar");
|
||||
@@ -82,15 +82,15 @@ public class MapAccessorTests {
|
||||
}
|
||||
|
||||
public Map<String,Object> getSimpleTestMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("foo","bar");
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<String,Map<String,Object>> getNestedTestMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("foo","bar");
|
||||
Map<String,Map<String,Object>> map2 = new HashMap<String,Map<String,Object>>();
|
||||
Map<String,Map<String,Object>> map2 = new HashMap<>();
|
||||
map2.put("aaa", map);
|
||||
return map2;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 ConversionServiceFactoryBeanTests {
|
||||
@Test
|
||||
public void createDefaultConversionServiceWithSupplements() {
|
||||
ConversionServiceFactoryBean factory = new ConversionServiceFactoryBean();
|
||||
Set<Object> converters = new HashSet<Object>();
|
||||
Set<Object> converters = new HashSet<>();
|
||||
converters.add(new Converter<String, Foo>() {
|
||||
@Override
|
||||
public Foo convert(String source) {
|
||||
@@ -94,7 +94,7 @@ public class ConversionServiceFactoryBeanTests {
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void createDefaultConversionServiceWithInvalidSupplements() {
|
||||
ConversionServiceFactoryBean factory = new ConversionServiceFactoryBean();
|
||||
Set<Object> converters = new HashSet<Object>();
|
||||
Set<Object> converters = new HashSet<>();
|
||||
converters.add("bogus");
|
||||
factory.setConverters(converters);
|
||||
factory.afterPropertiesSet();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void singleSmartLifecycleAutoStartup() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean bean = TestSmartLifecycleBean.forStartupTests(1, startedBeans);
|
||||
bean.setAutoStartup(true);
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
@@ -105,7 +105,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void singleSmartLifecycleWithoutAutoStartup() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean bean = TestSmartLifecycleBean.forStartupTests(1, startedBeans);
|
||||
bean.setAutoStartup(false);
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
@@ -122,7 +122,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void singleSmartLifecycleAutoStartupWithNonAutoStartupDependency() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean bean = TestSmartLifecycleBean.forStartupTests(1, startedBeans);
|
||||
bean.setAutoStartup(true);
|
||||
TestSmartLifecycleBean dependency = TestSmartLifecycleBean.forStartupTests(1, startedBeans);
|
||||
@@ -144,7 +144,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void smartLifecycleGroupStartup() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean beanMin = TestSmartLifecycleBean.forStartupTests(Integer.MIN_VALUE, startedBeans);
|
||||
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forStartupTests(1, startedBeans);
|
||||
TestSmartLifecycleBean bean2 = TestSmartLifecycleBean.forStartupTests(2, startedBeans);
|
||||
@@ -178,7 +178,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void contextRefreshThenStartWithMixedBeans() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<>();
|
||||
TestLifecycleBean simpleBean1 = TestLifecycleBean.forStartupTests(startedBeans);
|
||||
TestLifecycleBean simpleBean2 = TestLifecycleBean.forStartupTests(startedBeans);
|
||||
TestSmartLifecycleBean smartBean1 = TestSmartLifecycleBean.forStartupTests(5, startedBeans);
|
||||
@@ -212,7 +212,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void contextRefreshThenStopAndRestartWithMixedBeans() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<>();
|
||||
TestLifecycleBean simpleBean1 = TestLifecycleBean.forStartupTests(startedBeans);
|
||||
TestLifecycleBean simpleBean2 = TestLifecycleBean.forStartupTests(startedBeans);
|
||||
TestSmartLifecycleBean smartBean1 = TestSmartLifecycleBean.forStartupTests(5, startedBeans);
|
||||
@@ -255,7 +255,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
public void smartLifecycleGroupShutdown() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forShutdownTests(1, 300, stoppedBeans);
|
||||
TestSmartLifecycleBean bean2 = TestSmartLifecycleBean.forShutdownTests(3, 100, stoppedBeans);
|
||||
TestSmartLifecycleBean bean3 = TestSmartLifecycleBean.forShutdownTests(1, 600, stoppedBeans);
|
||||
@@ -286,7 +286,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
public void singleSmartLifecycleShutdown() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean bean = TestSmartLifecycleBean.forShutdownTests(99, 300, stoppedBeans);
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
context.getBeanFactory().registerSingleton("bean", bean);
|
||||
@@ -300,7 +300,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void singleLifecycleShutdown() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
Lifecycle bean = new TestLifecycleBean(null, stoppedBeans);
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
context.getBeanFactory().registerSingleton("bean", bean);
|
||||
@@ -316,7 +316,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void mixedShutdown() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
Lifecycle bean1 = TestLifecycleBean.forShutdownTests(stoppedBeans);
|
||||
Lifecycle bean2 = TestSmartLifecycleBean.forShutdownTests(500, 200, stoppedBeans);
|
||||
Lifecycle bean3 = TestSmartLifecycleBean.forShutdownTests(Integer.MAX_VALUE, 100, stoppedBeans);
|
||||
@@ -364,7 +364,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void dependencyStartedFirstEvenIfItsPhaseIsHigher() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean beanMin = TestSmartLifecycleBean.forStartupTests(Integer.MIN_VALUE, startedBeans);
|
||||
TestSmartLifecycleBean bean2 = TestSmartLifecycleBean.forStartupTests(2, startedBeans);
|
||||
TestSmartLifecycleBean bean99 = TestSmartLifecycleBean.forStartupTests(99, startedBeans);
|
||||
@@ -394,7 +394,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
public void dependentShutdownFirstEvenIfItsPhaseIsLower() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean beanMin = TestSmartLifecycleBean.forShutdownTests(Integer.MIN_VALUE, 100, stoppedBeans);
|
||||
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forShutdownTests(1, 200, stoppedBeans);
|
||||
TestSmartLifecycleBean bean99 = TestSmartLifecycleBean.forShutdownTests(99, 100, stoppedBeans);
|
||||
@@ -436,7 +436,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void dependencyStartedFirstAndIsSmartLifecycle() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean beanNegative = TestSmartLifecycleBean.forStartupTests(-99, startedBeans);
|
||||
TestSmartLifecycleBean bean99 = TestSmartLifecycleBean.forStartupTests(99, startedBeans);
|
||||
TestSmartLifecycleBean bean7 = TestSmartLifecycleBean.forStartupTests(7, startedBeans);
|
||||
@@ -468,7 +468,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
public void dependentShutdownFirstAndIsSmartLifecycle() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean beanMin = TestSmartLifecycleBean.forShutdownTests(Integer.MIN_VALUE, 400, stoppedBeans);
|
||||
TestSmartLifecycleBean beanNegative = TestSmartLifecycleBean.forShutdownTests(-99, 100, stoppedBeans);
|
||||
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forShutdownTests(1, 200, stoppedBeans);
|
||||
@@ -509,7 +509,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
|
||||
@Test
|
||||
public void dependencyStartedFirstButNotSmartLifecycle() throws Exception {
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> startedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean beanMin = TestSmartLifecycleBean.forStartupTests(Integer.MIN_VALUE, startedBeans);
|
||||
TestSmartLifecycleBean bean7 = TestSmartLifecycleBean.forStartupTests(7, startedBeans);
|
||||
TestLifecycleBean simpleBean = TestLifecycleBean.forStartupTests(startedBeans);
|
||||
@@ -533,7 +533,7 @@ public class DefaultLifecycleProcessorTests {
|
||||
public void dependentShutdownFirstButNotSmartLifecycle() throws Exception {
|
||||
Assume.group(TestGroup.PERFORMANCE);
|
||||
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<Lifecycle>();
|
||||
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
|
||||
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forShutdownTests(1, 200, stoppedBeans);
|
||||
TestLifecycleBean simpleBean = TestLifecycleBean.forShutdownTests(stoppedBeans);
|
||||
TestSmartLifecycleBean bean2 = TestSmartLifecycleBean.forShutdownTests(2, 300, stoppedBeans);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 StaticApplicationContextMulticasterTests extends AbstractApplicatio
|
||||
@Override
|
||||
protected ConfigurableApplicationContext createContext() throws Exception {
|
||||
StaticApplicationContext parent = new StaticApplicationContext();
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
Map<String, String> m = new HashMap<>();
|
||||
m.put("name", "Roderick");
|
||||
parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m));
|
||||
m.put("name", "Albert");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 StaticApplicationContextTests extends AbstractApplicationContextTes
|
||||
@Override
|
||||
protected ConfigurableApplicationContext createContext() throws Exception {
|
||||
StaticApplicationContext parent = new StaticApplicationContext();
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
Map<String, String> m = new HashMap<>();
|
||||
m.put("name", "Roderick");
|
||||
parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m));
|
||||
m.put("name", "Albert");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -191,7 +191,7 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
|
||||
protected ConfigurableApplicationContext createContext() throws Exception {
|
||||
StaticApplicationContext parent = new StaticApplicationContext();
|
||||
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
Map<String, String> m = new HashMap<>();
|
||||
m.put("name", "Roderick");
|
||||
parent.registerPrototype("rod", org.springframework.tests.sample.beans.TestBean.class, new MutablePropertyValues(m));
|
||||
m.put("name", "Albert");
|
||||
@@ -214,7 +214,7 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
|
||||
sac.addApplicationListener(listener);
|
||||
|
||||
StaticMessageSource messageSource = sac.getStaticMessageSource();
|
||||
Map<String, String> usMessages = new HashMap<String, String>(3);
|
||||
Map<String, String> usMessages = new HashMap<>(3);
|
||||
usMessages.put("message.format.example1", MSG_TXT1_US);
|
||||
usMessages.put("message.format.example2", MSG_TXT2_US);
|
||||
usMessages.put("message.format.example3", MSG_TXT3_US);
|
||||
|
||||
@@ -260,7 +260,7 @@ public class DateFormattingTests {
|
||||
@DateTimeFormat(iso=ISO.DATE_TIME)
|
||||
private Date isoDateTime;
|
||||
|
||||
private final List<SimpleDateBean> children = new ArrayList<SimpleDateBean>();
|
||||
private final List<SimpleDateBean> children = new ArrayList<>();
|
||||
|
||||
public Long getMillis() {
|
||||
return millis;
|
||||
|
||||
@@ -570,7 +570,7 @@ public class JodaTimeFormattingTests {
|
||||
|
||||
private MonthDay monthDay;
|
||||
|
||||
private final List<JodaTimeBean> children = new ArrayList<JodaTimeBean>();
|
||||
private final List<JodaTimeBean> children = new ArrayList<>();
|
||||
|
||||
public LocalDate getLocalDate() {
|
||||
return localDate;
|
||||
|
||||
@@ -421,7 +421,7 @@ public class DateTimeFormattingTests {
|
||||
|
||||
private MonthDay monthDay;
|
||||
|
||||
private final List<DateTimeBean> children = new ArrayList<DateTimeBean>();
|
||||
private final List<DateTimeBean> children = new ArrayList<>();
|
||||
|
||||
public LocalDate getLocalDate() {
|
||||
return localDate;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 class FormattingConversionServiceFactoryBeanTests {
|
||||
@Test
|
||||
public void testCustomFormatter() throws Exception {
|
||||
FormattingConversionServiceFactoryBean factory = new FormattingConversionServiceFactoryBean();
|
||||
Set<Object> formatters = new HashSet<Object>();
|
||||
Set<Object> formatters = new HashSet<>();
|
||||
formatters.add(new TestBeanFormatter());
|
||||
formatters.add(new SpecialIntAnnotationFormatterFactory());
|
||||
factory.setFormatters(formatters);
|
||||
@@ -105,7 +105,7 @@ public class FormattingConversionServiceFactoryBeanTests {
|
||||
@Test
|
||||
public void testFormatterRegistrar() throws Exception {
|
||||
FormattingConversionServiceFactoryBean factory = new FormattingConversionServiceFactoryBean();
|
||||
Set<FormatterRegistrar> registrars = new HashSet<FormatterRegistrar>();
|
||||
Set<FormatterRegistrar> registrars = new HashSet<>();
|
||||
registrars.add(new TestFormatterRegistrar());
|
||||
factory.setFormatterRegistrars(registrars);
|
||||
factory.afterPropertiesSet();
|
||||
@@ -119,7 +119,7 @@ public class FormattingConversionServiceFactoryBeanTests {
|
||||
@Test
|
||||
public void testInvalidFormatter() throws Exception {
|
||||
FormattingConversionServiceFactoryBean factory = new FormattingConversionServiceFactoryBean();
|
||||
Set<Object> formatters = new HashSet<Object>();
|
||||
Set<Object> formatters = new HashSet<>();
|
||||
formatters.add(new Object());
|
||||
factory.setFormatters(formatters);
|
||||
try {
|
||||
@@ -174,7 +174,7 @@ public class FormattingConversionServiceFactoryBeanTests {
|
||||
|
||||
private static class SpecialIntAnnotationFormatterFactory implements AnnotationFormatterFactory<SpecialInt> {
|
||||
|
||||
private final Set<Class<?>> fieldTypes = new HashSet<Class<?>>(1);
|
||||
private final Set<Class<?>> fieldTypes = new HashSet<>(1);
|
||||
|
||||
public SpecialIntAnnotationFormatterFactory() {
|
||||
fieldTypes.add(Integer.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -205,7 +205,7 @@ public class FormattingConversionServiceTests {
|
||||
new TypeDescriptor(modelClass.getField("date"))));
|
||||
assertEquals(new LocalDate(2009, 10, 31), date);
|
||||
|
||||
List<Date> dates = new ArrayList<Date>();
|
||||
List<Date> dates = new ArrayList<>();
|
||||
dates.add(new LocalDate(2009, 10, 31).toDateTimeAtCurrentTime().toDate());
|
||||
dates.add(new LocalDate(2009, 11, 1).toDateTimeAtCurrentTime().toDate());
|
||||
dates.add(new LocalDate(2009, 11, 2).toDateTimeAtCurrentTime().toDate());
|
||||
|
||||
@@ -67,7 +67,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
||||
target.setName("Rob Harrop");
|
||||
|
||||
MBeanExporter adapter = new MBeanExporter();
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(OBJECT_NAME, target);
|
||||
adapter.setServer(getServer());
|
||||
adapter.setBeans(beans);
|
||||
|
||||
@@ -79,7 +79,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
@Test
|
||||
public void testRegisterNullNotificationListenerType() throws Exception {
|
||||
Map<String, NotificationListener> listeners = new HashMap<String, NotificationListener>();
|
||||
Map<String, NotificationListener> listeners = new HashMap<>();
|
||||
// put null in as a value...
|
||||
listeners.put("*", null);
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
@@ -90,7 +90,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
@Test
|
||||
public void testRegisterNotificationListenerForNonExistentMBean() throws Exception {
|
||||
Map<String, NotificationListener> listeners = new HashMap<String, NotificationListener>();
|
||||
Map<String, NotificationListener> listeners = new HashMap<>();
|
||||
NotificationListener dummyListener = new NotificationListener() {
|
||||
@Override
|
||||
public void handleNotification(Notification notification, Object handback) {
|
||||
@@ -130,7 +130,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
@Test
|
||||
public void testUserCreatedMBeanRegWithDynamicMBean() throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("spring:name=dynBean", new TestDynamicMBean());
|
||||
|
||||
InvokeDetectAssembler asm = new InvokeDetectAssembler();
|
||||
@@ -249,7 +249,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
IJmxTestBean proxy = (IJmxTestBean) factory.getProxy();
|
||||
String name = "bean:mmm=whatever";
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(name, proxy);
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
@@ -268,7 +268,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
SelfNamingTestBean testBean = new SelfNamingTestBean();
|
||||
testBean.setObjectName(objectName);
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put("foo", testBean);
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
@@ -295,7 +295,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
String objectName2 = "spring:test=equalBean";
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName.toString(), springRegistered);
|
||||
beans.put(objectName2, springRegistered);
|
||||
|
||||
@@ -327,7 +327,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
Person springRegistered = new Person();
|
||||
springRegistered.setName("Sally Greenwood");
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName.toString(), springRegistered);
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
@@ -353,7 +353,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
bean.setName(name);
|
||||
ObjectName objectName = ObjectNameManager.getInstance("spring:type=Test");
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName.toString(), bean);
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
@@ -383,7 +383,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
factory.registerSingleton(exportedBeanName, new TestBean());
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
Map<String, Object> beansToExport = new HashMap<String, Object>();
|
||||
Map<String, Object> beansToExport = new HashMap<>();
|
||||
beansToExport.put(OBJECT_NAME, exportedBeanName);
|
||||
exporter.setBeans(beansToExport);
|
||||
exporter.setServer(getServer());
|
||||
@@ -470,7 +470,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
exporter.setServer(getServer());
|
||||
Map<String, Object> beansToExport = new HashMap<String, Object>();
|
||||
Map<String, Object> beansToExport = new HashMap<>();
|
||||
beansToExport.put(OBJECT_NAME, OBJECT_NAME);
|
||||
exporter.setBeans(beansToExport);
|
||||
exporter.setAssembler(new NamedBeanAutodetectCapableMBeanInfoAssemblerStub(OBJECT_NAME));
|
||||
@@ -526,7 +526,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
@Test
|
||||
public void testNotRunningInBeanFactoryAndPassedBeanNameToExport() throws Exception {
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(OBJECT_NAME, "beanName");
|
||||
exporter.setBeans(beans);
|
||||
thrown.expect(MBeanExportException.class);
|
||||
@@ -576,7 +576,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
exporter.setServer(getServer());
|
||||
Map<String, Object> beansToExport = new HashMap<String, Object>();
|
||||
Map<String, Object> beansToExport = new HashMap<>();
|
||||
beansToExport.put("test:what=ever", testBeanInstance);
|
||||
exporter.setBeans(beansToExport);
|
||||
exporter.setBeanFactory(factory);
|
||||
@@ -598,7 +598,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
exporter.setServer(getServer());
|
||||
Map<String, Object> beansToExport = new HashMap<String, Object>();
|
||||
Map<String, Object> beansToExport = new HashMap<>();
|
||||
beansToExport.put("test:what=ever", testBeanInstance);
|
||||
exporter.setBeans(beansToExport);
|
||||
exporter.setBeanFactory(factory);
|
||||
@@ -626,7 +626,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
exporter.setServer(getServer());
|
||||
Map<String, Object> beansToExport = new HashMap<String, Object>();
|
||||
Map<String, Object> beansToExport = new HashMap<>();
|
||||
beansToExport.put(objectName1, objectName1);
|
||||
beansToExport.put(objectName2, objectName2);
|
||||
exporter.setBeans(beansToExport);
|
||||
@@ -672,7 +672,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
}
|
||||
|
||||
private Map<String, Object> getBeanMap() {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(OBJECT_NAME, new JmxTestBean());
|
||||
return map;
|
||||
}
|
||||
@@ -700,9 +700,9 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
private static class MockMBeanExporterListener implements MBeanExporterListener {
|
||||
|
||||
private List<ObjectName> registered = new ArrayList<ObjectName>();
|
||||
private List<ObjectName> registered = new ArrayList<>();
|
||||
|
||||
private List<ObjectName> unregistered = new ArrayList<ObjectName>();
|
||||
private List<ObjectName> unregistered = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void mbeanRegistered(ObjectName objectName) {
|
||||
@@ -762,7 +762,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
|
||||
|
||||
public static final class StubNotificationListener implements NotificationListener {
|
||||
|
||||
private List<Notification> notifications = new ArrayList<Notification>();
|
||||
private List<Notification> notifications = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void handleNotification(Notification notification, Object handback) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
ObjectName objectName = ObjectName.getInstance("spring:name=Test");
|
||||
JmxTestBean bean = new JmxTestBean();
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName.getCanonicalName(), bean);
|
||||
|
||||
CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();
|
||||
@@ -76,7 +76,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
ObjectName objectName = ObjectName.getInstance("spring:name=Test");
|
||||
JmxTestBean bean = new JmxTestBean();
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName.getCanonicalName(), bean);
|
||||
|
||||
CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();
|
||||
@@ -101,7 +101,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
String objectName = "spring:name=Test";
|
||||
JmxTestBean bean = new JmxTestBean();
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName, bean);
|
||||
|
||||
CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();
|
||||
@@ -132,7 +132,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
ObjectName objectName = ObjectName.getInstance("spring:name=Test");
|
||||
JmxTestBean bean = new JmxTestBean();
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName.getCanonicalName(), bean);
|
||||
|
||||
CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();
|
||||
@@ -159,7 +159,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
ObjectName objectName = ObjectName.getInstance("spring:name=Test");
|
||||
JmxTestBean bean = new JmxTestBean();
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName.getCanonicalName(), bean);
|
||||
|
||||
CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();
|
||||
@@ -218,7 +218,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
|
||||
factory.registerSingleton(beanName, testBean);
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(beanName, beanName);
|
||||
|
||||
Map listenerMappings = new HashMap();
|
||||
@@ -249,7 +249,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
|
||||
factory.registerSingleton(beanName, testBean);
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(beanName, testBean);
|
||||
|
||||
Map listenerMappings = new HashMap();
|
||||
@@ -280,7 +280,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
|
||||
factory.registerSingleton(beanName, testBean);
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(beanName, testBean);
|
||||
|
||||
Map listenerMappings = new HashMap();
|
||||
@@ -312,7 +312,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
|
||||
factory.registerSingleton(beanName, testBean);
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(beanName, testBean);
|
||||
|
||||
Map listenerMappings = new HashMap();
|
||||
@@ -351,7 +351,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
factory.registerSingleton(beanName1, testBean1);
|
||||
factory.registerSingleton(beanName2, testBean2);
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(beanName1, testBean1);
|
||||
beans.put(beanName2, testBean2);
|
||||
|
||||
@@ -381,7 +381,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
ObjectName objectName = ObjectName.getInstance("spring:name=Test");
|
||||
JmxTestBean bean = new JmxTestBean();
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName.getCanonicalName(), bean);
|
||||
|
||||
MBeanExporter exporter = new MBeanExporter();
|
||||
@@ -416,7 +416,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
JmxTestBean bean = new JmxTestBean();
|
||||
JmxTestBean bean2 = new JmxTestBean();
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName.getCanonicalName(), bean);
|
||||
beans.put(objectName2.getCanonicalName(), bean2);
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
|
||||
|
||||
String objectName = "spring:bean=test,proxy=true";
|
||||
|
||||
Map<String, Object> beans = new HashMap<String, Object>();
|
||||
Map<String, Object> beans = new HashMap<>();
|
||||
beans.put(objectName, proxy);
|
||||
exporter.setBeans(beans);
|
||||
start(exporter);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 SimpleNamingContextTests {
|
||||
assertTrue("Correct DataSource registered", context1.lookup("java:comp/env/jdbc/myds") == ds);
|
||||
assertTrue("Correct Object registered", context1.lookup("myobject") == obj);
|
||||
|
||||
Hashtable<String, String> env2 = new Hashtable<String, String>();
|
||||
Hashtable<String, String> env2 = new Hashtable<>();
|
||||
env2.put("key1", "value1");
|
||||
Context context2 = factory.getInitialContext(env2);
|
||||
assertTrue("Correct DataSource registered", context2.lookup("java:comp/env/jdbc/myds") == ds);
|
||||
@@ -116,7 +116,7 @@ public class SimpleNamingContextTests {
|
||||
assertTrue("Correct Integer registered", context3.lookup("myinteger") == i);
|
||||
assertTrue("Correct String registered", context3.lookup("mystring") == s);
|
||||
|
||||
Map<String, Binding> bindingMap = new HashMap<String, Binding>();
|
||||
Map<String, Binding> bindingMap = new HashMap<>();
|
||||
NamingEnumeration<?> bindingEnum = context3.listBindings("");
|
||||
while (bindingEnum.hasMoreElements()) {
|
||||
Binding binding = (Binding) bindingEnum.nextElement();
|
||||
@@ -127,7 +127,7 @@ public class SimpleNamingContextTests {
|
||||
|
||||
Context jdbcContext = (Context) context3.lookup("jdbc");
|
||||
jdbcContext.bind("mydsX", ds);
|
||||
Map<String, Binding> subBindingMap = new HashMap<String, Binding>();
|
||||
Map<String, Binding> subBindingMap = new HashMap<>();
|
||||
NamingEnumeration<?> subBindingEnum = jdbcContext.listBindings("");
|
||||
while (subBindingEnum.hasMoreElements()) {
|
||||
Binding binding = (Binding) subBindingEnum.nextElement();
|
||||
@@ -145,7 +145,7 @@ public class SimpleNamingContextTests {
|
||||
|
||||
context1.createSubcontext("jdbc").bind("sub/subds", ds);
|
||||
|
||||
Map<String, String> pairMap = new HashMap<String, String>();
|
||||
Map<String, String> pairMap = new HashMap<>();
|
||||
NamingEnumeration<?> pairEnum = context2.list("jdbc");
|
||||
while (pairEnum.hasMore()) {
|
||||
NameClassPair pair = (NameClassPair) pairEnum.next();
|
||||
@@ -154,7 +154,7 @@ public class SimpleNamingContextTests {
|
||||
assertTrue("Correct sub subcontext", SimpleNamingContext.class.getName().equals(pairMap.get("sub")));
|
||||
|
||||
Context subContext = (Context) context2.lookup("jdbc/sub");
|
||||
Map<String, String> subPairMap = new HashMap<String, String>();
|
||||
Map<String, String> subPairMap = new HashMap<>();
|
||||
NamingEnumeration<?> subPairEnum = subContext.list("");
|
||||
while (subPairEnum.hasMoreElements()) {
|
||||
NameClassPair pair = (NameClassPair) subPairEnum.next();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -454,7 +454,7 @@ public class AsyncExecutionTests {
|
||||
else if (i < 0) {
|
||||
return AsyncResult.forExecutionException(new IOException());
|
||||
}
|
||||
return new AsyncResult<String>(Integer.toString(i));
|
||||
return new AsyncResult<>(Integer.toString(i));
|
||||
}
|
||||
|
||||
@Async
|
||||
@@ -494,13 +494,13 @@ public class AsyncExecutionTests {
|
||||
public Future<String> returnSomething(int i) {
|
||||
assertTrue(!Thread.currentThread().getName().equals(originalThreadName));
|
||||
assertTrue(Thread.currentThread().getName().startsWith("e2-"));
|
||||
return new AsyncResult<String>(Integer.toString(i));
|
||||
return new AsyncResult<>(Integer.toString(i));
|
||||
}
|
||||
|
||||
public Future<String> returnSomething2(int i) {
|
||||
assertTrue(!Thread.currentThread().getName().equals(originalThreadName));
|
||||
assertTrue(Thread.currentThread().getName().startsWith("e0-"));
|
||||
return new AsyncResult<String>(Integer.toString(i));
|
||||
return new AsyncResult<>(Integer.toString(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ public class AsyncExecutionTests {
|
||||
if (i == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
return new AsyncResult<String>(Integer.toString(i));
|
||||
return new AsyncResult<>(Integer.toString(i));
|
||||
}
|
||||
|
||||
public ListenableFuture<String> returnSomethingListenable(int i) {
|
||||
@@ -536,7 +536,7 @@ public class AsyncExecutionTests {
|
||||
if (i == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
return new AsyncResult<String>(Integer.toString(i));
|
||||
return new AsyncResult<>(Integer.toString(i));
|
||||
}
|
||||
|
||||
@Async
|
||||
@@ -571,7 +571,7 @@ public class AsyncExecutionTests {
|
||||
|
||||
public Future<String> returnSomething(int i) {
|
||||
assertTrue(!Thread.currentThread().getName().equals(originalThreadName));
|
||||
return new AsyncResult<String>(Integer.toString(i));
|
||||
return new AsyncResult<>(Integer.toString(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ public class AsyncExecutionTests {
|
||||
@Override
|
||||
public Future<String> returnSomething(int i) {
|
||||
assertTrue(!Thread.currentThread().getName().equals(originalThreadName));
|
||||
return new AsyncResult<String>(Integer.toString(i));
|
||||
return new AsyncResult<>(Integer.toString(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ public class AsyncExecutionTests {
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
assertTrue(!Thread.currentThread().getName().equals(originalThreadName));
|
||||
if (Future.class.equals(invocation.getMethod().getReturnType())) {
|
||||
return new AsyncResult<String>(invocation.getArguments()[0].toString());
|
||||
return new AsyncResult<>(invocation.getArguments()[0].toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -665,7 +665,7 @@ public class AsyncExecutionTests {
|
||||
@Override
|
||||
public Future<String> returnSomething(int i) {
|
||||
assertTrue(!Thread.currentThread().getName().equals(originalThreadName));
|
||||
return new AsyncResult<String>(Integer.toString(i));
|
||||
return new AsyncResult<>(Integer.toString(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,7 +681,7 @@ public class AsyncExecutionTests {
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
assertTrue(!Thread.currentThread().getName().equals(originalThreadName));
|
||||
if (Future.class.equals(invocation.getMethod().getReturnType())) {
|
||||
return new AsyncResult<String>(invocation.getArguments()[0].toString());
|
||||
return new AsyncResult<>(invocation.getArguments()[0].toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -160,22 +160,22 @@ public class EnableAsyncTests {
|
||||
|
||||
@Async
|
||||
public Future<Thread> work0() {
|
||||
return new AsyncResult<Thread>(Thread.currentThread());
|
||||
return new AsyncResult<>(Thread.currentThread());
|
||||
}
|
||||
|
||||
@Async("e1")
|
||||
public Future<Thread> work() {
|
||||
return new AsyncResult<Thread>(Thread.currentThread());
|
||||
return new AsyncResult<>(Thread.currentThread());
|
||||
}
|
||||
|
||||
@Async("otherExecutor")
|
||||
public Future<Thread> work2() {
|
||||
return new AsyncResult<Thread>(Thread.currentThread());
|
||||
return new AsyncResult<>(Thread.currentThread());
|
||||
}
|
||||
|
||||
@Async("e2")
|
||||
public Future<Thread> work3() {
|
||||
return new AsyncResult<Thread>(Thread.currentThread());
|
||||
return new AsyncResult<>(Thread.currentThread());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -486,7 +486,7 @@ public class ScheduledAnnotationBeanPostProcessorTests {
|
||||
BeanDefinition targetDefinition = new RootBeanDefinition(ExpressionWithCronTestBean.class);
|
||||
context.registerBeanDefinition("postProcessor", processorDefinition);
|
||||
context.registerBeanDefinition("target", targetDefinition);
|
||||
Map<String, String> schedules = new HashMap<String, String>();
|
||||
Map<String, String> schedules = new HashMap<>();
|
||||
schedules.put("businessHours", businessHoursCronExpression);
|
||||
context.getBeanFactory().registerSingleton("schedules", schedules);
|
||||
context.refresh();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 class ThreadPoolExecutorFactoryBeanTests {
|
||||
ApplicationContext context = new AnnotationConfigApplicationContext(ExecutorConfig.class);
|
||||
ExecutorService executor = context.getBean("executor", ExecutorService.class);
|
||||
|
||||
FutureTask<String> task = new FutureTask<String>(new Callable<String>() {
|
||||
FutureTask<String> task = new FutureTask<>(new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "foo";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 ExecutorBeanDefinitionParserTests {
|
||||
assertEquals(60, getKeepAliveSeconds(executor));
|
||||
assertEquals(false, getAllowCoreThreadTimeOut(executor));
|
||||
|
||||
FutureTask<String> task = new FutureTask<String>(new Callable<String>() {
|
||||
FutureTask<String> task = new FutureTask<>(new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "foo";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 CronTriggerTests {
|
||||
|
||||
@Parameters(name = "date [{0}], time zone [{1}]")
|
||||
public static List<Object[]> getParameters() {
|
||||
List<Object[]> list = new ArrayList<Object[]>();
|
||||
List<Object[]> list = new ArrayList<>();
|
||||
list.add(new Object[] { new Date(), TimeZone.getTimeZone("PST") });
|
||||
list.add(new Object[] { new Date(), TimeZone.getTimeZone("CET") });
|
||||
return list;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 BshScriptEvaluatorTests {
|
||||
@Test
|
||||
public void testGroovyScriptWithArguments() {
|
||||
ScriptEvaluator evaluator = new BshScriptEvaluator();
|
||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("a", 3);
|
||||
arguments.put("b", 2);
|
||||
Object result = evaluator.evaluate(new StaticScriptSource("return a * b;"), arguments);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 GroovyScriptEvaluatorTests {
|
||||
@Test
|
||||
public void testGroovyScriptWithArguments() {
|
||||
ScriptEvaluator evaluator = new GroovyScriptEvaluator();
|
||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("a", 3);
|
||||
arguments.put("b", 2);
|
||||
Object result = evaluator.evaluate(new StaticScriptSource("return a * b"), arguments);
|
||||
@@ -77,7 +77,7 @@ public class GroovyScriptEvaluatorTests {
|
||||
public void testGroovyScriptWithArgumentsUsingJsr223() {
|
||||
StandardScriptEvaluator evaluator = new StandardScriptEvaluator();
|
||||
evaluator.setLanguage("Groovy");
|
||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("a", 3);
|
||||
arguments.put("b", 2);
|
||||
Object result = evaluator.evaluate(new StaticScriptSource("return a * b"), arguments);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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,9 +32,9 @@ import org.springframework.beans.factory.config.Scope;
|
||||
@SuppressWarnings("serial")
|
||||
public class SimpleMapScope implements Scope, Serializable {
|
||||
|
||||
private final Map<String, Object> map = new HashMap<String, Object>();
|
||||
private final Map<String, Object> map = new HashMap<>();
|
||||
|
||||
private final List<Runnable> callbacks = new LinkedList<Runnable>();
|
||||
private final List<Runnable> callbacks = new LinkedList<>();
|
||||
|
||||
|
||||
public SimpleMapScope() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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.jndi.JndiTemplate;
|
||||
*/
|
||||
public class ExpectedLookupTemplate extends JndiTemplate {
|
||||
|
||||
private final Map<String, Object> jndiObjects = new ConcurrentHashMap<String, Object>();
|
||||
private final Map<String, Object> jndiObjects = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author 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 SimpleNamingContext implements Context {
|
||||
|
||||
private final Hashtable<String, Object> boundObjects;
|
||||
|
||||
private final Hashtable<String, Object> environment = new Hashtable<String, Object>();
|
||||
private final Hashtable<String, Object> environment = new Hashtable<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ public class SimpleNamingContext implements Context {
|
||||
*/
|
||||
public SimpleNamingContext(String root) {
|
||||
this.root = root;
|
||||
this.boundObjects = new Hashtable<String, Object>();
|
||||
this.boundObjects = new Hashtable<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,7 +302,7 @@ public class SimpleNamingContext implements Context {
|
||||
proot = proot + "/";
|
||||
}
|
||||
String root = context.root + proot;
|
||||
Map<String, T> contents = new HashMap<String, T>();
|
||||
Map<String, T> contents = new HashMap<>();
|
||||
for (String boundName : context.boundObjects.keySet()) {
|
||||
if (boundName.startsWith(root)) {
|
||||
int startIndex = root.length();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -122,7 +122,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final Hashtable<String,Object> boundObjects = new Hashtable<String,Object>();
|
||||
private final Hashtable<String,Object> boundObjects = new Hashtable<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -115,7 +115,7 @@ public final class ModelMapTests {
|
||||
|
||||
@Test
|
||||
public void testOneArgCtorWithEmptyCollection() throws Exception {
|
||||
ModelMap model = new ModelMap(new HashSet<Object>());
|
||||
ModelMap model = new ModelMap(new HashSet<>());
|
||||
// must not add if collection is empty...
|
||||
assertEquals(0, model.size());
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public final class ModelMapTests {
|
||||
public void testAddAllObjectsWithSparseArrayList() throws Exception {
|
||||
// Null model arguments added without a name being explicitly supplied are not allowed
|
||||
ModelMap model = new ModelMap();
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add("bing");
|
||||
list.add(null);
|
||||
model.addAllAttributes(list);
|
||||
@@ -162,7 +162,7 @@ public final class ModelMapTests {
|
||||
|
||||
@Test
|
||||
public void testAddMap() throws Exception {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("one", "one-value");
|
||||
map.put("two", "two-value");
|
||||
ModelMap model = new ModelMap();
|
||||
@@ -184,7 +184,7 @@ public final class ModelMapTests {
|
||||
|
||||
@Test
|
||||
public void testAddListOfTheSameObjects() throws Exception {
|
||||
List<TestBean> beans = new ArrayList<TestBean>();
|
||||
List<TestBean> beans = new ArrayList<>();
|
||||
beans.add(new TestBean("one"));
|
||||
beans.add(new TestBean("two"));
|
||||
beans.add(new TestBean("three"));
|
||||
@@ -195,7 +195,7 @@ public final class ModelMapTests {
|
||||
|
||||
@Test
|
||||
public void testMergeMapWithOverriding() throws Exception {
|
||||
Map<String, TestBean> beans = new HashMap<String, TestBean>();
|
||||
Map<String, TestBean> beans = new HashMap<>();
|
||||
beans.put("one", new TestBean("one"));
|
||||
beans.put("two", new TestBean("two"));
|
||||
beans.put("three", new TestBean("three"));
|
||||
@@ -238,7 +238,7 @@ public final class ModelMapTests {
|
||||
public void testAopJdkProxy() throws Exception {
|
||||
ModelMap map = new ModelMap();
|
||||
ProxyFactory factory = new ProxyFactory();
|
||||
Map<?, ?> target = new HashMap<Object, Object>();
|
||||
Map<?, ?> target = new HashMap<>();
|
||||
factory.setTarget(target);
|
||||
factory.addInterface(Map.class);
|
||||
Object proxy = factory.getProxy();
|
||||
@@ -249,7 +249,7 @@ public final class ModelMapTests {
|
||||
@Test
|
||||
public void testAopJdkProxyWithMultipleInterfaces() throws Exception {
|
||||
ModelMap map = new ModelMap();
|
||||
Map<?, ?> target = new HashMap<Object, Object>();
|
||||
Map<?, ?> target = new HashMap<>();
|
||||
ProxyFactory factory = new ProxyFactory();
|
||||
factory.setTarget(target);
|
||||
factory.addInterface(Serializable.class);
|
||||
@@ -264,7 +264,7 @@ public final class ModelMapTests {
|
||||
@Test
|
||||
public void testAopJdkProxyWithDetectedInterfaces() throws Exception {
|
||||
ModelMap map = new ModelMap();
|
||||
Map<?, ?> target = new HashMap<Object, Object>();
|
||||
Map<?, ?> target = new HashMap<>();
|
||||
ProxyFactory factory = new ProxyFactory(target);
|
||||
Object proxy = factory.getProxy();
|
||||
map.addAttribute(proxy);
|
||||
|
||||
@@ -2112,7 +2112,7 @@ public class DataBinderTests {
|
||||
private List<E> list;
|
||||
|
||||
public GrowingList() {
|
||||
this.list = new ArrayList<E>();
|
||||
this.list = new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<E> getWrappedList() {
|
||||
@@ -2200,8 +2200,8 @@ public class DataBinderTests {
|
||||
private final Map<String, Object> f;
|
||||
|
||||
public Form() {
|
||||
f = new HashMap<String, Object>();
|
||||
f.put("list", new GrowingList<Object>());
|
||||
f = new HashMap<>();
|
||||
f.put("list", new GrowingList<>());
|
||||
}
|
||||
|
||||
public Map<String, Object> getF() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -266,10 +266,10 @@ public class ValidatorFactoryTests {
|
||||
private ValidAddress address = new ValidAddress();
|
||||
|
||||
@Valid
|
||||
private List<ValidAddress> addressList = new LinkedList<ValidAddress>();
|
||||
private List<ValidAddress> addressList = new LinkedList<>();
|
||||
|
||||
@Valid
|
||||
private Set<ValidAddress> addressSet = new LinkedHashSet<ValidAddress>();
|
||||
private Set<ValidAddress> addressSet = new LinkedHashSet<>();
|
||||
|
||||
public boolean expectsAutowiredValidator = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user