revised static annotation check

This commit is contained in:
Juergen Hoeller
2009-07-21 14:12:16 +00:00
parent b2f9786ee8
commit 364641e9bc
11 changed files with 56 additions and 34 deletions

View File

@@ -898,7 +898,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
return getBeanFactory().isTypeMatch(name, targetType);
}
public Class getType(String name) throws NoSuchBeanDefinitionException {
public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
return getBeanFactory().getType(name);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 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.
@@ -21,7 +21,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
@@ -153,7 +152,7 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac
return (targetType == null || (type != null && targetType.isAssignableFrom(type)));
}
public Class getType(String name) throws NoSuchBeanDefinitionException {
public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
try {
return doGetType(name);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 the original author or authors.
* Copyright 2002-2009 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.
@@ -16,14 +16,14 @@
package org.springframework.aop.config;
import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
import java.lang.reflect.Method;
import static org.easymock.EasyMock.*;
import org.junit.After;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
/**
@@ -107,7 +107,7 @@ public final class MethodLocatingFactoryBeanTests {
@Test
public void testSunnyDayPath() throws Exception {
expect(beanFactory.getType(BEAN_NAME)).andReturn(String.class);
expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class);
replay(beanFactory);
factory.setTargetBeanName(BEAN_NAME);
@@ -117,12 +117,12 @@ public final class MethodLocatingFactoryBeanTests {
assertNotNull(result);
assertTrue(result instanceof Method);
Method method = (Method) result;
assertEquals("Bingo", method.invoke("Bingo", new Object[]{}));
assertEquals("Bingo", method.invoke("Bingo"));
}
@Test(expected=IllegalArgumentException.class)
public void testWhereMethodCannotBeResolved() {
expect(beanFactory.getType(BEAN_NAME)).andReturn(String.class);
expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class);
replay(beanFactory);
factory.setTargetBeanName(BEAN_NAME);