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());
}