Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing generics or deprecated code. Also add the `-Werror` compiler option to ensure that any future warnings will fail the build. Issue: SPR-11064
This commit is contained in:
@@ -89,7 +89,7 @@ public class ConcurrentMapCache implements Cache {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConcurrentMap getNativeCache() {
|
||||
public ConcurrentMap<Object, Object> getNativeCache() {
|
||||
return this.store;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,11 +127,13 @@ public class AnnotatedBeanDefinitionReader {
|
||||
registerBean(annotatedClass, null, (Class<? extends Annotation>[]) null);
|
||||
}
|
||||
|
||||
public void registerBean(Class<?> annotatedClass, Class<? extends Annotation>... qualifiers) {
|
||||
public void registerBean(Class<?> annotatedClass,
|
||||
@SuppressWarnings("unchecked") Class<? extends Annotation>... qualifiers) {
|
||||
registerBean(annotatedClass, null, qualifiers);
|
||||
}
|
||||
|
||||
public void registerBean(Class<?> annotatedClass, String name, Class<? extends Annotation>... qualifiers) {
|
||||
public void registerBean(Class<?> annotatedClass, String name,
|
||||
@SuppressWarnings("unchecked") Class<? extends Annotation>... qualifiers) {
|
||||
AnnotatedGenericBeanDefinition abd = new AnnotatedGenericBeanDefinition(annotatedClass);
|
||||
if (this.conditionEvaluator.shouldSkip(abd.getMetadata())) {
|
||||
return;
|
||||
|
||||
@@ -604,7 +604,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
}
|
||||
if (StringUtils.hasLength(this.wsdlLocation)) {
|
||||
try {
|
||||
Constructor<?> ctor = this.lookupType.getConstructor(new Class[] {URL.class, QName.class});
|
||||
Constructor<?> ctor = this.lookupType.getConstructor(new Class<?>[] {URL.class, QName.class});
|
||||
WebServiceClient clientAnn = this.lookupType.getAnnotation(WebServiceClient.class);
|
||||
if (clientAnn == null) {
|
||||
throw new IllegalStateException("JAX-WS Service class [" + this.lookupType.getName() +
|
||||
|
||||
@@ -240,7 +240,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser {
|
||||
return new RegexPatternTypeFilter(Pattern.compile(expression));
|
||||
}
|
||||
else if ("custom".equals(filterType)) {
|
||||
Class filterClass = classLoader.loadClass(expression);
|
||||
Class<?> filterClass = classLoader.loadClass(expression);
|
||||
if (!TypeFilter.class.isAssignableFrom(filterClass)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Class is not assignable to [" + TypeFilter.class.getName() + "]: " + expression);
|
||||
@@ -257,7 +257,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object instantiateUserDefinedStrategy(String className, Class strategyType, ClassLoader classLoader) {
|
||||
private Object instantiateUserDefinedStrategy(String className, Class<?> strategyType, ClassLoader classLoader) {
|
||||
Object result = null;
|
||||
try {
|
||||
result = classLoader.loadClass(className).newInstance();
|
||||
|
||||
@@ -103,7 +103,7 @@ class ConfigurationClassEnhancer {
|
||||
private Enhancer newEnhancer(Class<?> superclass) {
|
||||
Enhancer enhancer = new Enhancer();
|
||||
enhancer.setSuperclass(superclass);
|
||||
enhancer.setInterfaces(new Class[] {EnhancedConfiguration.class});
|
||||
enhancer.setInterfaces(new Class<?>[] {EnhancedConfiguration.class});
|
||||
enhancer.setUseFactory(false);
|
||||
enhancer.setCallbackFilter(CALLBACK_FILTER);
|
||||
enhancer.setCallbackTypes(CALLBACK_FILTER.getCallbackTypes());
|
||||
|
||||
@@ -672,7 +672,7 @@ class ConfigurationClassParser {
|
||||
|
||||
public boolean isAssignable(Class<?> clazz) throws IOException {
|
||||
if (this.source instanceof Class) {
|
||||
return clazz.isAssignableFrom((Class) this.source);
|
||||
return clazz.isAssignableFrom((Class<?>) this.source);
|
||||
}
|
||||
return new AssignableTypeFilter(clazz).match((MetadataReader) this.source, metadataReaderFactory);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Jsr330ScopeMetadataResolver implements ScopeMetadataResolver {
|
||||
* @param annotationType the JSR-330 annotation type as a Class
|
||||
* @param scopeName the Spring scope name
|
||||
*/
|
||||
public final void registerScope(Class annotationType, String scopeName) {
|
||||
public final void registerScope(Class<?> annotationType, String scopeName) {
|
||||
this.scopeMap.put(annotationType.getName(), scopeName);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,9 +91,12 @@ public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoade
|
||||
// No aop.xml present on the classpath -> treat as 'disabled'
|
||||
break;
|
||||
}
|
||||
// aop.xml is present on the classpath -> fall through and enable
|
||||
// aop.xml is present on the classpath -> enable
|
||||
AspectJWeavingEnabler.enableAspectJWeaving(loadTimeWeaver, this.beanClassLoader);
|
||||
break;
|
||||
case ENABLED:
|
||||
AspectJWeavingEnabler.enableAspectJWeaving(loadTimeWeaver, this.beanClassLoader);
|
||||
break;
|
||||
}
|
||||
|
||||
return loadTimeWeaver;
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
class PropertyOverrideBeanDefinitionParser extends AbstractPropertyLoadingBeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
protected Class getBeanClass(Element element) {
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return PropertyOverrideConfigurer.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
|
||||
|
||||
|
||||
@Override
|
||||
public void addApplicationListener(ApplicationListener listener) {
|
||||
public void addApplicationListener(ApplicationListener<?> listener) {
|
||||
synchronized (this.defaultRetriever) {
|
||||
this.defaultRetriever.applicationListeners.add(listener);
|
||||
this.retrieverCache.clear();
|
||||
@@ -77,7 +77,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeApplicationListener(ApplicationListener listener) {
|
||||
public void removeApplicationListener(ApplicationListener<?> listener) {
|
||||
synchronized (this.defaultRetriever) {
|
||||
this.defaultRetriever.applicationListeners.remove(listener);
|
||||
this.retrieverCache.clear();
|
||||
@@ -120,7 +120,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
|
||||
* @return a Collection of ApplicationListeners
|
||||
* @see org.springframework.context.ApplicationListener
|
||||
*/
|
||||
protected Collection<ApplicationListener> getApplicationListeners() {
|
||||
protected Collection<ApplicationListener<?>> getApplicationListeners() {
|
||||
synchronized (this.defaultRetriever) {
|
||||
return this.defaultRetriever.getApplicationListeners();
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
|
||||
* @return a Collection of ApplicationListeners
|
||||
* @see org.springframework.context.ApplicationListener
|
||||
*/
|
||||
protected Collection<ApplicationListener> getApplicationListeners(ApplicationEvent event) {
|
||||
protected Collection<ApplicationListener<?>> getApplicationListeners(ApplicationEvent event) {
|
||||
Class<? extends ApplicationEvent> eventType = event.getClass();
|
||||
Object source = event.getSource();
|
||||
Class<?> sourceType = (source != null ? source.getClass() : null);
|
||||
@@ -145,14 +145,14 @@ public abstract class AbstractApplicationEventMulticaster implements Application
|
||||
}
|
||||
else {
|
||||
retriever = new ListenerRetriever(true);
|
||||
LinkedList<ApplicationListener> allListeners = new LinkedList<ApplicationListener>();
|
||||
Set<ApplicationListener> listeners;
|
||||
LinkedList<ApplicationListener<?>> allListeners = new LinkedList<ApplicationListener<?>>();
|
||||
Set<ApplicationListener<?>> listeners;
|
||||
Set<String> listenerBeans;
|
||||
synchronized (this.defaultRetriever) {
|
||||
listeners = new LinkedHashSet<ApplicationListener>(this.defaultRetriever.applicationListeners);
|
||||
listeners = new LinkedHashSet<ApplicationListener<?>>(this.defaultRetriever.applicationListeners);
|
||||
listenerBeans = new LinkedHashSet<String>(this.defaultRetriever.applicationListenerBeans);
|
||||
}
|
||||
for (ApplicationListener listener : listeners) {
|
||||
for (ApplicationListener<?> listener : listeners) {
|
||||
if (supportsEvent(listener, eventType, sourceType)) {
|
||||
retriever.applicationListeners.add(listener);
|
||||
allListeners.add(listener);
|
||||
@@ -162,7 +162,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
|
||||
BeanFactory beanFactory = getBeanFactory();
|
||||
for (String listenerBeanName : listenerBeans) {
|
||||
try {
|
||||
ApplicationListener listener = beanFactory.getBean(listenerBeanName, ApplicationListener.class);
|
||||
ApplicationListener<?> listener = beanFactory.getBean(listenerBeanName, ApplicationListener.class);
|
||||
if (!allListeners.contains(listener) && supportsEvent(listener, eventType, sourceType)) {
|
||||
retriever.applicationListenerBeans.add(listenerBeanName);
|
||||
allListeners.add(listener);
|
||||
@@ -192,8 +192,8 @@ public abstract class AbstractApplicationEventMulticaster implements Application
|
||||
* @return whether the given listener should be included in the
|
||||
* candidates for the given event type
|
||||
*/
|
||||
protected boolean supportsEvent(
|
||||
ApplicationListener listener, Class<? extends ApplicationEvent> eventType, Class sourceType) {
|
||||
protected boolean supportsEvent(ApplicationListener<?> listener,
|
||||
Class<? extends ApplicationEvent> eventType, Class<?> sourceType) {
|
||||
|
||||
SmartApplicationListener smartListener = (listener instanceof SmartApplicationListener ?
|
||||
(SmartApplicationListener) listener : new GenericApplicationListenerAdapter(listener));
|
||||
@@ -239,28 +239,28 @@ public abstract class AbstractApplicationEventMulticaster implements Application
|
||||
*/
|
||||
private class ListenerRetriever {
|
||||
|
||||
public final Set<ApplicationListener> applicationListeners;
|
||||
public final Set<ApplicationListener<?>> applicationListeners;
|
||||
|
||||
public final Set<String> applicationListenerBeans;
|
||||
|
||||
private final boolean preFiltered;
|
||||
|
||||
public ListenerRetriever(boolean preFiltered) {
|
||||
this.applicationListeners = new LinkedHashSet<ApplicationListener>();
|
||||
this.applicationListeners = new LinkedHashSet<ApplicationListener<?>>();
|
||||
this.applicationListenerBeans = new LinkedHashSet<String>();
|
||||
this.preFiltered = preFiltered;
|
||||
}
|
||||
|
||||
public Collection<ApplicationListener> getApplicationListeners() {
|
||||
LinkedList<ApplicationListener> allListeners = new LinkedList<ApplicationListener>();
|
||||
for (ApplicationListener listener : this.applicationListeners) {
|
||||
public Collection<ApplicationListener<?>> getApplicationListeners() {
|
||||
LinkedList<ApplicationListener<?>> allListeners = new LinkedList<ApplicationListener<?>>();
|
||||
for (ApplicationListener<?> listener : this.applicationListeners) {
|
||||
allListeners.add(listener);
|
||||
}
|
||||
if (!this.applicationListenerBeans.isEmpty()) {
|
||||
BeanFactory beanFactory = getBeanFactory();
|
||||
for (String listenerBeanName : this.applicationListenerBeans) {
|
||||
try {
|
||||
ApplicationListener listener = beanFactory.getBean(listenerBeanName, ApplicationListener.class);
|
||||
ApplicationListener<?> listener = beanFactory.getBean(listenerBeanName, ApplicationListener.class);
|
||||
if (this.preFiltered || !allListeners.contains(listener)) {
|
||||
allListeners.add(listener);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface ApplicationEventMulticaster {
|
||||
* Add a listener to be notified of all events.
|
||||
* @param listener the listener to add
|
||||
*/
|
||||
void addApplicationListener(ApplicationListener listener);
|
||||
void addApplicationListener(ApplicationListener<?> listener);
|
||||
|
||||
/**
|
||||
* Add a listener bean to be notified of all events.
|
||||
@@ -48,7 +48,7 @@ public interface ApplicationEventMulticaster {
|
||||
* Remove a listener from the notification list.
|
||||
* @param listener the listener to remove
|
||||
*/
|
||||
void removeApplicationListener(ApplicationListener listener);
|
||||
void removeApplicationListener(ApplicationListener<?> listener);
|
||||
|
||||
/**
|
||||
* Remove a listener bean from the notification list.
|
||||
|
||||
@@ -48,7 +48,7 @@ import org.springframework.context.ApplicationEventPublisherAware;
|
||||
public class EventPublicationInterceptor
|
||||
implements MethodInterceptor, ApplicationEventPublisherAware, InitializingBean {
|
||||
|
||||
private Constructor applicationEventClassConstructor;
|
||||
private Constructor<?> applicationEventClassConstructor;
|
||||
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
@@ -62,14 +62,14 @@ public class EventPublicationInterceptor
|
||||
* {@code null} or if it is not an {@code ApplicationEvent} subclass or
|
||||
* if it does not expose a constructor that takes a single {@code Object} argument
|
||||
*/
|
||||
public void setApplicationEventClass(Class applicationEventClass) {
|
||||
public void setApplicationEventClass(Class<?> applicationEventClass) {
|
||||
if (ApplicationEvent.class.equals(applicationEventClass) ||
|
||||
!ApplicationEvent.class.isAssignableFrom(applicationEventClass)) {
|
||||
throw new IllegalArgumentException("applicationEventClass needs to extend ApplicationEvent");
|
||||
}
|
||||
try {
|
||||
this.applicationEventClassConstructor =
|
||||
applicationEventClass.getConstructor(new Class[] {Object.class});
|
||||
applicationEventClass.getConstructor(new Class<?>[] {Object.class});
|
||||
}
|
||||
catch (NoSuchMethodException ex) {
|
||||
throw new IllegalArgumentException("applicationEventClass [" +
|
||||
|
||||
@@ -33,21 +33,21 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class GenericApplicationListenerAdapter implements SmartApplicationListener {
|
||||
|
||||
private final ApplicationListener delegate;
|
||||
private final ApplicationListener<ApplicationEvent> delegate;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new GenericApplicationListener for the given delegate.
|
||||
* @param delegate the delegate listener to be invoked
|
||||
*/
|
||||
public GenericApplicationListenerAdapter(ApplicationListener delegate) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public GenericApplicationListenerAdapter(ApplicationListener<?> delegate) {
|
||||
Assert.notNull(delegate, "Delegate listener must not be null");
|
||||
this.delegate = delegate;
|
||||
this.delegate = (ApplicationListener<ApplicationEvent>) delegate;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
this.delegate.onApplicationEvent(event);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class SimpleApplicationEventMulticaster extends AbstractApplicationEventM
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void multicastEvent(final ApplicationEvent event) {
|
||||
for (final ApplicationListener listener : getApplicationListeners(event)) {
|
||||
Executor executor = getTaskExecutor();
|
||||
|
||||
@@ -45,7 +45,7 @@ public class SourceFilteringListener implements SmartApplicationListener {
|
||||
* @param delegate the delegate listener to invoke with event
|
||||
* from the specified source
|
||||
*/
|
||||
public SourceFilteringListener(Object source, ApplicationListener delegate) {
|
||||
public SourceFilteringListener(Object source, ApplicationListener<?> delegate) {
|
||||
this.source = source;
|
||||
this.delegate = (delegate instanceof SmartApplicationListener ?
|
||||
(SmartApplicationListener) delegate : new GenericApplicationListenerAdapter(delegate));
|
||||
|
||||
@@ -53,8 +53,8 @@ public class BeanExpressionContextAccessor implements PropertyAccessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class[] getSpecificTargetClasses() {
|
||||
return new Class[] {BeanExpressionContext.class};
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class<?>[] {BeanExpressionContext.class};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ public class BeanFactoryAccessor implements PropertyAccessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class[] getSpecificTargetClasses() {
|
||||
return new Class[] {BeanFactory.class};
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class<?>[] {BeanFactory.class};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class EnvironmentAccessor implements PropertyAccessor {
|
||||
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class[] { Environment.class };
|
||||
return new Class<?>[] { Environment.class };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,13 +35,13 @@ public class MapAccessor implements PropertyAccessor {
|
||||
|
||||
@Override
|
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
Map map = (Map) target;
|
||||
Map<?, ?> map = (Map<?, ?>) target;
|
||||
return map.containsKey(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
Map map = (Map) target;
|
||||
Map<?, ?> map = (Map<?, ?>) target;
|
||||
Object value = map.get(name);
|
||||
if (value == null && !map.containsKey(name)) {
|
||||
throw new MapAccessException(name);
|
||||
@@ -57,13 +57,13 @@ public class MapAccessor implements PropertyAccessor {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
|
||||
Map map = (Map) target;
|
||||
Map<Object, Object> map = (Map<Object, Object>) target;
|
||||
map.put(name, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class[] getSpecificTargetClasses() {
|
||||
return new Class[] {Map.class};
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return new Class<?>[] {Map.class};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public abstract class ApplicationObjectSupport implements ApplicationContextAwar
|
||||
* Can be overridden in subclasses.
|
||||
* @see #setApplicationContext
|
||||
*/
|
||||
protected Class requiredContextClass() {
|
||||
protected Class<?> requiredContextClass() {
|
||||
return ApplicationContext.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContex
|
||||
* @see org.springframework.context.support.GenericApplicationContext
|
||||
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader
|
||||
*/
|
||||
public ClassPathXmlApplicationContext(String path, Class clazz) throws BeansException {
|
||||
public ClassPathXmlApplicationContext(String path, Class<?> clazz) throws BeansException {
|
||||
this(new String[] {path}, clazz);
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContex
|
||||
* @see org.springframework.context.support.GenericApplicationContext
|
||||
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader
|
||||
*/
|
||||
public ClassPathXmlApplicationContext(String[] paths, Class clazz) throws BeansException {
|
||||
public ClassPathXmlApplicationContext(String[] paths, Class<?> clazz) throws BeansException {
|
||||
this(paths, clazz, null);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContex
|
||||
* @see org.springframework.context.support.GenericApplicationContext
|
||||
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader
|
||||
*/
|
||||
public ClassPathXmlApplicationContext(String[] paths, Class clazz, ApplicationContext parent)
|
||||
public ClassPathXmlApplicationContext(String[] paths, Class<?> clazz, ApplicationContext parent)
|
||||
throws BeansException {
|
||||
|
||||
super(parent);
|
||||
|
||||
@@ -42,7 +42,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
|
||||
|
||||
static {
|
||||
try {
|
||||
findLoadedClassMethod = ClassLoader.class.getDeclaredMethod("findLoadedClass", new Class[] {String.class});
|
||||
findLoadedClassMethod = ClassLoader.class.getDeclaredMethod("findLoadedClass", new Class<?>[] {String.class});
|
||||
}
|
||||
catch (NoSuchMethodException ex) {
|
||||
throw new IllegalStateException("Invalid [java.lang.ClassLoader] class: no 'findLoadedClass' method defined!");
|
||||
@@ -59,12 +59,12 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class loadClass(String name) throws ClassNotFoundException {
|
||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
return new ContextOverridingClassLoader(getParent()).loadClass(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClassReloadable(Class clazz) {
|
||||
public boolean isClassReloadable(Class<?> clazz) {
|
||||
return (clazz.getClassLoader() instanceof ContextOverridingClassLoader);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class loadClassForOverriding(String name) throws ClassNotFoundException {
|
||||
protected Class<?> loadClassForOverriding(String name) throws ClassNotFoundException {
|
||||
byte[] bytes = bytesCache.get(name);
|
||||
if (bytes == null) {
|
||||
bytes = loadBytesForClass(name);
|
||||
|
||||
@@ -371,7 +371,7 @@ class PostProcessorRegistrationDelegate {
|
||||
public void postProcessBeforeDestruction(Object bean, String beanName) {
|
||||
if (bean instanceof ApplicationListener) {
|
||||
ApplicationEventMulticaster multicaster = this.applicationContext.getApplicationEventMulticaster();
|
||||
multicaster.removeApplicationListener((ApplicationListener) bean);
|
||||
multicaster.removeApplicationListener((ApplicationListener<?>) bean);
|
||||
multicaster.removeApplicationListenerBean(beanName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,9 +330,9 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
|
||||
Properties mergedProps = new Properties();
|
||||
mergedHolder = new PropertiesHolder(mergedProps, -1);
|
||||
for (int i = this.basenames.length - 1; i >= 0; i--) {
|
||||
List filenames = calculateAllFilenames(this.basenames[i], locale);
|
||||
List<String> filenames = calculateAllFilenames(this.basenames[i], locale);
|
||||
for (int j = filenames.size() - 1; j >= 0; j--) {
|
||||
String filename = (String) filenames.get(j);
|
||||
String filename = filenames.get(j);
|
||||
PropertiesHolder propHolder = getProperties(filename);
|
||||
if (propHolder.getProperties() != null) {
|
||||
mergedProps.putAll(propHolder.getProperties());
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SimpleThreadScope implements Scope {
|
||||
};
|
||||
|
||||
@Override
|
||||
public Object get(String name, ObjectFactory objectFactory) {
|
||||
public Object get(String name, ObjectFactory<?> objectFactory) {
|
||||
Map<String, Object> scope = threadScope.get();
|
||||
Object object = scope.get(name);
|
||||
if (object == null) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class StaticApplicationContext extends GenericApplicationContext {
|
||||
* <p>For more advanced needs, register with the underlying BeanFactory directly.
|
||||
* @see #getDefaultListableBeanFactory
|
||||
*/
|
||||
public void registerSingleton(String name, Class clazz) throws BeansException {
|
||||
public void registerSingleton(String name, Class<?> clazz) throws BeansException {
|
||||
GenericBeanDefinition bd = new GenericBeanDefinition();
|
||||
bd.setBeanClass(clazz);
|
||||
getDefaultListableBeanFactory().registerBeanDefinition(name, bd);
|
||||
@@ -100,7 +100,7 @@ public class StaticApplicationContext extends GenericApplicationContext {
|
||||
* <p>For more advanced needs, register with the underlying BeanFactory directly.
|
||||
* @see #getDefaultListableBeanFactory
|
||||
*/
|
||||
public void registerSingleton(String name, Class clazz, MutablePropertyValues pvs) throws BeansException {
|
||||
public void registerSingleton(String name, Class<?> clazz, MutablePropertyValues pvs) throws BeansException {
|
||||
GenericBeanDefinition bd = new GenericBeanDefinition();
|
||||
bd.setBeanClass(clazz);
|
||||
bd.setPropertyValues(pvs);
|
||||
@@ -112,7 +112,7 @@ public class StaticApplicationContext extends GenericApplicationContext {
|
||||
* <p>For more advanced needs, register with the underlying BeanFactory directly.
|
||||
* @see #getDefaultListableBeanFactory
|
||||
*/
|
||||
public void registerPrototype(String name, Class clazz) throws BeansException {
|
||||
public void registerPrototype(String name, Class<?> clazz) throws BeansException {
|
||||
GenericBeanDefinition bd = new GenericBeanDefinition();
|
||||
bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE);
|
||||
bd.setBeanClass(clazz);
|
||||
@@ -124,7 +124,7 @@ public class StaticApplicationContext extends GenericApplicationContext {
|
||||
* <p>For more advanced needs, register with the underlying BeanFactory directly.
|
||||
* @see #getDefaultListableBeanFactory
|
||||
*/
|
||||
public void registerPrototype(String name, Class clazz, MutablePropertyValues pvs) throws BeansException {
|
||||
public void registerPrototype(String name, Class<?> clazz, MutablePropertyValues pvs) throws BeansException {
|
||||
GenericBeanDefinition bd = new GenericBeanDefinition();
|
||||
bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE);
|
||||
bd.setBeanClass(clazz);
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.remoting.rmi.RmiClientInterceptorUtils;
|
||||
*/
|
||||
public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbInvokerInterceptor {
|
||||
|
||||
private Class homeInterface;
|
||||
private Class<?> homeInterface;
|
||||
|
||||
private boolean refreshHomeOnConnectFailure = false;
|
||||
|
||||
@@ -60,7 +60,7 @@ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbI
|
||||
* sufficient to make a WebSphere 5.0 Remote SLSB work. On other servers,
|
||||
* the specific home interface for the target SLSB might be necessary.
|
||||
*/
|
||||
public void setHomeInterface(Class homeInterface) {
|
||||
public void setHomeInterface(Class<?> homeInterface) {
|
||||
if (homeInterface != null && !homeInterface.isInterface()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Home interface class [" + homeInterface.getClass() + "] is not an interface");
|
||||
|
||||
@@ -52,7 +52,7 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter
|
||||
implements FactoryBean<Object>, BeanClassLoaderAware {
|
||||
|
||||
/** The business interface of the EJB we're proxying */
|
||||
private Class businessInterface;
|
||||
private Class<?> businessInterface;
|
||||
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
@@ -66,14 +66,14 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter
|
||||
* Using a business methods interface is a best practice when implementing EJBs.
|
||||
* @param businessInterface set the business interface of the EJB
|
||||
*/
|
||||
public void setBusinessInterface(Class businessInterface) {
|
||||
public void setBusinessInterface(Class<?> businessInterface) {
|
||||
this.businessInterface = businessInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the business interface of the EJB we're proxying.
|
||||
*/
|
||||
public Class getBusinessInterface() {
|
||||
public Class<?> getBusinessInterface() {
|
||||
return this.businessInterface;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl
|
||||
implements FactoryBean<Object>, BeanClassLoaderAware {
|
||||
|
||||
/** The business interface of the EJB we're proxying */
|
||||
private Class businessInterface;
|
||||
private Class<?> businessInterface;
|
||||
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
@@ -80,14 +80,14 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl
|
||||
* converted to Spring's generic RemoteAccessException.
|
||||
* @param businessInterface the business interface of the EJB
|
||||
*/
|
||||
public void setBusinessInterface(Class businessInterface) {
|
||||
public void setBusinessInterface(Class<?> businessInterface) {
|
||||
this.businessInterface = businessInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the business interface of the EJB we're proxying.
|
||||
*/
|
||||
public Class getBusinessInterface() {
|
||||
public Class<?> getBusinessInterface() {
|
||||
return this.businessInterface;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class JndiLookupBeanDefinitionParser extends AbstractJndiLocatingBeanDefinitionP
|
||||
|
||||
|
||||
@Override
|
||||
protected Class getBeanClass(Element element) {
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return JndiObjectFactoryBean.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -206,12 +206,13 @@ public class FormattingConversionService extends GenericConversionService
|
||||
|
||||
private Class<? extends Annotation> annotationType;
|
||||
|
||||
private AnnotationFormatterFactory annotationFormatterFactory;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private AnnotationFormatterFactory annotationFormatterFactory;
|
||||
|
||||
private Class<?> fieldType;
|
||||
|
||||
public AnnotationPrinterConverter(Class<? extends Annotation> annotationType,
|
||||
AnnotationFormatterFactory annotationFormatterFactory, Class<?> fieldType) {
|
||||
AnnotationFormatterFactory<?> annotationFormatterFactory, Class<?> fieldType) {
|
||||
this.annotationType = annotationType;
|
||||
this.annotationFormatterFactory = annotationFormatterFactory;
|
||||
this.fieldType = fieldType;
|
||||
@@ -254,6 +255,7 @@ public class FormattingConversionService extends GenericConversionService
|
||||
|
||||
private Class<? extends Annotation> annotationType;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private AnnotationFormatterFactory annotationFormatterFactory;
|
||||
|
||||
private Class<?> fieldType;
|
||||
|
||||
@@ -98,14 +98,14 @@ public class ReflectiveLoadTimeWeaver implements LoadTimeWeaver {
|
||||
this.classLoader = classLoader;
|
||||
this.addTransformerMethod = ClassUtils.getMethodIfAvailable(
|
||||
this.classLoader.getClass(), ADD_TRANSFORMER_METHOD_NAME,
|
||||
new Class[] {ClassFileTransformer.class});
|
||||
new Class<?>[] {ClassFileTransformer.class});
|
||||
if (this.addTransformerMethod == null) {
|
||||
throw new IllegalStateException(
|
||||
"ClassLoader [" + classLoader.getClass().getName() + "] does NOT provide an " +
|
||||
"'addTransformer(ClassFileTransformer)' method.");
|
||||
}
|
||||
this.getThrowawayClassLoaderMethod = ClassUtils.getMethodIfAvailable(
|
||||
this.classLoader.getClass(), GET_THROWAWAY_CLASS_LOADER_METHOD_NAME, new Class[0]);
|
||||
this.classLoader.getClass(), GET_THROWAWAY_CLASS_LOADER_METHOD_NAME, new Class<?>[0]);
|
||||
// getThrowawayClassLoader method is optional
|
||||
if (this.getThrowawayClassLoaderMethod == null) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ShadowingClassLoader extends DecoratingClassLoader {
|
||||
|
||||
private final List<ClassFileTransformer> classFileTransformers = new LinkedList<ClassFileTransformer>();
|
||||
|
||||
private final Map<String, Class> classCache = new HashMap<String, Class>();
|
||||
private final Map<String, Class<?>> classCache = new HashMap<String, Class<?>>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -96,7 +96,7 @@ public class ShadowingClassLoader extends DecoratingClassLoader {
|
||||
@Override
|
||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
if (shouldShadow(name)) {
|
||||
Class cls = this.classCache.get(name);
|
||||
Class<?> cls = this.classCache.get(name);
|
||||
if (cls != null) {
|
||||
return cls;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class ShadowingClassLoader extends DecoratingClassLoader {
|
||||
}
|
||||
|
||||
|
||||
private Class doLoadClass(String name) throws ClassNotFoundException {
|
||||
private Class<?> doLoadClass(String name) throws ClassNotFoundException {
|
||||
String internalName = StringUtils.replace(name, ".", "/") + ".class";
|
||||
InputStream is = this.enclosingClassLoader.getResourceAsStream(internalName);
|
||||
if (is == null) {
|
||||
@@ -138,7 +138,7 @@ public class ShadowingClassLoader extends DecoratingClassLoader {
|
||||
try {
|
||||
byte[] bytes = FileCopyUtils.copyToByteArray(is);
|
||||
bytes = applyTransformers(name, bytes);
|
||||
Class cls = defineClass(name, bytes, 0, bytes.length);
|
||||
Class<?> cls = defineClass(name, bytes, 0, bytes.length);
|
||||
// Additional check for defining the package, if not defined yet.
|
||||
if (cls.getPackage() == null) {
|
||||
int packageSeparator = name.lastIndexOf('.');
|
||||
|
||||
@@ -131,7 +131,7 @@ class JBossMCAdapter implements JBossClassLoaderAdapter {
|
||||
public void addTransformer(ClassFileTransformer transformer) {
|
||||
InvocationHandler adapter = new JBossMCTranslatorAdapter(transformer);
|
||||
Object adapterInstance = Proxy.newProxyInstance(this.translatorClass.getClassLoader(),
|
||||
new Class[] { this.translatorClass }, adapter);
|
||||
new Class<?>[] { this.translatorClass }, adapter);
|
||||
|
||||
try {
|
||||
addTranslator.invoke(target, adapterInstance);
|
||||
|
||||
@@ -43,7 +43,7 @@ class WebLogicClassLoaderAdapter {
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
private final Class wlPreProcessorClass;
|
||||
private final Class<?> wlPreProcessorClass;
|
||||
|
||||
private final Method addPreProcessorMethod;
|
||||
|
||||
@@ -51,11 +51,11 @@ class WebLogicClassLoaderAdapter {
|
||||
|
||||
private final Method getParentMethod;
|
||||
|
||||
private final Constructor wlGenericClassLoaderConstructor;
|
||||
private final Constructor<?> wlGenericClassLoaderConstructor;
|
||||
|
||||
|
||||
public WebLogicClassLoaderAdapter(ClassLoader classLoader) {
|
||||
Class wlGenericClassLoaderClass = null;
|
||||
Class<?> wlGenericClassLoaderClass = null;
|
||||
try {
|
||||
wlGenericClassLoaderClass = classLoader.loadClass(GENERIC_CLASS_LOADER_NAME);
|
||||
this.wlPreProcessorClass = classLoader.loadClass(CLASS_PRE_PROCESSOR_NAME);
|
||||
@@ -81,7 +81,7 @@ class WebLogicClassLoaderAdapter {
|
||||
try {
|
||||
InvocationHandler adapter = new WebLogicClassPreProcessorAdapter(transformer, this.classLoader);
|
||||
Object adapterInstance = Proxy.newProxyInstance(this.wlPreProcessorClass.getClassLoader(),
|
||||
new Class[] {this.wlPreProcessorClass}, adapter);
|
||||
new Class<?>[] {this.wlPreProcessorClass}, adapter);
|
||||
this.addPreProcessorMethod.invoke(this.classLoader, adapterInstance);
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
|
||||
@@ -60,7 +60,7 @@ class WebLogicClassPreProcessorAdapter implements InvocationHandler {
|
||||
} else if ("toString".equals(name)) {
|
||||
return toString();
|
||||
} else if ("initialize".equals(name)) {
|
||||
initialize((Hashtable) args[0]);
|
||||
initialize((Hashtable<?, ?>) args[0]);
|
||||
return null;
|
||||
} else if ("preProcess".equals(name)) {
|
||||
return preProcess((String) args[0], (byte[]) args[1]);
|
||||
@@ -69,7 +69,7 @@ class WebLogicClassPreProcessorAdapter implements InvocationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public void initialize(Hashtable params) {
|
||||
public void initialize(Hashtable<?, ?> params) {
|
||||
}
|
||||
|
||||
public byte[] preProcess(String className, byte[] classBytes) {
|
||||
|
||||
@@ -79,7 +79,7 @@ class WebSphereClassLoaderAdapter {
|
||||
try {
|
||||
InvocationHandler adapter = new WebSphereClassPreDefinePlugin(transformer);
|
||||
Object adapterInstance = Proxy.newProxyInstance(this.wsPreProcessorClass.getClassLoader(),
|
||||
new Class[] { this.wsPreProcessorClass }, adapter);
|
||||
new Class<?>[] { this.wsPreProcessorClass }, adapter);
|
||||
this.addPreDefinePlugin.invoke(this.classLoader, adapterInstance);
|
||||
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class MBeanClientInterceptor
|
||||
|
||||
private boolean useStrictCasing = true;
|
||||
|
||||
private Class managementInterface;
|
||||
private Class<?> managementInterface;
|
||||
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
@@ -215,7 +215,7 @@ public class MBeanClientInterceptor
|
||||
* setters and getters for MBean attributes and conventional Java methods
|
||||
* for MBean operations.
|
||||
*/
|
||||
public void setManagementInterface(Class managementInterface) {
|
||||
public void setManagementInterface(Class<?> managementInterface) {
|
||||
this.managementInterface = managementInterface;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ public class MBeanClientInterceptor
|
||||
* Return the management interface of the target MBean,
|
||||
* or {@code null} if none specified.
|
||||
*/
|
||||
protected final Class getManagementInterface() {
|
||||
protected final Class<?> getManagementInterface() {
|
||||
return this.managementInterface;
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ public class MBeanClientInterceptor
|
||||
MBeanOperationInfo[] operationInfo = info.getOperations();
|
||||
this.allowedOperations = new HashMap<MethodCacheKey, MBeanOperationInfo>(operationInfo.length);
|
||||
for (MBeanOperationInfo infoEle : operationInfo) {
|
||||
Class[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
|
||||
Class<?>[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
|
||||
this.allowedOperations.put(new MethodCacheKey(infoEle.getName(), paramTypes), infoEle);
|
||||
}
|
||||
}
|
||||
@@ -534,7 +534,7 @@ public class MBeanClientInterceptor
|
||||
* is necessary
|
||||
*/
|
||||
protected Object convertResultValueIfNecessary(Object result, MethodParameter parameter) {
|
||||
Class targetClass = parameter.getParameterType();
|
||||
Class<?> targetClass = parameter.getParameterType();
|
||||
try {
|
||||
if (result == null) {
|
||||
return null;
|
||||
@@ -552,7 +552,7 @@ public class MBeanClientInterceptor
|
||||
return convertDataArrayToTargetArray(array, targetClass);
|
||||
}
|
||||
else if (Collection.class.isAssignableFrom(targetClass)) {
|
||||
Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
|
||||
Class<?> elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
|
||||
if (elementType != null) {
|
||||
return convertDataArrayToTargetCollection(array, targetClass, elementType);
|
||||
}
|
||||
@@ -568,7 +568,7 @@ public class MBeanClientInterceptor
|
||||
return convertDataArrayToTargetArray(array, targetClass);
|
||||
}
|
||||
else if (Collection.class.isAssignableFrom(targetClass)) {
|
||||
Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
|
||||
Class<?> elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
|
||||
if (elementType != null) {
|
||||
return convertDataArrayToTargetCollection(array, targetClass, elementType);
|
||||
}
|
||||
@@ -584,8 +584,8 @@ public class MBeanClientInterceptor
|
||||
}
|
||||
}
|
||||
|
||||
private Object convertDataArrayToTargetArray(Object[] array, Class targetClass) throws NoSuchMethodException {
|
||||
Class targetType = targetClass.getComponentType();
|
||||
private Object convertDataArrayToTargetArray(Object[] array, Class<?> targetClass) throws NoSuchMethodException {
|
||||
Class<?> targetType = targetClass.getComponentType();
|
||||
Method fromMethod = targetType.getMethod("from", array.getClass().getComponentType());
|
||||
Object resultArray = Array.newInstance(targetType, array.length);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
@@ -594,12 +594,11 @@ public class MBeanClientInterceptor
|
||||
return resultArray;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Collection convertDataArrayToTargetCollection(Object[] array, Class collectionType, Class elementType)
|
||||
private Collection<?> convertDataArrayToTargetCollection(Object[] array, Class<?> collectionType, Class<?> elementType)
|
||||
throws NoSuchMethodException {
|
||||
|
||||
Method fromMethod = elementType.getMethod("from", array.getClass().getComponentType());
|
||||
Collection resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array));
|
||||
Collection<Object> resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array));
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
resultColl.add(ReflectionUtils.invokeMethod(fromMethod, null, array[i]));
|
||||
}
|
||||
@@ -620,7 +619,7 @@ public class MBeanClientInterceptor
|
||||
|
||||
private final String name;
|
||||
|
||||
private final Class[] parameterTypes;
|
||||
private final Class<?>[] parameterTypes;
|
||||
|
||||
/**
|
||||
* Create a new instance of {@code MethodCacheKey} with the supplied
|
||||
@@ -628,9 +627,9 @@ public class MBeanClientInterceptor
|
||||
* @param name the name of the method
|
||||
* @param parameterTypes the arguments in the method signature
|
||||
*/
|
||||
public MethodCacheKey(String name, Class[] parameterTypes) {
|
||||
public MethodCacheKey(String name, Class<?>[] parameterTypes) {
|
||||
this.name = name;
|
||||
this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class[0]);
|
||||
this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class<?>[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ import org.springframework.util.ClassUtils;
|
||||
public class MBeanProxyFactoryBean extends MBeanClientInterceptor
|
||||
implements FactoryBean<Object>, BeanClassLoaderAware, InitializingBean {
|
||||
|
||||
private Class proxyInterface;
|
||||
private Class<?> proxyInterface;
|
||||
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
@@ -62,7 +62,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor
|
||||
* conventional Java methods for MBean operations.
|
||||
* @see #setObjectName
|
||||
*/
|
||||
public void setProxyInterface(Class proxyInterface) {
|
||||
public void setProxyInterface(Class<?> proxyInterface) {
|
||||
this.proxyInterface = proxyInterface;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.management.DynamicMBean;
|
||||
import javax.management.JMException;
|
||||
import javax.management.MBeanException;
|
||||
@@ -746,7 +747,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
|
||||
* @return whether the class qualifies as an MBean
|
||||
* @see org.springframework.jmx.support.JmxUtils#isMBean(Class)
|
||||
*/
|
||||
protected boolean isMBean(Class beanClass) {
|
||||
protected boolean isMBean(Class<?> beanClass) {
|
||||
return JmxUtils.isMBean(beanClass);
|
||||
}
|
||||
|
||||
@@ -760,9 +761,9 @@ public class MBeanExporter extends MBeanRegistrationSupport
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException {
|
||||
Class targetClass = AopUtils.getTargetClass(bean);
|
||||
Class<?> targetClass = AopUtils.getTargetClass(bean);
|
||||
if (targetClass != bean.getClass()) {
|
||||
Class ifc = JmxUtils.getMXBeanInterface(targetClass);
|
||||
Class<Object> ifc = (Class<Object>) JmxUtils.getMXBeanInterface(targetClass);
|
||||
if (ifc != null) {
|
||||
if (!(ifc.isInstance(bean))) {
|
||||
throw new NotCompliantMBeanException("Managed bean [" + bean +
|
||||
@@ -771,7 +772,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
|
||||
return new StandardMBean(bean, ifc, true);
|
||||
}
|
||||
else {
|
||||
ifc = JmxUtils.getMBeanInterface(targetClass);
|
||||
ifc = (Class<Object>) JmxUtils.getMBeanInterface(targetClass);
|
||||
if (ifc != null) {
|
||||
if (!(ifc.isInstance(bean))) {
|
||||
throw new NotCompliantMBeanException("Managed bean [" + bean +
|
||||
@@ -848,7 +849,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
|
||||
private void autodetectBeans(final AutodetectCapableMBeanInfoAssembler assembler) {
|
||||
autodetect(new AutodetectCallback() {
|
||||
@Override
|
||||
public boolean include(Class beanClass, String beanName) {
|
||||
public boolean include(Class<?> beanClass, String beanName) {
|
||||
return assembler.includeBean(beanClass, beanName);
|
||||
}
|
||||
});
|
||||
@@ -861,7 +862,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
|
||||
private void autodetectMBeans() {
|
||||
autodetect(new AutodetectCallback() {
|
||||
@Override
|
||||
public boolean include(Class beanClass, String beanName) {
|
||||
public boolean include(Class<?> beanClass, String beanName) {
|
||||
return isMBean(beanClass);
|
||||
}
|
||||
});
|
||||
@@ -883,7 +884,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
|
||||
for (String beanName : beanNames) {
|
||||
if (!isExcluded(beanName) && !isBeanDefinitionAbstract(this.beanFactory, beanName)) {
|
||||
try {
|
||||
Class beanClass = this.beanFactory.getType(beanName);
|
||||
Class<?> beanClass = this.beanFactory.getType(beanName);
|
||||
if (beanClass != null && callback.include(beanClass, beanName)) {
|
||||
boolean lazyInit = isBeanDefinitionLazyInit(this.beanFactory, beanName);
|
||||
Object beanInstance = (!lazyInit ? this.beanFactory.getBean(beanName) : null);
|
||||
@@ -1069,7 +1070,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
|
||||
* @param beanClass the class of the bean
|
||||
* @param beanName the name of the bean
|
||||
*/
|
||||
boolean include(Class beanClass, String beanName);
|
||||
boolean include(Class<?> beanClass, String beanName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public abstract class AbstractConfigurableMBeanInfoAssembler extends AbstractRef
|
||||
return new ModelMBeanNotificationInfo[] {JmxMetadataUtils.convertToModelMBeanNotificationInfo(mn)};
|
||||
}
|
||||
else if (mapValue instanceof Collection) {
|
||||
Collection col = (Collection) mapValue;
|
||||
Collection<?> col = (Collection<?>) mapValue;
|
||||
List<ModelMBeanNotificationInfo> result = new ArrayList<ModelMBeanNotificationInfo>();
|
||||
for (Object colValue : col) {
|
||||
if (!(colValue instanceof ManagedNotification)) {
|
||||
|
||||
@@ -91,7 +91,7 @@ public abstract class AbstractMBeanInfoAssembler implements MBeanInfoAssembler {
|
||||
* @return the bean class to expose
|
||||
* @see org.springframework.aop.support.AopUtils#getTargetClass(Object)
|
||||
*/
|
||||
protected Class getTargetClass(Object managedBean) {
|
||||
protected Class<?> getTargetClass(Object managedBean) {
|
||||
return AopUtils.getTargetClass(managedBean);
|
||||
}
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
|
||||
* @see #getClassToExpose(Class)
|
||||
* @see org.springframework.aop.framework.AopProxyUtils#proxiedUserInterfaces(Object)
|
||||
*/
|
||||
protected Class getClassForDescriptor(Object managedBean) {
|
||||
protected Class<?> getClassForDescriptor(Object managedBean) {
|
||||
if (AopUtils.isJdkDynamicProxy(managedBean)) {
|
||||
return AopProxyUtils.proxiedUserInterfaces(managedBean)[0];
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
/**
|
||||
* Stores the array of interfaces to use for creating the management interface.
|
||||
*/
|
||||
private Class[] managedInterfaces;
|
||||
private Class<?>[] managedInterfaces;
|
||||
|
||||
/**
|
||||
* Stores the mappings of bean keys to an array of {@code Class}es.
|
||||
@@ -75,7 +75,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
/**
|
||||
* Stores the mappings of bean keys to an array of {@code Class}es.
|
||||
*/
|
||||
private Map<String, Class[]> resolvedInterfaceMappings;
|
||||
private Map<String, Class<?>[]> resolvedInterfaceMappings;
|
||||
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
* Each entry <strong>MUST</strong> be an interface.
|
||||
* @see #setInterfaceMappings
|
||||
*/
|
||||
public void setManagedInterfaces(Class[] managedInterfaces) {
|
||||
public void setManagedInterfaces(Class<?>[] managedInterfaces) {
|
||||
if (managedInterfaces != null) {
|
||||
for (Class<?> ifc : managedInterfaces) {
|
||||
if (!ifc.isInterface()) {
|
||||
@@ -127,12 +127,12 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
* @param mappings the specified interface mappings
|
||||
* @return the resolved interface mappings (with Class objects as values)
|
||||
*/
|
||||
private Map<String, Class[]> resolveInterfaceMappings(Properties mappings) {
|
||||
Map<String, Class[]> resolvedMappings = new HashMap<String, Class[]>(mappings.size());
|
||||
for (Enumeration en = mappings.propertyNames(); en.hasMoreElements();) {
|
||||
private Map<String, Class<?>[]> resolveInterfaceMappings(Properties mappings) {
|
||||
Map<String, Class<?>[]> resolvedMappings = new HashMap<String, Class<?>[]>(mappings.size());
|
||||
for (Enumeration<?> en = mappings.propertyNames(); en.hasMoreElements();) {
|
||||
String beanKey = (String) en.nextElement();
|
||||
String[] classNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
|
||||
Class[] classes = resolveClassNames(classNames, beanKey);
|
||||
Class<?>[] classes = resolveClassNames(classNames, beanKey);
|
||||
resolvedMappings.put(beanKey, classes);
|
||||
}
|
||||
return resolvedMappings;
|
||||
@@ -144,10 +144,10 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
* @param beanKey the bean key that the class names are associated with
|
||||
* @return the resolved Class
|
||||
*/
|
||||
private Class[] resolveClassNames(String[] classNames, String beanKey) {
|
||||
Class[] classes = new Class[classNames.length];
|
||||
private Class<?>[] resolveClassNames(String[] classNames, String beanKey) {
|
||||
Class<?>[] classes = new Class<?>[classNames.length];
|
||||
for (int x = 0; x < classes.length; x++) {
|
||||
Class cls = ClassUtils.resolveClassName(classNames[x].trim(), this.beanClassLoader);
|
||||
Class<?> cls = ClassUtils.resolveClassName(classNames[x].trim(), this.beanClassLoader);
|
||||
if (!cls.isInterface()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Class [" + classNames[x] + "] mapped to bean key [" + beanKey + "] is no interface");
|
||||
@@ -217,7 +217,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
* interface for the given bean.
|
||||
*/
|
||||
private boolean isDeclaredInInterface(Method method, String beanKey) {
|
||||
Class[] ifaces = null;
|
||||
Class<?>[] ifaces = null;
|
||||
|
||||
if (this.resolvedInterfaceMappings != null) {
|
||||
ifaces = this.resolvedInterfaceMappings.get(beanKey);
|
||||
@@ -231,7 +231,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
}
|
||||
|
||||
if (ifaces != null) {
|
||||
for (Class ifc : ifaces) {
|
||||
for (Class<?> ifc : ifaces) {
|
||||
for (Method ifcMethod : ifc.getMethods()) {
|
||||
if (ifcMethod.getName().equals(method.getName()) &&
|
||||
Arrays.equals(ifcMethod.getParameterTypes(), method.getParameterTypes())) {
|
||||
|
||||
@@ -263,7 +263,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
|
||||
}
|
||||
|
||||
MBeanParameterInfo[] parameterInfo = new MBeanParameterInfo[params.length];
|
||||
Class[] methodParameters = method.getParameterTypes();
|
||||
Class<?>[] methodParameters = method.getParameterTypes();
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
ManagedOperationParameter param = params[i];
|
||||
parameterInfo[i] =
|
||||
|
||||
@@ -81,7 +81,7 @@ public class MethodExclusionMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
*/
|
||||
public void setIgnoredMethodMappings(Properties mappings) {
|
||||
this.ignoredMethodMappings = new HashMap<String, Set<String>>();
|
||||
for (Enumeration en = mappings.keys(); en.hasMoreElements();) {
|
||||
for (Enumeration<?> en = mappings.keys(); en.hasMoreElements();) {
|
||||
String beanKey = (String) en.nextElement();
|
||||
String[] methodNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
|
||||
this.ignoredMethodMappings.put(beanKey, new HashSet<String>(Arrays.asList(methodNames)));
|
||||
|
||||
@@ -85,7 +85,7 @@ public class MethodNameBasedMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
*/
|
||||
public void setMethodMappings(Properties mappings) {
|
||||
this.methodMappings = new HashMap<String, Set<String>>();
|
||||
for (Enumeration en = mappings.keys(); en.hasMoreElements();) {
|
||||
for (Enumeration<?> en = mappings.keys(); en.hasMoreElements();) {
|
||||
String beanKey = (String) en.nextElement();
|
||||
String[] methodNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
|
||||
this.methodMappings.put(beanKey, new HashSet<String>(Arrays.asList(methodNames)));
|
||||
|
||||
@@ -50,7 +50,7 @@ public class IdentityNamingStrategy implements ObjectNamingStrategy {
|
||||
@Override
|
||||
public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException {
|
||||
String domain = ClassUtils.getPackageName(managedBean.getClass());
|
||||
Hashtable keys = new Hashtable();
|
||||
Hashtable<String, String> keys = new Hashtable<String, String>();
|
||||
keys.put(TYPE_KEY, ClassUtils.getShortName(managedBean.getClass()));
|
||||
keys.put(HASH_CODE_KEY, ObjectUtils.getIdentityHexString(managedBean));
|
||||
return ObjectNameManager.getInstance(domain, keys);
|
||||
|
||||
@@ -108,7 +108,7 @@ public class MetadataNamingStrategy implements ObjectNamingStrategy, Initializin
|
||||
*/
|
||||
@Override
|
||||
public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException {
|
||||
Class managedClass = AopUtils.getTargetClass(managedBean);
|
||||
Class<?> managedClass = AopUtils.getTargetClass(managedBean);
|
||||
ManagedResource mr = this.attributeSource.getManagedResource(managedClass);
|
||||
|
||||
// Check that an object name has been specified.
|
||||
|
||||
@@ -145,7 +145,7 @@ public abstract class JmxUtils {
|
||||
* @return the parameter types as classes
|
||||
* @throws ClassNotFoundException if a parameter type could not be resolved
|
||||
*/
|
||||
public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException {
|
||||
public static Class<?>[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException {
|
||||
return parameterInfoToTypes(paramInfo, ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
@@ -157,12 +157,12 @@ public abstract class JmxUtils {
|
||||
* @return the parameter types as classes
|
||||
* @throws ClassNotFoundException if a parameter type could not be resolved
|
||||
*/
|
||||
public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader)
|
||||
public static Class<?>[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader)
|
||||
throws ClassNotFoundException {
|
||||
|
||||
Class[] types = null;
|
||||
Class<?>[] types = null;
|
||||
if (paramInfo != null && paramInfo.length > 0) {
|
||||
types = new Class[paramInfo.length];
|
||||
types = new Class<?>[paramInfo.length];
|
||||
for (int x = 0; x < paramInfo.length; x++) {
|
||||
types[x] = ClassUtils.forName(paramInfo[x].getType(), classLoader);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ public abstract class JmxUtils {
|
||||
* @return the signature as array of argument types
|
||||
*/
|
||||
public static String[] getMethodSignature(Method method) {
|
||||
Class[] types = method.getParameterTypes();
|
||||
Class<?>[] types = method.getParameterTypes();
|
||||
String[] signature = new String[types.length];
|
||||
for (int x = 0; x < types.length; x++) {
|
||||
signature[x] = types[x].getName();
|
||||
@@ -282,7 +282,7 @@ public abstract class JmxUtils {
|
||||
return null;
|
||||
}
|
||||
String mbeanInterfaceName = clazz.getName() + MBEAN_SUFFIX;
|
||||
Class[] implementedInterfaces = clazz.getInterfaces();
|
||||
Class<?>[] implementedInterfaces = clazz.getInterfaces();
|
||||
for (Class<?> iface : implementedInterfaces) {
|
||||
if (iface.getName().equals(mbeanInterfaceName)) {
|
||||
return iface;
|
||||
@@ -302,7 +302,7 @@ public abstract class JmxUtils {
|
||||
if (clazz == null || clazz.getSuperclass() == null) {
|
||||
return null;
|
||||
}
|
||||
Class[] implementedInterfaces = clazz.getInterfaces();
|
||||
Class<?>[] implementedInterfaces = clazz.getInterfaces();
|
||||
for (Class<?> iface : implementedInterfaces) {
|
||||
boolean isMxBean = iface.getName().endsWith(MXBEAN_SUFFIX);
|
||||
if (mxBeanAnnotationAvailable) {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class WebSphereMBeanServerFactoryBean implements FactoryBean<MBeanServer>
|
||||
/*
|
||||
* this.mbeanServer = AdminServiceFactory.getMBeanFactory().getMBeanServer();
|
||||
*/
|
||||
Class adminServiceClass = getClass().getClassLoader().loadClass(ADMIN_SERVICE_FACTORY_CLASS);
|
||||
Class<?> adminServiceClass = getClass().getClassLoader().loadClass(ADMIN_SERVICE_FACTORY_CLASS);
|
||||
Method getMBeanFactoryMethod = adminServiceClass.getMethod(GET_MBEAN_FACTORY_METHOD);
|
||||
Object mbeanFactory = getMBeanFactoryMethod.invoke(null);
|
||||
Method getMBeanServerMethod = mbeanFactory.getClass().getMethod(GET_MBEAN_SERVER_METHOD);
|
||||
|
||||
@@ -66,7 +66,7 @@ public class JndiObjectTargetSource extends JndiObjectLocator implements TargetS
|
||||
|
||||
private Object cachedObject;
|
||||
|
||||
private Class targetClass;
|
||||
private Class<?> targetClass;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -127,10 +127,10 @@ public class JndiTemplate {
|
||||
* @throws NamingException in case of initialization errors
|
||||
*/
|
||||
protected Context createInitialContext() throws NamingException {
|
||||
Hashtable icEnv = null;
|
||||
Hashtable<?, ?> icEnv = null;
|
||||
Properties env = getEnvironment();
|
||||
if (env != null) {
|
||||
icEnv = new Hashtable(env.size());
|
||||
icEnv = new Hashtable<Object, Object>(env.size());
|
||||
CollectionUtils.mergePropertiesIntoMap(env, icEnv);
|
||||
}
|
||||
return new InitialContext(icEnv);
|
||||
|
||||
@@ -29,9 +29,9 @@ import javax.naming.NamingException;
|
||||
@SuppressWarnings("serial")
|
||||
public class TypeMismatchNamingException extends NamingException {
|
||||
|
||||
private Class requiredType;
|
||||
private Class<?> requiredType;
|
||||
|
||||
private Class actualType;
|
||||
private Class<?> actualType;
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ public class TypeMismatchNamingException extends NamingException {
|
||||
* @param requiredType the required type for the lookup
|
||||
* @param actualType the actual type that the lookup returned
|
||||
*/
|
||||
public TypeMismatchNamingException(String jndiName, Class requiredType, Class actualType) {
|
||||
public TypeMismatchNamingException(String jndiName, Class<?> requiredType, Class<?> actualType) {
|
||||
super("Object of type [" + actualType + "] available at JNDI location [" +
|
||||
jndiName + "] is not assignable to [" + requiredType.getName() + "]");
|
||||
this.requiredType = requiredType;
|
||||
@@ -60,14 +60,14 @@ public class TypeMismatchNamingException extends NamingException {
|
||||
/**
|
||||
* Return the required type for the lookup, if available.
|
||||
*/
|
||||
public final Class getRequiredType() {
|
||||
public final Class<?> getRequiredType() {
|
||||
return this.requiredType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual type that the lookup returned, if available.
|
||||
*/
|
||||
public final Class getActualType() {
|
||||
public final Class<?> getActualType() {
|
||||
return this.actualType;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac
|
||||
private final Map<String, Object> singletonObjects = new HashMap<String, Object>();
|
||||
|
||||
/** Cache of the types of nonshareable resources: bean name --> bean type */
|
||||
private final Map<String, Class> resourceTypes = new HashMap<String, Class>();
|
||||
private final Map<String, Class<?>> resourceTypes = new HashMap<String, Class<?>>();
|
||||
|
||||
|
||||
public SimpleJndiBeanFactory() {
|
||||
@@ -165,8 +165,8 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
|
||||
Class type = getType(name);
|
||||
public boolean isTypeMatch(String name, Class<?> targetType) throws NoSuchBeanDefinitionException {
|
||||
Class<?> type = getType(name);
|
||||
return (targetType == null || (type != null && targetType.isAssignableFrom(type)));
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac
|
||||
}
|
||||
}
|
||||
|
||||
private Class doGetType(String name) throws NamingException {
|
||||
private Class<?> doGetType(String name) throws NamingException {
|
||||
if (isSingleton(name)) {
|
||||
Object jndiObject = doGetSingleton(name, null);
|
||||
return (jndiObject != null ? jndiObject.getClass() : null);
|
||||
@@ -218,7 +218,7 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac
|
||||
}
|
||||
else {
|
||||
Object jndiObject = lookup(name, null);
|
||||
Class type = (jndiObject != null ? jndiObject.getClass() : null);
|
||||
Class<?> type = (jndiObject != null ? jndiObject.getClass() : null);
|
||||
this.resourceTypes.put(name, type);
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class CodebaseAwareObjectInputStream extends ConfigurableObjectInputStrea
|
||||
|
||||
|
||||
@Override
|
||||
protected Class resolveFallbackIfPossible(String className, ClassNotFoundException ex)
|
||||
protected Class<?> resolveFallbackIfPossible(String className, ClassNotFoundException ex)
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
// If codebaseUrl is set, try to load the class with the RMIClassLoader.
|
||||
|
||||
@@ -78,7 +78,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*/
|
||||
public class JndiRmiClientInterceptor extends JndiObjectLocator implements MethodInterceptor, InitializingBean {
|
||||
|
||||
private Class serviceInterface;
|
||||
private Class<?> serviceInterface;
|
||||
|
||||
private RemoteInvocationFactory remoteInvocationFactory = new DefaultRemoteInvocationFactory();
|
||||
|
||||
@@ -101,7 +101,7 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
|
||||
* <p>Typically required to be able to create a suitable service proxy,
|
||||
* but can also be optional if the lookup returns a typed stub.
|
||||
*/
|
||||
public void setServiceInterface(Class serviceInterface) {
|
||||
public void setServiceInterface(Class<?> serviceInterface) {
|
||||
if (serviceInterface != null && !serviceInterface.isInterface()) {
|
||||
throw new IllegalArgumentException("'serviceInterface' must be an interface");
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
|
||||
/**
|
||||
* Return the interface of the service to access.
|
||||
*/
|
||||
public Class getServiceInterface() {
|
||||
public Class<?> getServiceInterface() {
|
||||
return this.serviceInterface;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class RmiInvocationWrapper implements RmiInvocationHandler {
|
||||
*/
|
||||
@Override
|
||||
public String getTargetInterfaceName() {
|
||||
Class ifc = this.rmiExporter.getServiceInterface();
|
||||
Class<?> ifc = this.rmiExporter.getServiceInterface();
|
||||
return (ifc != null ? ifc.getName() : null);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ package org.springframework.remoting.support;
|
||||
*/
|
||||
public abstract class RemoteAccessor extends RemotingSupport {
|
||||
|
||||
private Class serviceInterface;
|
||||
private Class<?> serviceInterface;
|
||||
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ public abstract class RemoteAccessor extends RemotingSupport {
|
||||
* <p>Typically required to be able to create a suitable service proxy,
|
||||
* but can also be optional if the lookup returns a typed proxy.
|
||||
*/
|
||||
public void setServiceInterface(Class serviceInterface) {
|
||||
public void setServiceInterface(Class<?> serviceInterface) {
|
||||
if (serviceInterface != null && !serviceInterface.isInterface()) {
|
||||
throw new IllegalArgumentException("'serviceInterface' must be an interface");
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public abstract class RemoteAccessor extends RemotingSupport {
|
||||
/**
|
||||
* Return the interface of the service to access.
|
||||
*/
|
||||
public Class getServiceInterface() {
|
||||
public Class<?> getServiceInterface() {
|
||||
return this.serviceInterface;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class RemoteExporter extends RemotingSupport {
|
||||
|
||||
private Object service;
|
||||
|
||||
private Class serviceInterface;
|
||||
private Class<?> serviceInterface;
|
||||
|
||||
private Boolean registerTraceInterceptor;
|
||||
|
||||
@@ -62,7 +62,7 @@ public abstract class RemoteExporter extends RemotingSupport {
|
||||
* Set the interface of the service to export.
|
||||
* The interface must be suitable for the particular service and remoting strategy.
|
||||
*/
|
||||
public void setServiceInterface(Class serviceInterface) {
|
||||
public void setServiceInterface(Class<?> serviceInterface) {
|
||||
if (serviceInterface != null && !serviceInterface.isInterface()) {
|
||||
throw new IllegalArgumentException("'serviceInterface' must be an interface");
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public abstract class RemoteExporter extends RemotingSupport {
|
||||
/**
|
||||
* Return the interface of the service to export.
|
||||
*/
|
||||
public Class getServiceInterface() {
|
||||
public Class<?> getServiceInterface() {
|
||||
return this.serviceInterface;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public abstract class RemoteExporter extends RemotingSupport {
|
||||
* @see #setService
|
||||
*/
|
||||
protected void checkServiceInterface() throws IllegalArgumentException {
|
||||
Class serviceInterface = getServiceInterface();
|
||||
Class<?> serviceInterface = getServiceInterface();
|
||||
Object service = getService();
|
||||
if (serviceInterface == null) {
|
||||
throw new IllegalArgumentException("Property 'serviceInterface' is required");
|
||||
|
||||
@@ -51,7 +51,7 @@ public class RemoteInvocation implements Serializable {
|
||||
|
||||
private String methodName;
|
||||
|
||||
private Class[] parameterTypes;
|
||||
private Class<?>[] parameterTypes;
|
||||
|
||||
private Object[] arguments;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class RemoteInvocation implements Serializable {
|
||||
* @param parameterTypes the parameter types of the method
|
||||
* @param arguments the arguments for the invocation
|
||||
*/
|
||||
public RemoteInvocation(String methodName, Class[] parameterTypes, Object[] arguments) {
|
||||
public RemoteInvocation(String methodName, Class<?>[] parameterTypes, Object[] arguments) {
|
||||
this.methodName = methodName;
|
||||
this.parameterTypes = parameterTypes;
|
||||
this.arguments = arguments;
|
||||
@@ -104,14 +104,14 @@ public class RemoteInvocation implements Serializable {
|
||||
/**
|
||||
* Set the parameter types of the target method.
|
||||
*/
|
||||
public void setParameterTypes(Class[] parameterTypes) {
|
||||
public void setParameterTypes(Class<?>[] parameterTypes) {
|
||||
this.parameterTypes = parameterTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the parameter types of the target method.
|
||||
*/
|
||||
public Class[] getParameterTypes() {
|
||||
public Class<?>[] getParameterTypes() {
|
||||
return this.parameterTypes;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public interface TaskScheduler {
|
||||
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
|
||||
* @see org.springframework.scheduling.support.CronTrigger
|
||||
*/
|
||||
ScheduledFuture schedule(Runnable task, Trigger trigger);
|
||||
ScheduledFuture<?> schedule(Runnable task, Trigger trigger);
|
||||
|
||||
/**
|
||||
* Schedule the given {@link Runnable}, invoking it at the specified execution time.
|
||||
@@ -75,7 +75,7 @@ public interface TaskScheduler {
|
||||
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
|
||||
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
|
||||
*/
|
||||
ScheduledFuture schedule(Runnable task, Date startTime);
|
||||
ScheduledFuture<?> schedule(Runnable task, Date startTime);
|
||||
|
||||
/**
|
||||
* Schedule the given {@link Runnable}, invoking it at the specified execution time
|
||||
@@ -90,7 +90,7 @@ public interface TaskScheduler {
|
||||
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
|
||||
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
|
||||
*/
|
||||
ScheduledFuture scheduleAtFixedRate(Runnable task, Date startTime, long period);
|
||||
ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Date startTime, long period);
|
||||
|
||||
/**
|
||||
* Schedule the given {@link Runnable}, starting as soon as possible and
|
||||
@@ -103,7 +103,7 @@ public interface TaskScheduler {
|
||||
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
|
||||
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
|
||||
*/
|
||||
ScheduledFuture scheduleAtFixedRate(Runnable task, long period);
|
||||
ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period);
|
||||
|
||||
/**
|
||||
* Schedule the given {@link Runnable}, invoking it at the specified execution time
|
||||
@@ -120,7 +120,7 @@ public interface TaskScheduler {
|
||||
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
|
||||
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
|
||||
*/
|
||||
ScheduledFuture scheduleWithFixedDelay(Runnable task, Date startTime, long delay);
|
||||
ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Date startTime, long delay);
|
||||
|
||||
/**
|
||||
* Schedule the given {@link Runnable}, starting as soon as possible and
|
||||
@@ -134,6 +134,6 @@ public interface TaskScheduler {
|
||||
* @throws org.springframework.core.task.TaskRejectedException if the given task was not accepted
|
||||
* for internal reasons (e.g. a pool overload handling policy or a pool shutdown in progress)
|
||||
*/
|
||||
ScheduledFuture scheduleWithFixedDelay(Runnable task, long delay);
|
||||
ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay);
|
||||
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
|
||||
|
||||
@Override
|
||||
public ScheduledFuture schedule(Runnable task, Trigger trigger) {
|
||||
public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
|
||||
try {
|
||||
if (this.enterpriseConcurrentScheduler) {
|
||||
return new EnterpriseConcurrentTriggerScheduler().schedule(decorateTask(task, true), trigger);
|
||||
@@ -176,7 +176,7 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture schedule(Runnable task, Date startTime) {
|
||||
public ScheduledFuture<?> schedule(Runnable task, Date startTime) {
|
||||
long initialDelay = startTime.getTime() - System.currentTimeMillis();
|
||||
try {
|
||||
return this.scheduledExecutor.schedule(decorateTask(task, false), initialDelay, TimeUnit.MILLISECONDS);
|
||||
@@ -187,7 +187,7 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture scheduleAtFixedRate(Runnable task, Date startTime, long period) {
|
||||
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Date startTime, long period) {
|
||||
long initialDelay = startTime.getTime() - System.currentTimeMillis();
|
||||
try {
|
||||
return this.scheduledExecutor.scheduleAtFixedRate(decorateTask(task, true), initialDelay, period, TimeUnit.MILLISECONDS);
|
||||
@@ -198,7 +198,7 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture scheduleAtFixedRate(Runnable task, long period) {
|
||||
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period) {
|
||||
try {
|
||||
return this.scheduledExecutor.scheduleAtFixedRate(decorateTask(task, true), 0, period, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture scheduleWithFixedDelay(Runnable task, Date startTime, long delay) {
|
||||
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Date startTime, long delay) {
|
||||
long initialDelay = startTime.getTime() - System.currentTimeMillis();
|
||||
try {
|
||||
return this.scheduledExecutor.scheduleWithFixedDelay(decorateTask(task, true), initialDelay, delay, TimeUnit.MILLISECONDS);
|
||||
@@ -219,7 +219,7 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture scheduleWithFixedDelay(Runnable task, long delay) {
|
||||
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay) {
|
||||
try {
|
||||
return this.scheduledExecutor.scheduleWithFixedDelay(decorateTask(task, true), 0, delay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
@@ -243,7 +243,7 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
*/
|
||||
private class EnterpriseConcurrentTriggerScheduler {
|
||||
|
||||
public ScheduledFuture schedule(Runnable task, final Trigger trigger) {
|
||||
public ScheduledFuture<?> schedule(Runnable task, final Trigger trigger) {
|
||||
ManagedScheduledExecutorService executor = (ManagedScheduledExecutorService) scheduledExecutor;
|
||||
return executor.schedule(task, new javax.enterprise.concurrent.Trigger() {
|
||||
@Override
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.jndi.JndiTemplate;
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DefaultManagedAwareThreadFactory extends CustomizableThreadFactory implements InitializingBean {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -49,7 +49,7 @@ class ReschedulingRunnable extends DelegatingErrorHandlingRunnable implements Sc
|
||||
|
||||
private final ScheduledExecutorService executor;
|
||||
|
||||
private ScheduledFuture currentFuture;
|
||||
private ScheduledFuture<?> currentFuture;
|
||||
|
||||
private Date scheduledExecutionTime;
|
||||
|
||||
@@ -63,7 +63,7 @@ class ReschedulingRunnable extends DelegatingErrorHandlingRunnable implements Sc
|
||||
}
|
||||
|
||||
|
||||
public ScheduledFuture schedule() {
|
||||
public ScheduledFuture<?> schedule() {
|
||||
synchronized (this.triggerContextMonitor) {
|
||||
this.scheduledExecutionTime = this.trigger.nextExecutionTime(this.triggerContext);
|
||||
if (this.scheduledExecutionTime == null) {
|
||||
@@ -112,7 +112,7 @@ class ReschedulingRunnable extends DelegatingErrorHandlingRunnable implements Sc
|
||||
|
||||
@Override
|
||||
public Object get() throws InterruptedException, ExecutionException {
|
||||
ScheduledFuture curr;
|
||||
ScheduledFuture<?> curr;
|
||||
synchronized (this.triggerContextMonitor) {
|
||||
curr = this.currentFuture;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class ReschedulingRunnable extends DelegatingErrorHandlingRunnable implements Sc
|
||||
|
||||
@Override
|
||||
public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
ScheduledFuture curr;
|
||||
ScheduledFuture<?> curr;
|
||||
synchronized (this.triggerContextMonitor) {
|
||||
curr = this.currentFuture;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class ReschedulingRunnable extends DelegatingErrorHandlingRunnable implements Sc
|
||||
|
||||
@Override
|
||||
public long getDelay(TimeUnit unit) {
|
||||
ScheduledFuture curr;
|
||||
ScheduledFuture<?> curr;
|
||||
synchronized (this.triggerContextMonitor) {
|
||||
curr = this.currentFuture;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
// TaskScheduler implementation
|
||||
|
||||
@Override
|
||||
public ScheduledFuture schedule(Runnable task, Trigger trigger) {
|
||||
public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
|
||||
ScheduledExecutorService executor = getScheduledExecutor();
|
||||
try {
|
||||
ErrorHandler errorHandler =
|
||||
@@ -222,7 +222,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture schedule(Runnable task, Date startTime) {
|
||||
public ScheduledFuture<?> schedule(Runnable task, Date startTime) {
|
||||
ScheduledExecutorService executor = getScheduledExecutor();
|
||||
long initialDelay = startTime.getTime() - System.currentTimeMillis();
|
||||
try {
|
||||
@@ -234,7 +234,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture scheduleAtFixedRate(Runnable task, Date startTime, long period) {
|
||||
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Date startTime, long period) {
|
||||
ScheduledExecutorService executor = getScheduledExecutor();
|
||||
long initialDelay = startTime.getTime() - System.currentTimeMillis();
|
||||
try {
|
||||
@@ -246,7 +246,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture scheduleAtFixedRate(Runnable task, long period) {
|
||||
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period) {
|
||||
ScheduledExecutorService executor = getScheduledExecutor();
|
||||
try {
|
||||
return executor.scheduleAtFixedRate(errorHandlingTask(task, true), 0, period, TimeUnit.MILLISECONDS);
|
||||
@@ -257,7 +257,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture scheduleWithFixedDelay(Runnable task, Date startTime, long delay) {
|
||||
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Date startTime, long delay) {
|
||||
ScheduledExecutorService executor = getScheduledExecutor();
|
||||
long initialDelay = startTime.getTime() - System.currentTimeMillis();
|
||||
try {
|
||||
@@ -269,7 +269,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduledFuture scheduleWithFixedDelay(Runnable task, long delay) {
|
||||
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay) {
|
||||
ScheduledExecutorService executor = getScheduledExecutor();
|
||||
try {
|
||||
return executor.scheduleWithFixedDelay(errorHandlingTask(task, true), 0, delay, TimeUnit.MILLISECONDS);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class BshScriptFactory implements ScriptFactory, BeanClassLoaderAware {
|
||||
if (result instanceof Class) {
|
||||
// A Class: We'll cache the Class here and create an instance
|
||||
// outside of the synchronized block.
|
||||
this.scriptClass = (Class) result;
|
||||
this.scriptClass = (Class<?>) result;
|
||||
}
|
||||
else {
|
||||
// Not a Class: OK, we'll simply create BeanShell objects
|
||||
|
||||
@@ -89,7 +89,7 @@ public abstract class BshScriptUtils {
|
||||
|
||||
Object result = evaluateBshScript(scriptSource, scriptInterfaces, classLoader);
|
||||
if (result instanceof Class) {
|
||||
Class clazz = (Class) result;
|
||||
Class<?> clazz = (Class<?>) result;
|
||||
try {
|
||||
return clazz.newInstance();
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public abstract class BshScriptUtils {
|
||||
interpreter.setClassLoader(classLoader);
|
||||
Object result = interpreter.eval(scriptSource);
|
||||
if (result instanceof Class) {
|
||||
return (Class) result;
|
||||
return (Class<?>) result;
|
||||
}
|
||||
else if (result != null) {
|
||||
return result.getClass();
|
||||
|
||||
@@ -213,7 +213,7 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
||||
*/
|
||||
private String resolveScriptSource(Element element, XmlReaderContext readerContext) {
|
||||
boolean hasScriptSource = element.hasAttribute(SCRIPT_SOURCE_ATTRIBUTE);
|
||||
List elements = DomUtils.getChildElementsByTagName(element, INLINE_SCRIPT_ELEMENT);
|
||||
List<Element> elements = DomUtils.getChildElementsByTagName(element, INLINE_SCRIPT_ELEMENT);
|
||||
if (hasScriptSource && !elements.isEmpty()) {
|
||||
readerContext.error("Only one of 'script-source' and 'inline-script' should be specified.", element);
|
||||
return null;
|
||||
@@ -222,7 +222,7 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
||||
return element.getAttribute(SCRIPT_SOURCE_ATTRIBUTE);
|
||||
}
|
||||
else if (!elements.isEmpty()) {
|
||||
Element inlineElement = (Element) elements.get(0);
|
||||
Element inlineElement = elements.get(0);
|
||||
return "inline:" + DomUtils.getTextValue(inlineElement);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -206,7 +206,7 @@ public abstract class JRubyScriptUtils {
|
||||
return rubyArgs;
|
||||
}
|
||||
|
||||
private Object convertFromRuby(IRubyObject rubyResult, Class returnType) {
|
||||
private Object convertFromRuby(IRubyObject rubyResult, Class<?> returnType) {
|
||||
Object result = JavaEmbedUtils.rubyToJava(this.ruby, rubyResult, returnType);
|
||||
if (result instanceof RubyArray && returnType.isArray()) {
|
||||
result = convertFromRubyArray(((RubyArray) result).toJavaArray(), returnType);
|
||||
@@ -214,8 +214,8 @@ public abstract class JRubyScriptUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object convertFromRubyArray(IRubyObject[] rubyArray, Class returnType) {
|
||||
Class targetType = returnType.getComponentType();
|
||||
private Object convertFromRubyArray(IRubyObject[] rubyArray, Class<?> returnType) {
|
||||
Class<?> targetType = returnType.getComponentType();
|
||||
Object javaArray = Array.newInstance(targetType, rubyArray.length);
|
||||
for (int i = 0; i < rubyArray.length; i++) {
|
||||
IRubyObject rubyObject = rubyArray[i];
|
||||
|
||||
@@ -239,7 +239,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class predictBeanType(Class beanClass, String beanName) {
|
||||
public Class<?> predictBeanType(Class<?> beanClass, String beanName) {
|
||||
// We only apply special treatment to ScriptFactory implementations here.
|
||||
if (!ScriptFactory.class.isAssignableFrom(beanClass)) {
|
||||
return null;
|
||||
@@ -254,9 +254,9 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
|
||||
ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
|
||||
ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
|
||||
Class[] interfaces = scriptFactory.getScriptInterfaces();
|
||||
Class<?>[] interfaces = scriptFactory.getScriptInterfaces();
|
||||
|
||||
Class scriptedType = scriptFactory.getScriptedObjectType(scriptSource);
|
||||
Class<?> scriptedType = scriptFactory.getScriptedObjectType(scriptSource);
|
||||
if (scriptedType != null) {
|
||||
return scriptedType;
|
||||
} else if (!ObjectUtils.isEmpty(interfaces)) {
|
||||
@@ -287,7 +287,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInstantiation(Class beanClass, String beanName) {
|
||||
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) {
|
||||
// We only apply special treatment to ScriptFactory implementations here.
|
||||
if (!ScriptFactory.class.isAssignableFrom(beanClass)) {
|
||||
return null;
|
||||
@@ -302,7 +302,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
|
||||
boolean isFactoryBean = false;
|
||||
try {
|
||||
Class scriptedObjectType = scriptFactory.getScriptedObjectType(scriptSource);
|
||||
Class<?> scriptedObjectType = scriptFactory.getScriptedObjectType(scriptSource);
|
||||
// Returned type may be null if the factory is unable to determine the type.
|
||||
if (scriptedObjectType != null) {
|
||||
isFactoryBean = FactoryBean.class.isAssignableFrom(scriptedObjectType);
|
||||
@@ -314,7 +314,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
|
||||
long refreshCheckDelay = resolveRefreshCheckDelay(bd);
|
||||
if (refreshCheckDelay >= 0) {
|
||||
Class[] interfaces = scriptFactory.getScriptInterfaces();
|
||||
Class<?>[] interfaces = scriptFactory.getScriptInterfaces();
|
||||
RefreshableScriptTargetSource ts = new RefreshableScriptTargetSource(this.scriptBeanFactory,
|
||||
scriptedObjectBeanName, scriptFactory, scriptSource, isFactoryBean);
|
||||
boolean proxyTargetClass = resolveProxyTargetClass(bd);
|
||||
@@ -482,12 +482,12 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
* @see org.springframework.cglib.proxy.InterfaceMaker
|
||||
* @see org.springframework.beans.BeanUtils#findPropertyType
|
||||
*/
|
||||
protected Class createConfigInterface(BeanDefinition bd, Class[] interfaces) {
|
||||
protected Class<?> createConfigInterface(BeanDefinition bd, Class<?>[] interfaces) {
|
||||
InterfaceMaker maker = new InterfaceMaker();
|
||||
PropertyValue[] pvs = bd.getPropertyValues().getPropertyValues();
|
||||
for (PropertyValue pv : pvs) {
|
||||
String propertyName = pv.getName();
|
||||
Class propertyType = BeanUtils.findPropertyType(propertyName, interfaces);
|
||||
Class<?> propertyType = BeanUtils.findPropertyType(propertyName, interfaces);
|
||||
String setterName = "set" + StringUtils.capitalize(propertyName);
|
||||
Signature signature = new Signature(setterName, Type.VOID_TYPE, new Type[] { Type.getType(propertyType) });
|
||||
maker.add(signature, new Type[0]);
|
||||
@@ -515,7 +515,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
* @return the merged interface as Class
|
||||
* @see java.lang.reflect.Proxy#getProxyClass
|
||||
*/
|
||||
protected Class createCompositeInterface(Class[] interfaces) {
|
||||
protected Class<?> createCompositeInterface(Class<?>[] interfaces) {
|
||||
return ClassUtils.createCompositeInterface(interfaces, this.beanClassLoader);
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
* @see org.springframework.scripting.ScriptFactory#getScriptedObject
|
||||
*/
|
||||
protected BeanDefinition createScriptedObjectBeanDefinition(BeanDefinition bd, String scriptFactoryBeanName,
|
||||
ScriptSource scriptSource, Class[] interfaces) {
|
||||
ScriptSource scriptSource, Class<?>[] interfaces) {
|
||||
|
||||
GenericBeanDefinition objectBd = new GenericBeanDefinition(bd);
|
||||
objectBd.setFactoryBeanName(scriptFactoryBeanName);
|
||||
@@ -550,7 +550,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
* @return the generated proxy
|
||||
* @see RefreshableScriptTargetSource
|
||||
*/
|
||||
protected Object createRefreshableProxy(TargetSource ts, Class[] interfaces, boolean proxyTargetClass) {
|
||||
protected Object createRefreshableProxy(TargetSource ts, Class<?>[] interfaces, boolean proxyTargetClass) {
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.setTargetSource(ts);
|
||||
ClassLoader classLoader = this.beanClassLoader;
|
||||
|
||||
@@ -89,7 +89,7 @@ public class ModelMap extends LinkedHashMap<String, Object> {
|
||||
*/
|
||||
public ModelMap addAttribute(Object attributeValue) {
|
||||
Assert.notNull(attributeValue, "Model object must not be null");
|
||||
if (attributeValue instanceof Collection && ((Collection) attributeValue).isEmpty()) {
|
||||
if (attributeValue instanceof Collection && ((Collection<?>) attributeValue).isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
return addAttribute(Conventions.getVariableName(attributeValue), attributeValue);
|
||||
|
||||
@@ -261,7 +261,7 @@ public class LocalValidatorFactoryBean extends SpringValidatorAdapter
|
||||
setTargetValidator(this.validatorFactory.getValidator());
|
||||
}
|
||||
|
||||
private void configureParameterNameProviderIfPossible(Configuration configuration) {
|
||||
private void configureParameterNameProviderIfPossible(Configuration<?> configuration) {
|
||||
try {
|
||||
Class<?> parameterNameProviderClass =
|
||||
ClassUtils.forName("javax.validation.ParameterNameProvider", getClass().getClassLoader());
|
||||
@@ -271,13 +271,13 @@ public class LocalValidatorFactoryBean extends SpringValidatorAdapter
|
||||
Configuration.class.getMethod("getDefaultParameterNameProvider"), configuration);
|
||||
final ParameterNameDiscoverer discoverer = this.parameterNameDiscoverer;
|
||||
Object parameterNameProvider = Proxy.newProxyInstance(getClass().getClassLoader(),
|
||||
new Class[] {parameterNameProviderClass}, new InvocationHandler() {
|
||||
new Class<?>[] {parameterNameProviderClass}, new InvocationHandler() {
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if (method.getName().equals("getParameterNames")) {
|
||||
String[] result = null;
|
||||
if (args[0] instanceof Constructor) {
|
||||
result = discoverer.getParameterNames((Constructor) args[0]);
|
||||
result = discoverer.getParameterNames((Constructor<?>) args[0]);
|
||||
}
|
||||
else if (args[0] instanceof Method) {
|
||||
result = discoverer.getParameterNames((Method) args[0]);
|
||||
@@ -320,7 +320,7 @@ public class LocalValidatorFactoryBean extends SpringValidatorAdapter
|
||||
* @param configuration the Configuration object, pre-populated with
|
||||
* settings driven by LocalValidatorFactoryBean's properties
|
||||
*/
|
||||
protected void postProcessConfiguration(Configuration configuration) {
|
||||
protected void postProcessConfiguration(Configuration<?> configuration) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.validation.beanvalidation;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Validation;
|
||||
@@ -27,10 +28,6 @@ import javax.validation.ValidatorFactory;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.hibernate.validator.HibernateValidator;
|
||||
import org.hibernate.validator.method.MethodConstraintViolation;
|
||||
import org.hibernate.validator.method.MethodConstraintViolationException;
|
||||
import org.hibernate.validator.method.MethodValidator;
|
||||
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -113,7 +110,7 @@ public class MethodValidationInterceptor implements MethodInterceptor {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
Class[] groups = determineValidationGroups(invocation);
|
||||
Class<?>[] groups = determineValidationGroups(invocation);
|
||||
if (forExecutablesMethod != null) {
|
||||
Object executableValidator = ReflectionUtils.invokeMethod(forExecutablesMethod, this.validator);
|
||||
Set<ConstraintViolation<?>> result = (Set<ConstraintViolation<?>>)
|
||||
@@ -143,9 +140,9 @@ public class MethodValidationInterceptor implements MethodInterceptor {
|
||||
* @param invocation the current MethodInvocation
|
||||
* @return the applicable validation groups as a Class array
|
||||
*/
|
||||
protected Class[] determineValidationGroups(MethodInvocation invocation) {
|
||||
protected Class<?>[] determineValidationGroups(MethodInvocation invocation) {
|
||||
Validated valid = AnnotationUtils.findAnnotation(invocation.getThis().getClass(), Validated.class);
|
||||
return (valid != null ? valid.value() : new Class[0]);
|
||||
return (valid != null ? valid.value() : new Class<?>[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -158,23 +155,23 @@ public class MethodValidationInterceptor implements MethodInterceptor {
|
||||
return Validation.byProvider(HibernateValidator.class).configure().buildValidatorFactory();
|
||||
}
|
||||
|
||||
public static Object invokeWithinValidation(MethodInvocation invocation, Validator validator, Class[] groups)
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Object invokeWithinValidation(MethodInvocation invocation, Validator validator, Class<?>[] groups)
|
||||
throws Throwable {
|
||||
|
||||
MethodValidator methodValidator = validator.unwrap(MethodValidator.class);
|
||||
Set<MethodConstraintViolation<Object>> result = methodValidator.validateAllParameters(
|
||||
org.hibernate.validator.method.MethodValidator methodValidator = validator.unwrap(org.hibernate.validator.method.MethodValidator.class);
|
||||
Set<org.hibernate.validator.method.MethodConstraintViolation<Object>> result = methodValidator.validateAllParameters(
|
||||
invocation.getThis(), invocation.getMethod(), invocation.getArguments(), groups);
|
||||
if (!result.isEmpty()) {
|
||||
throw new MethodConstraintViolationException(result);
|
||||
throw new org.hibernate.validator.method.MethodConstraintViolationException(result);
|
||||
}
|
||||
Object returnValue = invocation.proceed();
|
||||
result = methodValidator.validateReturnValue(
|
||||
invocation.getThis(), invocation.getMethod(), returnValue, groups);
|
||||
if (!result.isEmpty()) {
|
||||
throw new MethodConstraintViolationException(result);
|
||||
throw new org.hibernate.validator.method.MethodConstraintViolationException(result);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class BindingAwareModelMap extends ExtendedModelMap {
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends String, ?> map) {
|
||||
for (Map.Entry entry : map.entrySet()) {
|
||||
for (Map.Entry<? extends String, ?> entry : map.entrySet()) {
|
||||
removeBindingResultIfNecessary(entry.getKey(), entry.getValue());
|
||||
}
|
||||
super.putAll(map);
|
||||
|
||||
Reference in New Issue
Block a user