Clean up warnings
This commit is contained in:
parent
64819bbc1d
commit
6ef7d7124e
|
@ -837,7 +837,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
|||
PropertyTokenHolder tokens = getPropertyNameTokens(nestedProperty);
|
||||
String canonicalName = tokens.canonicalName;
|
||||
Object value = getPropertyValue(tokens);
|
||||
if (value == null || (value instanceof Optional && !((Optional) value).isPresent())) {
|
||||
if (value == null || (value instanceof Optional && !((Optional<?>) value).isPresent())) {
|
||||
if (isAutoGrowNestedPaths()) {
|
||||
value = setDefaultValue(tokens);
|
||||
}
|
||||
|
|
|
@ -523,8 +523,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
|||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
protected boolean determineRequiredStatus(MergedAnnotation<?> ann) {
|
||||
return determineRequiredStatus((AnnotationAttributes)
|
||||
ann.asMap(mergedAnnotation -> new AnnotationAttributes(mergedAnnotation.getType())));
|
||||
return determineRequiredStatus(ann.asMap(mergedAnnotation -> new AnnotationAttributes(mergedAnnotation.getType())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -229,6 +229,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
* @return the number of bean definitions found
|
||||
* @throws BeanDefinitionStoreException in case of loading or parsing errors
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException {
|
||||
// Check for XML files and redirect them to the "standard" XmlBeanDefinitionReader
|
||||
String filename = encodedResource.getResource().getFilename();
|
||||
|
@ -242,7 +243,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
|
||||
Closure beans = new Closure(this) {
|
||||
@Override
|
||||
public Object call(Object[] args) {
|
||||
public Object call(Object... args) {
|
||||
invokeBeanDefiningClosure((Closure) args[0]);
|
||||
return null;
|
||||
}
|
||||
|
@ -285,6 +286,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
* @param closure the block or closure
|
||||
* @return this {@code GroovyBeanDefinitionReader} instance
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public GroovyBeanDefinitionReader beans(Closure closure) {
|
||||
return invokeBeanDefiningClosure(closure);
|
||||
}
|
||||
|
@ -306,6 +308,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
* @param args the constructors arguments and closure configurer
|
||||
* @return the bean definition
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public AbstractBeanDefinition bean(Class<?> type, Object...args) {
|
||||
GroovyBeanDefinitionWrapper current = this.currentBeanDefinition;
|
||||
try {
|
||||
|
@ -373,6 +376,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
* This method overrides method invocation to create beans for each method name that
|
||||
* takes a class argument.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Object invokeMethod(String name, Object arg) {
|
||||
Object[] args = (Object[])arg;
|
||||
if ("beans".equals(name) && args.length == 1 && args[0] instanceof Closure) {
|
||||
|
@ -426,6 +430,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private void finalizeDeferredProperties() {
|
||||
for (DeferredProperty dp : this.deferredProperties.values()) {
|
||||
if (dp.value instanceof List) {
|
||||
|
@ -444,6 +449,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
* @param callable the closure argument
|
||||
* @return this {@code GroovyBeanDefinitionReader} instance
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected GroovyBeanDefinitionReader invokeBeanDefiningClosure(Closure callable) {
|
||||
callable.setDelegate(this);
|
||||
callable.call();
|
||||
|
@ -458,6 +464,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
* argument is sometimes a closure. All the arguments in between are constructor arguments.
|
||||
* @return the bean definition wrapper
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
private GroovyBeanDefinitionWrapper invokeBeanDefiningMethod(String beanName, Object[] args) {
|
||||
boolean hasClosureArgument = (args[args.length - 1] instanceof Closure);
|
||||
if (args[0] instanceof Class) {
|
||||
|
@ -483,9 +490,9 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
else if (args[0] instanceof Map) {
|
||||
// named constructor arguments
|
||||
if (args.length > 1 && args[1] instanceof Class) {
|
||||
List constructorArgs = resolveConstructorArguments(args, 2, hasClosureArgument ? args.length - 1 : args.length);
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, (Class)args[1], constructorArgs);
|
||||
Map namedArgs = (Map)args[0];
|
||||
List<Object> constructorArgs = resolveConstructorArguments(args, 2, hasClosureArgument ? args.length - 1 : args.length);
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, (Class<?>) args[1], constructorArgs);
|
||||
Map namedArgs = (Map) args[0];
|
||||
for (Object o : namedArgs.keySet()) {
|
||||
String propName = (String) o;
|
||||
setProperty(propName, namedArgs.get(propName));
|
||||
|
@ -494,7 +501,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
// factory method syntax
|
||||
else {
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName);
|
||||
//First arg is the map containing factoryBean : factoryMethod
|
||||
// First arg is the map containing factoryBean : factoryMethod
|
||||
Map.Entry factoryBeanEntry = (Map.Entry) ((Map) args[0]).entrySet().iterator().next();
|
||||
// If we have a closure body, that will be the last argument.
|
||||
// In between are the constructor args
|
||||
|
@ -537,6 +544,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
return beanDefinition;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected List<Object> resolveConstructorArguments(Object[] args, int start, int end) {
|
||||
Object[] constructorArgs = Arrays.copyOfRange(args, start, end);
|
||||
for (int i = 0; i < constructorArgs.length; i++) {
|
||||
|
@ -607,6 +615,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected void applyPropertyToBeanDefinition(String name, Object value) {
|
||||
if (value instanceof GString) {
|
||||
value = value.toString();
|
||||
|
@ -785,7 +794,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
|
||||
|
||||
/**
|
||||
* Wraps a bean definition property an ensures that any RuntimeBeanReference
|
||||
* Wraps a bean definition property and ensures that any RuntimeBeanReference
|
||||
* additions to it are deferred for resolution later.
|
||||
*/
|
||||
private class GroovyPropertyValue extends GroovyObjectSupport {
|
||||
|
@ -799,17 +808,20 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
this.propertyValue = propertyValue;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void leftShift(Object value) {
|
||||
InvokerHelper.invokeMethod(this.propertyValue, "leftShift", value);
|
||||
updateDeferredProperties(value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public boolean add(Object value) {
|
||||
boolean retVal = (Boolean) InvokerHelper.invokeMethod(this.propertyValue, "add", value);
|
||||
updateDeferredProperties(value);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
public boolean addAll(Collection values) {
|
||||
boolean retVal = (Boolean) InvokerHelper.invokeMethod(this.propertyValue, "addAll", values);
|
||||
for (Object value : values) {
|
||||
|
|
|
@ -173,6 +173,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void setProperty(String property, Object newValue) {
|
||||
if (PARENT.equals(property)) {
|
||||
setParent(newValue);
|
||||
|
|
|
@ -1142,6 +1142,7 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void setGenericArrayProperty() {
|
||||
SkipReaderStub target = new SkipReaderStub();
|
||||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
|
@ -1459,7 +1460,7 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
assertEquals("rob", ((TestBean) target.getMap().get(2)).getName());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") // must work with raw map in this test
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" }) // must work with raw map in this test
|
||||
@Test
|
||||
public void setRawMapPropertyWithNoEditorRegistered() {
|
||||
IndexedTestBean target = new IndexedTestBean();
|
||||
|
@ -1787,6 +1788,7 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Simple {
|
||||
|
||||
private String name;
|
||||
|
@ -1815,6 +1817,7 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Person {
|
||||
private String name;
|
||||
|
||||
|
@ -1845,6 +1848,7 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Address {
|
||||
private String city;
|
||||
|
||||
|
@ -1876,6 +1880,7 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Country {
|
||||
private String name;
|
||||
|
||||
|
@ -1904,7 +1909,7 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({ "unused", "rawtypes" })
|
||||
private static class Foo {
|
||||
|
||||
private List list;
|
||||
|
@ -2200,10 +2205,12 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
public SkipReaderStub() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public SkipReaderStub(T... items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setItems(T... items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
@ -2237,6 +2244,7 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Spr13837Bean setSomething(final Integer something) {
|
||||
this.something = something;
|
||||
return this;
|
||||
|
|
|
@ -164,6 +164,7 @@ public class BeanWrapperAutoGrowingTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static class Bean {
|
||||
|
||||
private String prop;
|
||||
|
|
|
@ -160,7 +160,7 @@ public class BeanWrapperGenericsTests {
|
|||
GenericBean<?> gb = new GenericBean<>();
|
||||
BeanWrapper bw = new BeanWrapperImpl(gb);
|
||||
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
|
||||
Map<String, Collection> input = new HashMap<>();
|
||||
Map<String, Collection<?>> input = new HashMap<>();
|
||||
HashSet<Integer> value1 = new HashSet<>();
|
||||
value1.add(new Integer(1));
|
||||
input.put("1", value1);
|
||||
|
@ -507,6 +507,7 @@ public class BeanWrapperGenericsTests {
|
|||
public Holder(D data) {
|
||||
this.data = data;
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
public D getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
|
|
@ -176,6 +176,7 @@ public class BeanWrapperTests extends AbstractPropertyAccessorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void getPropertyWithOptional() {
|
||||
GetterWithOptional target = new GetterWithOptional();
|
||||
TestBean tb = new TestBean("x");
|
||||
|
|
|
@ -124,6 +124,7 @@ public class PropertyMatchesTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class SampleBeanProperties {
|
||||
|
||||
private String name;
|
||||
|
@ -178,6 +179,7 @@ public class PropertyMatchesTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class SampleFieldProperties {
|
||||
|
||||
private String name;
|
||||
|
|
|
@ -1464,6 +1464,7 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testGetFactoryBeanByTypeWithPrimary() {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition bd1 = new RootBeanDefinition(NullTestBeanFactoryBean.class);
|
||||
|
@ -1814,6 +1815,7 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testBeanProviderSerialization() throws Exception {
|
||||
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
lbf.setSerializationId("test");
|
||||
|
@ -2674,10 +2676,6 @@ public class DefaultListableBeanFactoryTests {
|
|||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||
return new TestBean();
|
||||
}
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
return bean;
|
||||
}
|
||||
});
|
||||
BeanWithDisposableBean.closed = false;
|
||||
lbf.preInstantiateSingletons();
|
||||
|
@ -2695,10 +2693,6 @@ public class DefaultListableBeanFactoryTests {
|
|||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||
return new TestBean();
|
||||
}
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
return bean;
|
||||
}
|
||||
});
|
||||
BeanWithDisposableBean.closed = false;
|
||||
lbf.preInstantiateSingletons();
|
||||
|
@ -2717,10 +2711,6 @@ public class DefaultListableBeanFactoryTests {
|
|||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||
return new TestBean();
|
||||
}
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
return bean;
|
||||
}
|
||||
});
|
||||
BeanWithDestroyMethod.closeCount = 0;
|
||||
lbf.preInstantiateSingletons();
|
||||
|
@ -2943,7 +2933,7 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void testInitSecurityAwarePrototypeBean() {
|
||||
final DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
|
||||
RootBeanDefinition bd = new RootBeanDefinition(TestSecuredBean.class);
|
||||
|
@ -3202,6 +3192,7 @@ public class DefaultListableBeanFactoryTests {
|
|||
|
||||
private static int closeCount = 0;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private BeanWithDestroyMethod inner;
|
||||
|
||||
public void setInner(BeanWithDestroyMethod inner) {
|
||||
|
@ -3416,7 +3407,7 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Object convertIfNecessary(Object value, @Nullable Class requiredType) {
|
||||
if (value instanceof String && Float.class.isAssignableFrom(requiredType)) {
|
||||
try {
|
||||
|
@ -3435,13 +3426,13 @@ public class DefaultListableBeanFactoryTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Object convertIfNecessary(Object value, @Nullable Class requiredType, @Nullable MethodParameter methodParam) {
|
||||
return convertIfNecessary(value, requiredType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Object convertIfNecessary(Object value, @Nullable Class requiredType, @Nullable Field field) {
|
||||
return convertIfNecessary(value, requiredType);
|
||||
}
|
||||
|
@ -3564,6 +3555,7 @@ public class DefaultListableBeanFactoryTests {
|
|||
|
||||
public TestBean testBean;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public TestBeanRecipient(TestBean testBean) {
|
||||
this.testBean = testBean;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class CustomScopeConfigurerTests {
|
|||
figurer.postProcessBeanFactory(factory);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void testWhereScopeMapHasNonStringTypedScopeNameInKeySet() {
|
||||
Map scopes = new HashMap();
|
||||
|
|
|
@ -73,6 +73,7 @@ public class ObjectFactoryCreatingFactoryBeanTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testFactorySerialization() throws Exception {
|
||||
FactoryTestBean testBean = beanFactory.getBean("factoryTestBean", FactoryTestBean.class);
|
||||
ObjectFactory<?> objectFactory = testBean.getObjectFactory();
|
||||
|
@ -95,6 +96,7 @@ public class ObjectFactoryCreatingFactoryBeanTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testProviderSerialization() throws Exception {
|
||||
ProviderTestBean testBean = beanFactory.getBean("providerTestBean", ProviderTestBean.class);
|
||||
Provider<?> provider = testBean.getProvider();
|
||||
|
|
|
@ -329,7 +329,7 @@ public class PropertyResourceConfigurerTests {
|
|||
}
|
||||
|
||||
private void doTestPropertyPlaceholderConfigurer(boolean parentChildSeparation) {
|
||||
Map singletonMap = Collections.singletonMap("myKey", "myValue");
|
||||
Map<String, String> singletonMap = Collections.singletonMap("myKey", "myValue");
|
||||
if (parentChildSeparation) {
|
||||
MutablePropertyValues pvs1 = new MutablePropertyValues();
|
||||
pvs1.add("age", "${age}");
|
||||
|
|
|
@ -262,7 +262,7 @@ public class ServiceLocatorFactoryBeanTests {
|
|||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void testWhenServiceLocatorExceptionClassIsNotAnExceptionSubclass() throws Exception {
|
||||
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
|
||||
factory.setServiceLocatorExceptionClass((Class) getClass());
|
||||
|
|
|
@ -63,7 +63,7 @@ import static org.junit.Assert.fail;
|
|||
* Security test case. Checks whether the container uses its privileges for its
|
||||
* internal work but does not leak them when touching/calling user code.
|
||||
*
|
||||
*t The first half of the test case checks that permissions are downgraded when
|
||||
* <p>The first half of the test case checks that permissions are downgraded when
|
||||
* calling user code while the second half that the caller code permission get
|
||||
* through and Spring doesn't override the permission stack.
|
||||
*
|
||||
|
@ -162,7 +162,7 @@ public class CallbacksSecurityTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({ "unused", "rawtypes" })
|
||||
private static class NonPrivilegedFactoryBean implements SmartFactoryBean {
|
||||
private String expectedName;
|
||||
|
||||
|
@ -557,4 +557,5 @@ public class CallbacksSecurityTests {
|
|||
}
|
||||
}, provider.getAccessControlContext());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.beans.factory.support.security.support;
|
||||
|
||||
import java.util.Properties;
|
||||
|
@ -22,15 +23,15 @@ import org.springframework.beans.factory.FactoryBean;
|
|||
/**
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class CustomFactoryBean implements FactoryBean<Object> {
|
||||
public class CustomFactoryBean implements FactoryBean<Properties> {
|
||||
|
||||
@Override
|
||||
public Object getObject() throws Exception {
|
||||
public Properties getObject() throws Exception {
|
||||
return System.getProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getObjectType() {
|
||||
public Class<Properties> getObjectType() {
|
||||
System.setProperty("factory.object.type", "true");
|
||||
return Properties.class;
|
||||
}
|
||||
|
@ -39,4 +40,5 @@ public class CustomFactoryBean implements FactoryBean<Object> {
|
|||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ public class CollectionsWithDefaultTypesTests {
|
|||
assertMap(bean.getSomeMap());
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private void assertMap(Map<?,?> map) {
|
||||
for (Map.Entry entry : map.entrySet()) {
|
||||
assertEquals("Key type is incorrect", Integer.class, entry.getKey().getClass());
|
||||
|
@ -78,6 +79,7 @@ public class CollectionsWithDefaultTypesTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testBuildCollectionFromMixtureOfReferencesAndValues() throws Exception {
|
||||
MixedCollectionBean jumble = (MixedCollectionBean) this.beanFactory.getBean("jumble");
|
||||
assertTrue("Expected 3 elements, not " + jumble.getJumble().size(),
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.springframework.tests.sample.beans.TestBean;
|
|||
/**
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class CountingFactory implements FactoryBean {
|
||||
public class CountingFactory implements FactoryBean<String> {
|
||||
|
||||
private static int factoryBeanInstanceCount = 0;
|
||||
|
||||
|
@ -51,12 +51,12 @@ public class CountingFactory implements FactoryBean {
|
|||
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
public String getObject() {
|
||||
return "myString";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getObjectType() {
|
||||
public Class<String> getObjectType() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class FactoryMethods {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static List listInstance() {
|
||||
private static List<?> listInstance() {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,14 +27,14 @@ import java.util.Collection;
|
|||
*/
|
||||
public class MixedCollectionBean {
|
||||
|
||||
private Collection jumble;
|
||||
private Collection<?> jumble;
|
||||
|
||||
|
||||
public void setJumble(Collection jumble) {
|
||||
public void setJumble(Collection<?> jumble) {
|
||||
this.jumble = jumble;
|
||||
}
|
||||
|
||||
public Collection getJumble() {
|
||||
public Collection<?> getJumble() {
|
||||
return jumble;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ public class NestedBeansElementAttributeRecursionTests {
|
|||
assertMerge(bf);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void assertMerge(DefaultListableBeanFactory bf) {
|
||||
TestBean topLevel = bf.getBean("topLevelConcreteTestBean", TestBean.class);
|
||||
// has the concrete child bean values
|
||||
|
|
|
@ -48,6 +48,7 @@ import static org.junit.Assert.assertTrue;
|
|||
* @author Juergen Hoeller
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class UtilNamespaceHandlerTests {
|
||||
|
||||
private DefaultListableBeanFactory beanFactory;
|
||||
|
|
|
@ -54,6 +54,7 @@ import static org.junit.Assert.fail;
|
|||
* @author Chris Beams
|
||||
* @since 19.12.2004
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class XmlBeanCollectionTests {
|
||||
|
||||
private final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
|
|
|
@ -40,7 +40,7 @@ public class CustomCollectionEditorTests {
|
|||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void testCtorWithNonCollectionType() throws Exception {
|
||||
new CustomCollectionEditor((Class) String.class);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import static org.junit.Assert.assertTrue;
|
|||
public class PagedListHolderTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void testPagedListHolder() {
|
||||
Assume.group(TestGroup.LONG_RUNNING);
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ public class PropertyComparatorTests {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Dog implements Comparable<Object> {
|
||||
|
||||
private String nickName;
|
||||
|
|
|
@ -51,7 +51,7 @@ public class GenericBean<T> {
|
|||
|
||||
private List<Map<Integer, Long>> listOfMaps;
|
||||
|
||||
private Map plainMap;
|
||||
private Map<?, ?> plainMap;
|
||||
|
||||
private Map<Short, Integer> shortMap;
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class GenericBean<T> {
|
|||
this.resourceList = Collections.singletonList(resource);
|
||||
}
|
||||
|
||||
public GenericBean(Map plainMap, Map<Short, Integer> shortMap) {
|
||||
public GenericBean(Map<?, ?> plainMap, Map<Short, Integer> shortMap) {
|
||||
this.plainMap = plainMap;
|
||||
this.shortMap = shortMap;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ public class GenericBean<T> {
|
|||
this.listOfMaps = listOfMaps;
|
||||
}
|
||||
|
||||
public Map getPlainMap() {
|
||||
public Map<?, ?> getPlainMap() {
|
||||
return plainMap;
|
||||
}
|
||||
|
||||
|
@ -289,30 +289,37 @@ public class GenericBean<T> {
|
|||
this.standardEnumMap = standardEnumMap;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(Set<Integer> integerSet) {
|
||||
return new GenericBean(integerSet);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(Set<Integer> integerSet, List<Resource> resourceList) {
|
||||
return new GenericBean(integerSet, resourceList);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(HashSet<Integer> integerSet, Map<Short, Integer> shortMap) {
|
||||
return new GenericBean(integerSet, shortMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(Map<Short, Integer> shortMap, Resource resource) {
|
||||
return new GenericBean(shortMap, resource);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(Map map, Map<Short, Integer> shortMap) {
|
||||
return new GenericBean(map, shortMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(HashMap<Long, ?> longMap) {
|
||||
return new GenericBean(longMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(boolean someFlag, Map<Number, Collection<? extends Object>> collectionMap) {
|
||||
return new GenericBean(someFlag, collectionMap);
|
||||
}
|
||||
|
|
|
@ -45,9 +45,9 @@ public class HasMap {
|
|||
|
||||
private List<Class<?>> classList;
|
||||
|
||||
private IdentityHashMap identityMap;
|
||||
private IdentityHashMap<?, ?> identityMap;
|
||||
|
||||
private CopyOnWriteArraySet concurrentSet;
|
||||
private CopyOnWriteArraySet<?> concurrentSet;
|
||||
|
||||
private HasMap() {
|
||||
}
|
||||
|
@ -108,19 +108,19 @@ public class HasMap {
|
|||
this.classList = classList;
|
||||
}
|
||||
|
||||
public IdentityHashMap getIdentityMap() {
|
||||
public IdentityHashMap<?, ?> getIdentityMap() {
|
||||
return identityMap;
|
||||
}
|
||||
|
||||
public void setIdentityMap(IdentityHashMap identityMap) {
|
||||
public void setIdentityMap(IdentityHashMap<?, ?> identityMap) {
|
||||
this.identityMap = identityMap;
|
||||
}
|
||||
|
||||
public CopyOnWriteArraySet getConcurrentSet() {
|
||||
public CopyOnWriteArraySet<?> getConcurrentSet() {
|
||||
return concurrentSet;
|
||||
}
|
||||
|
||||
public void setConcurrentSet(CopyOnWriteArraySet concurrentSet) {
|
||||
public void setConcurrentSet(CopyOnWriteArraySet<?> concurrentSet) {
|
||||
this.concurrentSet = concurrentSet;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.TreeSet;
|
|||
* @author Juergen Hoeller
|
||||
* @since 11.11.2003
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class IndexedTestBean {
|
||||
|
||||
private TestBean[] array;
|
||||
|
@ -57,6 +58,7 @@ public class IndexedTestBean {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void populate() {
|
||||
TestBean tb0 = new TestBean("name0", 0);
|
||||
TestBean tb1 = new TestBean("name1", 0);
|
||||
|
|
Loading…
Reference in New Issue