Polish spring-context
- Cache interceptor internals now operate on collections of <? extends Cache> instead of <Cache>. - Deleted unused imports. - Deleted dead code. - Suppressed warnings for resource leaks related to not closing ApplicationContexts in tests. - Suppressed further non-issue warnings in tests.
This commit is contained in:
@@ -61,6 +61,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @author Phillip Webb
|
||||
* @author Sam Brannen
|
||||
* @since 3.1
|
||||
*/
|
||||
public abstract class CacheAspectSupport implements InitializingBean {
|
||||
@@ -148,7 +149,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
|
||||
return ClassUtils.getQualifiedMethodName(specificMethod);
|
||||
}
|
||||
|
||||
protected Collection<Cache> getCaches(CacheOperation operation) {
|
||||
protected Collection<? extends Cache> getCaches(CacheOperation operation) {
|
||||
Set<String> cacheNames = operation.getCacheNames();
|
||||
Collection<Cache> caches = new ArrayList<Cache>(cacheNames.size());
|
||||
for (String cacheName : cacheNames) {
|
||||
@@ -346,7 +347,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
|
||||
|
||||
private final Class<?> targetClass;
|
||||
|
||||
private final Collection<Cache> caches;
|
||||
private final Collection<? extends Cache> caches;
|
||||
|
||||
public CacheOperationContext(CacheOperation operation, Method method,
|
||||
Object[] args, Object target, Class<?> targetClass) {
|
||||
@@ -408,7 +409,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
|
||||
return evaluator.createEvaluationContext(this.caches, this.method, this.args, this.target, this.targetClass, result);
|
||||
}
|
||||
|
||||
protected Collection<Cache> getCaches() {
|
||||
protected Collection<? extends Cache> getCaches() {
|
||||
return this.caches;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,13 +24,14 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Class describing the root object used during the expression evaluation.
|
||||
*
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Sam Brannen
|
||||
* @since 3.1
|
||||
*/
|
||||
class CacheExpressionRootObject {
|
||||
|
||||
private final Collection<Cache> caches;
|
||||
private final Collection<? extends Cache> caches;
|
||||
|
||||
private final Method method;
|
||||
|
||||
@@ -42,7 +43,7 @@ class CacheExpressionRootObject {
|
||||
|
||||
|
||||
public CacheExpressionRootObject(
|
||||
Collection<Cache> caches, Method method, Object[] args, Object target, Class<?> targetClass) {
|
||||
Collection<? extends Cache> caches, Method method, Object[] args, Object target, Class<?> targetClass) {
|
||||
|
||||
Assert.notNull(method, "Method is required");
|
||||
Assert.notNull(targetClass, "targetClass is required");
|
||||
@@ -54,7 +55,7 @@ class CacheExpressionRootObject {
|
||||
}
|
||||
|
||||
|
||||
public Collection<Cache> getCaches() {
|
||||
public Collection<? extends Cache> getCaches() {
|
||||
return this.caches;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Phillip Webb
|
||||
* @author Sam Brannen
|
||||
* @since 3.1
|
||||
*/
|
||||
class ExpressionEvaluator {
|
||||
@@ -61,7 +62,7 @@ class ExpressionEvaluator {
|
||||
* Create an {@link EvaluationContext} without a return value.
|
||||
* @see #createEvaluationContext(Collection, Method, Object[], Object, Class, Object)
|
||||
*/
|
||||
public EvaluationContext createEvaluationContext(Collection<Cache> caches,
|
||||
public EvaluationContext createEvaluationContext(Collection<? extends Cache> caches,
|
||||
Method method, Object[] args, Object target, Class<?> targetClass) {
|
||||
return createEvaluationContext(caches, method, args, target, targetClass,
|
||||
NO_RESULT);
|
||||
@@ -77,9 +78,9 @@ class ExpressionEvaluator {
|
||||
* @param targetClass the target class
|
||||
* @param result the return value (can be {@code null}) or
|
||||
* {@link #NO_RESULT} if there is no return at this time
|
||||
* @return the evalulation context
|
||||
* @return the evaluation context
|
||||
*/
|
||||
public EvaluationContext createEvaluationContext(Collection<Cache> caches,
|
||||
public EvaluationContext createEvaluationContext(Collection<? extends Cache> caches,
|
||||
Method method, Object[] args, Object target, Class<?> targetClass,
|
||||
final Object result) {
|
||||
CacheExpressionRootObject rootObject = new CacheExpressionRootObject(caches,
|
||||
|
||||
@@ -511,8 +511,6 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
*/
|
||||
private class ResourceElement extends LookupElement {
|
||||
|
||||
protected final boolean shareable;
|
||||
|
||||
public ResourceElement(Member member, PropertyDescriptor pd) {
|
||||
super(member, pd);
|
||||
AnnotatedElement ae = (AnnotatedElement) member;
|
||||
@@ -539,7 +537,6 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
this.name = resourceName;
|
||||
this.lookupType = resourceType;
|
||||
this.mappedName = resource.mappedName();
|
||||
this.shareable = resource.shareable();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.springframework.core.env.EnvironmentCapable;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ import org.springframework.instrument.classloading.websphere.WebSphereLoadTimeWe
|
||||
* @since 2.5
|
||||
* @see org.springframework.context.ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLoaderAware, DisposableBean {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -51,7 +51,7 @@ public class MethodInvokingRunnable extends ArgumentConvertingMethodInvoker
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class resolveClassName(String className) throws ClassNotFoundException {
|
||||
protected Class<?> resolveClassName(String className) throws ClassNotFoundException {
|
||||
return ClassUtils.forName(className, this.beanClassLoader);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import groovy.lang.Binding;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.scripting.support;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
@@ -127,8 +127,6 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||
|
||||
private SimpleTypeConverter typeConverter;
|
||||
|
||||
private BindException bindException;
|
||||
|
||||
private boolean ignoreUnknownFields = true;
|
||||
|
||||
private boolean ignoreInvalidFields = false;
|
||||
|
||||
Reference in New Issue
Block a user