Fix [deprecation] compiler warnings

Fix deprecation compiler warnings by refactoring code or applying
@SuppressWarnings("deprecation") annotations. JUnit tests of
internally deprecated classes are now themselves marked as
@Deprecated.

Numerous EasyMock deprecation warnings will remain until the
migration to mockito can be completed.
This commit is contained in:
Phillip Webb
2012-12-31 13:08:39 -08:00
parent 9364043a64
commit 6626a38730
153 changed files with 1665 additions and 1188 deletions

View File

@@ -19,6 +19,7 @@ package org.springframework.beans.factory.parsing;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -33,9 +34,9 @@ public class CollectingReaderEventListener implements ReaderEventListener {
private final List defaults = new LinkedList();
private final Map componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8);
private final Map componentDefinitions = new LinkedHashMap<>(8);
private final Map aliasMap = CollectionFactory.createLinkedMapIfPossible(8);
private final Map aliasMap = new LinkedHashMap<>(8);
private final List imports = new LinkedList();
@@ -87,4 +88,4 @@ public class CollectingReaderEventListener implements ReaderEventListener {
return Collections.unmodifiableList(this.imports);
}
}
}

View File

@@ -21,10 +21,10 @@ import java.lang.reflect.Proxy;
import java.util.Map;
import junit.framework.TestCase;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.easymock.MockControl;
import org.springframework.aop.support.AopUtils;
import org.springframework.aop.support.StaticMethodMatcherPointcut;
import org.springframework.aop.target.HotSwappableTargetSource;
@@ -32,7 +32,8 @@ import org.springframework.beans.DerivedTestBean;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.ITestBean;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;
import org.springframework.transaction.CallCountingTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
@@ -48,11 +49,13 @@ import org.springframework.transaction.TransactionStatus;
*/
public class BeanFactoryTransactionTests extends TestCase {
private XmlBeanFactory factory;
private DefaultListableBeanFactory factory;
@Override
public void setUp() {
this.factory = new XmlBeanFactory(new ClassPathResource("transactionalBeanFactory.xml", getClass()));
this.factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(this.factory).loadBeanDefinitions(
new ClassPathResource("transactionalBeanFactory.xml", getClass()));
}
public void testGetsAreNotTransactionalWithProxyFactory1() throws NoSuchMethodException {
@@ -167,7 +170,8 @@ public class BeanFactoryTransactionTests extends TestCase {
*/
public void testNoTransactionAttributeSource() {
try {
XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("noTransactionAttributeSource.xml", getClass()));
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("noTransactionAttributeSource.xml", getClass()));
ITestBean testBean = (ITestBean) bf.getBean("noTransactionAttributeSource");
fail("Should require TransactionAttributeSource to be set");
}