Explicit type can be replaced by <>

Issue: SPR-13188
This commit is contained in:
Stephane Nicoll
2016-07-05 17:00:26 +02:00
parent 3096888c7d
commit 00d2606b00
1044 changed files with 3972 additions and 3893 deletions

View File

@@ -250,9 +250,9 @@ public class LocalSessionFactoryBuilder extends Configuration {
*/
@SuppressWarnings("unchecked")
public LocalSessionFactoryBuilder scanPackages(String... packagesToScan) throws HibernateException {
Set<String> entityClassNames = new TreeSet<String>();
Set<String> converterClassNames = new TreeSet<String>();
Set<String> packageNames = new TreeSet<String>();
Set<String> entityClassNames = new TreeSet<>();
Set<String> converterClassNames = new TreeSet<>();
Set<String> packageNames = new TreeSet<>();
try {
for (String pkg : packagesToScan) {
String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX +

View File

@@ -97,7 +97,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
private String persistenceUnitName;
private final Map<String, Object> jpaPropertyMap = new HashMap<String, Object>();
private final Map<String, Object> jpaPropertyMap = new HashMap<>();
private Class<? extends EntityManagerFactory> entityManagerFactoryInterface;
@@ -392,7 +392,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
* @return proxy entity manager
*/
protected EntityManagerFactory createEntityManagerFactoryProxy(EntityManagerFactory emf) {
Set<Class<?>> ifcs = new LinkedHashSet<Class<?>>();
Set<Class<?>> ifcs = new LinkedHashSet<>();
if (this.entityManagerFactoryInterface != null) {
ifcs.add(this.entityManagerFactoryInterface);
}

View File

@@ -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.
@@ -49,7 +49,7 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
private String persistenceUnitName;
private final Map<String, Object> jpaPropertyMap = new HashMap<String, Object>();
private final Map<String, Object> jpaPropertyMap = new HashMap<>();
/**

View File

@@ -221,7 +221,7 @@ public abstract class ExtendedEntityManagerCreator {
boolean containerManaged, boolean synchronizedWithTransaction) {
Assert.notNull(rawEm, "EntityManager must not be null");
Set<Class<?>> ifcs = new LinkedHashSet<Class<?>>();
Set<Class<?>> ifcs = new LinkedHashSet<>();
if (emIfc != null) {
ifcs.add(emIfc);
}

View File

@@ -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.
@@ -115,7 +115,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
private String persistenceUnitName;
private final Map<String, Object> jpaPropertyMap = new HashMap<String, Object>();
private final Map<String, Object> jpaPropertyMap = new HashMap<>();
private DataSource dataSource;

View File

@@ -65,9 +65,9 @@ public abstract class SharedEntityManagerCreator {
private static final Class<?>[] NO_ENTITY_MANAGER_INTERFACES = new Class<?>[0];
private static final Set<String> transactionRequiringMethods = new HashSet<String>(6);
private static final Set<String> transactionRequiringMethods = new HashSet<>(6);
private static final Set<String> queryTerminationMethods = new HashSet<String>(3);
private static final Set<String> queryTerminationMethods = new HashSet<>(3);
static {
transactionRequiringMethods.add("joinTransaction");

View File

@@ -111,7 +111,7 @@ public class DefaultPersistenceUnitManager
private static final Set<TypeFilter> entityTypeFilters;
static {
entityTypeFilters = new LinkedHashSet<TypeFilter>(4);
entityTypeFilters = new LinkedHashSet<>(4);
entityTypeFilters.add(new AnnotationTypeFilter(Entity.class, false));
entityTypeFilters.add(new AnnotationTypeFilter(Embeddable.class, false));
entityTypeFilters.add(new AnnotationTypeFilter(MappedSuperclass.class, false));
@@ -147,9 +147,9 @@ public class DefaultPersistenceUnitManager
private ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
private final Set<String> persistenceUnitInfoNames = new HashSet<String>();
private final Set<String> persistenceUnitInfoNames = new HashSet<>();
private final Map<String, PersistenceUnitInfo> persistenceUnitInfos = new HashMap<String, PersistenceUnitInfo>();
private final Map<String, PersistenceUnitInfo> persistenceUnitInfos = new HashMap<>();
/**
@@ -469,7 +469,7 @@ public class DefaultPersistenceUnitManager
* as defined in the JPA specification.
*/
private List<SpringPersistenceUnitInfo> readPersistenceUnitInfos() {
List<SpringPersistenceUnitInfo> infos = new LinkedList<SpringPersistenceUnitInfo>();
List<SpringPersistenceUnitInfo> infos = new LinkedList<>();
String defaultName = this.defaultPersistenceUnitName;
boolean buildDefaultUnit = (this.packagesToScan != null || this.mappingResources != null);
boolean foundDefaultUnit = false;

View File

@@ -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.
@@ -53,15 +53,15 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
private DataSource jtaDataSource;
private final List<String> mappingFileNames = new LinkedList<String>();
private final List<String> mappingFileNames = new LinkedList<>();
private List<URL> jarFileUrls = new LinkedList<URL>();
private List<URL> jarFileUrls = new LinkedList<>();
private URL persistenceUnitRootUrl;
private final List<String> managedClassNames = new LinkedList<String>();
private final List<String> managedClassNames = new LinkedList<>();
private final List<String> managedPackages = new LinkedList<String>();
private final List<String> managedPackages = new LinkedList<>();
private boolean excludeUnlistedClasses = false;

View File

@@ -121,7 +121,7 @@ final class PersistenceUnitReader {
*/
public SpringPersistenceUnitInfo[] readPersistenceUnitInfos(String[] persistenceXmlLocations) {
ErrorHandler handler = new SimpleSaxErrorHandler(logger);
List<SpringPersistenceUnitInfo> infos = new LinkedList<SpringPersistenceUnitInfo>();
List<SpringPersistenceUnitInfo> infos = new LinkedList<>();
String resourceLocation = null;
try {
for (String location : persistenceXmlLocations) {

View File

@@ -186,10 +186,10 @@ public class PersistenceAnnotationBeanPostProcessor
private transient ListableBeanFactory beanFactory;
private transient final Map<String, InjectionMetadata> injectionMetadataCache =
new ConcurrentHashMap<String, InjectionMetadata>(256);
new ConcurrentHashMap<>(256);
private final Map<Object, EntityManager> extendedEntityManagersToClose =
new ConcurrentHashMap<Object, EntityManager>(16);
new ConcurrentHashMap<>(16);
/**
@@ -404,12 +404,12 @@ public class PersistenceAnnotationBeanPostProcessor
}
private InjectionMetadata buildPersistenceMetadata(final Class<?> clazz) {
LinkedList<InjectionMetadata.InjectedElement> elements = new LinkedList<InjectionMetadata.InjectedElement>();
LinkedList<InjectionMetadata.InjectedElement> elements = new LinkedList<>();
Class<?> targetClass = clazz;
do {
final LinkedList<InjectionMetadata.InjectedElement> currElements =
new LinkedList<InjectionMetadata.InjectedElement>();
new LinkedList<>();
ReflectionUtils.doWithLocalFields(targetClass, new ReflectionUtils.FieldCallback() {
@Override

View File

@@ -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.
@@ -57,7 +57,7 @@ public class EclipseLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
@Override
public Map<String, Object> getJpaPropertyMap() {
Map<String, Object> jpaProperties = new HashMap<String, Object>();
Map<String, Object> jpaProperties = new HashMap<>();
if (getDatabasePlatform() != null) {
jpaProperties.put(PersistenceUnitProperties.TARGET_DATABASE, getDatabasePlatform());

View File

@@ -101,7 +101,7 @@ public class HibernateJpaVendorAdapter extends AbstractJpaVendorAdapter {
@Override
public Map<String, Object> getJpaPropertyMap() {
Map<String, Object> jpaProperties = new HashMap<String, Object>();
Map<String, Object> jpaProperties = new HashMap<>();
if (getDatabasePlatform() != null) {
jpaProperties.put(Environment.DIALECT, getDatabasePlatform());

View File

@@ -44,7 +44,7 @@ class SpringHibernateJpaPersistenceProvider extends HibernatePersistenceProvider
@Override
@SuppressWarnings("rawtypes")
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map properties) {
final List<String> mergedClassesAndPackages = new ArrayList<String>(info.getManagedClassNames());
final List<String> mergedClassesAndPackages = new ArrayList<>(info.getManagedClassNames());
if (info instanceof SmartPersistenceUnitInfo) {
mergedClassesAndPackages.addAll(((SmartPersistenceUnitInfo) info).getManagedPackages());
}

View File

@@ -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.
@@ -88,7 +88,7 @@ public class JpaTransactionManagerTests {
public void testTransactionCommit() {
given(manager.getTransaction()).willReturn(tx);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -118,7 +118,7 @@ public class JpaTransactionManagerTests {
given(tx.getRollbackOnly()).willReturn(true);
willThrow(new RollbackException()).given(tx).commit();
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -152,7 +152,7 @@ public class JpaTransactionManagerTests {
given(manager.getTransaction()).willReturn(tx);
given(tx.isActive()).willReturn(true);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -185,7 +185,7 @@ public class JpaTransactionManagerTests {
public void testTransactionRollbackWithAlreadyRolledBack() {
given(manager.getTransaction()).willReturn(tx);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -217,7 +217,7 @@ public class JpaTransactionManagerTests {
given(manager.getTransaction()).willReturn(tx);
given(tx.isActive()).willReturn(true);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -247,7 +247,7 @@ public class JpaTransactionManagerTests {
public void testParticipatingTransactionWithCommit() {
given(manager.getTransaction()).willReturn(tx);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -281,7 +281,7 @@ public class JpaTransactionManagerTests {
given(manager.getTransaction()).willReturn(tx);
given(tx.isActive()).willReturn(true);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -322,7 +322,7 @@ public class JpaTransactionManagerTests {
given(tx.getRollbackOnly()).willReturn(true);
willThrow(new RollbackException()).given(tx).commit();
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -367,7 +367,7 @@ public class JpaTransactionManagerTests {
given(manager.getTransaction()).willReturn(tx);
given(manager.isOpen()).willReturn(true);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -402,7 +402,7 @@ public class JpaTransactionManagerTests {
given(manager.getTransaction()).willReturn(tx);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -447,7 +447,7 @@ public class JpaTransactionManagerTests {
given(manager.getTransaction()).willReturn(tx);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -486,7 +486,7 @@ public class JpaTransactionManagerTests {
given(manager.getTransaction()).willReturn(tx);
given(manager.isOpen()).willReturn(true);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -570,7 +570,7 @@ public class JpaTransactionManagerTests {
public void testTransactionCommitWithPropagationSupports() {
given(manager.isOpen()).willReturn(true);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_SUPPORTS);
@@ -629,7 +629,7 @@ public class JpaTransactionManagerTests {
public void testTransactionCommitWithPrebound() {
given(manager.getTransaction()).willReturn(tx);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));
@@ -694,7 +694,7 @@ public class JpaTransactionManagerTests {
@Test
public void testTransactionCommitWithPreboundAndPropagationSupports() {
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_SUPPORTS);
@@ -765,7 +765,7 @@ public class JpaTransactionManagerTests {
given(manager.getTransaction()).willReturn(tx);
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("test");
assertTrue(!TransactionSynchronizationManager.hasResource(factory));

View File

@@ -182,7 +182,7 @@ public class PersistenceXmlParsingTests {
String resource = "/org/springframework/orm/jpa/persistence-complex.xml";
MapDataSourceLookup dataSourceLookup = new MapDataSourceLookup();
Map<String, DataSource> dataSources = new HashMap<String, DataSource>();
Map<String, DataSource> dataSources = new HashMap<>();
dataSources.put("jdbc/MyPartDB", ds);
dataSources.put("jdbc/MyDB", ds);
dataSourceLookup.setDataSources(dataSources);

View File

@@ -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.
@@ -340,7 +340,7 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
EntityManagerFactoryWithInfo mockEmf2 = mock(EntityManagerFactoryWithInfo.class);
Map<String, String> persistenceUnits = new HashMap<String, String>();
Map<String, String> persistenceUnits = new HashMap<>();
persistenceUnits.put("", "pu1");
persistenceUnits.put("Person", "pu2");
ExpectedLookupTemplate jt = new ExpectedLookupTemplate();
@@ -379,7 +379,7 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
public void testPersistenceUnitsFromJndiWithDefaultUnit() {
EntityManagerFactoryWithInfo mockEmf2 = mock(EntityManagerFactoryWithInfo.class);
Map<String, String> persistenceUnits = new HashMap<String, String>();
Map<String, String> persistenceUnits = new HashMap<>();
persistenceUnits.put("System", "pu1");
persistenceUnits.put("Person", "pu2");
ExpectedLookupTemplate jt = new ExpectedLookupTemplate();
@@ -407,7 +407,7 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
@Test
public void testSinglePersistenceUnitFromJndi() {
Map<String, String> persistenceUnits = new HashMap<String, String>();
Map<String, String> persistenceUnits = new HashMap<>();
persistenceUnits.put("Person", "pu1");
ExpectedLookupTemplate jt = new ExpectedLookupTemplate();
jt.addObject("java:comp/env/pu1", mockEmf);
@@ -436,10 +436,10 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
EntityManager mockEm2 = mock(EntityManager.class);
EntityManager mockEm3 = mock(EntityManager.class);
Map<String, String> persistenceContexts = new HashMap<String, String>();
Map<String, String> persistenceContexts = new HashMap<>();
persistenceContexts.put("", "pc1");
persistenceContexts.put("Person", "pc2");
Map<String, String> extendedPersistenceContexts = new HashMap<String, String>();
Map<String, String> extendedPersistenceContexts = new HashMap<>();
extendedPersistenceContexts .put("", "pc3");
ExpectedLookupTemplate jt = new ExpectedLookupTemplate();
jt.addObject("java:comp/env/pc1", mockEm);
@@ -476,10 +476,10 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
EntityManager mockEm2 = mock(EntityManager.class);
EntityManager mockEm3 = mock(EntityManager.class);
Map<String, String> persistenceContexts = new HashMap<String, String>();
Map<String, String> persistenceContexts = new HashMap<>();
persistenceContexts.put("System", "pc1");
persistenceContexts.put("Person", "pc2");
Map<String, String> extendedPersistenceContexts = new HashMap<String, String>();
Map<String, String> extendedPersistenceContexts = new HashMap<>();
extendedPersistenceContexts .put("System", "pc3");
ExpectedLookupTemplate jt = new ExpectedLookupTemplate();
jt.addObject("java:comp/env/pc1", mockEm);
@@ -516,9 +516,9 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
EntityManager mockEm = mock(EntityManager.class);
EntityManager mockEm2 = mock(EntityManager.class);
Map<String, String> persistenceContexts = new HashMap<String, String>();
Map<String, String> persistenceContexts = new HashMap<>();
persistenceContexts.put("System", "pc1");
Map<String, String> extendedPersistenceContexts = new HashMap<String, String>();
Map<String, String> extendedPersistenceContexts = new HashMap<>();
extendedPersistenceContexts .put("System", "pc2");
ExpectedLookupTemplate jt = new ExpectedLookupTemplate();
jt.addObject("java:comp/env/pc1", mockEm);

View File

@@ -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.
@@ -63,7 +63,7 @@ abstract class AbstractSpringContextTests extends TestCase {
protected final Log logger = LogFactory.getLog(getClass());
private static Map<String, ConfigurableApplicationContext> contextKeyToContextMap =
new HashMap<String, ConfigurableApplicationContext>();
new HashMap<>();
/**

View File

@@ -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.
@@ -92,9 +92,9 @@ public abstract class AbstractJpaTests extends AbstractTransactionalSpringContex
* Values are intentionally not strongly typed, to avoid potential class cast exceptions
* through use between different class loaders.
*/
private static Map<String, Object> contextCache = new HashMap<String, Object>();
private static Map<String, Object> contextCache = new HashMap<>();
private static Map<String, ClassLoader> classLoaderCache = new HashMap<String, ClassLoader>();
private static Map<String, ClassLoader> classLoaderCache = new HashMap<>();
protected EntityManagerFactory entityManagerFactory;