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:
Phillip Webb
2013-11-21 18:15:09 -08:00
parent 4de3291dc7
commit 59002f2456
540 changed files with 1943 additions and 1843 deletions

View File

@@ -20,6 +20,7 @@ import java.io.IOException;
import java.security.Principal;
import java.util.ArrayList;
import java.util.concurrent.Callable;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -354,6 +355,7 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
* @see #configureAndRefreshWebApplicationContext(ConfigurableWebApplicationContext)
* @see #applyInitializers(ConfigurableApplicationContext)
*/
@SuppressWarnings("unchecked")
public void setContextInitializers(ApplicationContextInitializer<ConfigurableApplicationContext>... contextInitializers) {
for (ApplicationContextInitializer<ConfigurableApplicationContext> initializer : contextInitializers) {
this.contextInitializers.add(initializer);

View File

@@ -234,9 +234,9 @@ public abstract class HttpServletBean extends HttpServlet
Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
new HashSet<String>(requiredProperties) : null;
Enumeration en = config.getInitParameterNames();
Enumeration<String> en = config.getInitParameterNames();
while (en.hasMoreElements()) {
String property = (String) en.nextElement();
String property = en.nextElement();
Object value = config.getInitParameter(property);
addPropertyValue(new PropertyValue(property, value));
if (missingProps != null) {

View File

@@ -41,7 +41,6 @@ import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.feed.AtomFeedHttpMessageConverter;
import org.springframework.http.converter.feed.RssChannelHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter;
import org.springframework.http.converter.xml.SourceHttpMessageConverter;
@@ -67,11 +66,11 @@ import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
import org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter;
import org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver;
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import org.springframework.web.servlet.mvc.method.annotation.ServletWebArgumentResolverAdapter;
import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import org.w3c.dom.Element;
/**
@@ -409,6 +408,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
return null;
}
@SuppressWarnings("deprecation")
private ManagedList<?> getMessageConverters(Element element, Object source, ParserContext parserContext) {
Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters");
ManagedList<? super Object> messageConverters = new ManagedList<Object>();
@@ -443,12 +443,13 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
messageConverters.add(createConverterBeanDefinition(MappingJackson2HttpMessageConverter.class, source));
}
else if (jacksonPresent) {
messageConverters.add(createConverterBeanDefinition(MappingJacksonHttpMessageConverter.class, source));
messageConverters.add(createConverterBeanDefinition(org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.class, source));
}
}
return messageConverters;
}
@SuppressWarnings("rawtypes")
private RootBeanDefinition createConverterBeanDefinition(
Class<? extends HttpMessageConverter> converterClass, Object source) {
@@ -495,6 +496,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
* HandlerMethodArgumentResolver's configured in RequestMappingHandlerAdapter
* after it is fully initialized.
*/
@SuppressWarnings("unused")
private static class CompositeUriComponentsContributorFactoryBean
implements InitializingBean, FactoryBean<CompositeUriComponentsContributor> {

View File

@@ -44,6 +44,7 @@ class ViewControllerBeanDefinitionParser implements BeanDefinitionParser {
@Override
@SuppressWarnings("unchecked")
public BeanDefinition parse(Element element, ParserContext parserContext) {
Object source = parserContext.extractSource(element);

View File

@@ -45,7 +45,6 @@ import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.feed.AtomFeedHttpMessageConverter;
import org.springframework.http.converter.feed.RssChannelHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter;
import org.springframework.http.converter.xml.SourceHttpMessageConverter;
@@ -527,6 +526,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
* Subclasses can call this method from {@link #configureMessageConverters(List)}.
* @param messageConverters the list to add the default message converters to
*/
@SuppressWarnings("deprecation")
protected final void addDefaultHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
stringConverter.setWriteAcceptCharset(false);
@@ -547,7 +547,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
messageConverters.add(new MappingJackson2HttpMessageConverter());
}
else if (jacksonPresent) {
messageConverters.add(new MappingJacksonHttpMessageConverter());
messageConverters.add(new org.springframework.http.converter.json.MappingJacksonHttpMessageConverter());
}
}

View File

@@ -53,7 +53,7 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
private Set<?> mappedHandlers;
private Class[] mappedHandlerClasses;
private Class<?>[] mappedHandlerClasses;
private Log warnLogger;
@@ -90,7 +90,7 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
* as fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be
* ignored in this case.
*/
public void setMappedHandlerClasses(Class[] mappedHandlerClasses) {
public void setMappedHandlerClasses(Class<?>[] mappedHandlerClasses) {
this.mappedHandlerClasses = mappedHandlerClasses;
}
@@ -160,7 +160,7 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
return true;
}
if (this.mappedHandlerClasses != null) {
for (Class handlerClass : this.mappedHandlerClasses) {
for (Class<?> handlerClass : this.mappedHandlerClasses) {
if (handlerClass.isInstance(handler)) {
return true;
}

View File

@@ -87,7 +87,7 @@ import org.springframework.web.servlet.ModelAndView;
public class ServletWrappingController extends AbstractController
implements BeanNameAware, InitializingBean, DisposableBean {
private Class servletClass;
private Class<?> servletClass;
private String servletName;
@@ -103,7 +103,7 @@ public class ServletWrappingController extends AbstractController
* Needs to implement {@code javax.servlet.Servlet}.
* @see javax.servlet.Servlet
*/
public void setServletClass(Class servletClass) {
public void setServletClass(Class<?> servletClass) {
this.servletClass = servletClass;
}
@@ -196,8 +196,9 @@ public class ServletWrappingController extends AbstractController
}
@Override
public Enumeration getInitParameterNames() {
return initParameters.keys();
@SuppressWarnings({ "unchecked", "rawtypes" })
public Enumeration<String> getInitParameterNames() {
return (Enumeration) initParameters.keys();
}
}

View File

@@ -117,7 +117,7 @@ public class WebContentInterceptor extends WebContentGenerator implements Handle
*/
public void setCacheMappings(Properties cacheMappings) {
this.cacheMappings.clear();
Enumeration propNames = cacheMappings.propertyNames();
Enumeration<?> propNames = cacheMappings.propertyNames();
while (propNames.hasMoreElements()) {
String path = (String) propNames.nextElement();
this.cacheMappings.put(path, Integer.valueOf(cacheMappings.getProperty(path)));

View File

@@ -35,6 +35,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@@ -42,10 +43,10 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.transform.Source;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
@@ -53,7 +54,6 @@ import org.springframework.beans.factory.config.BeanExpressionContext;
import org.springframework.beans.factory.config.BeanExpressionResolver;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.Ordered;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.annotation.AnnotationUtils;
@@ -68,7 +68,6 @@ import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.xml.SourceHttpMessageConverter;
import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.http.server.ServletServerHttpRequest;
@@ -201,8 +200,10 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
// See SPR-7316
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false);
this.messageConverters = new HttpMessageConverter[]{new ByteArrayHttpMessageConverter(), stringHttpMessageConverter,
new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter()};
this.messageConverters = new HttpMessageConverter<?>[] {
new ByteArrayHttpMessageConverter(), stringHttpMessageConverter,
new SourceHttpMessageConverter<Source>(),
new org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter() };
}
@@ -467,7 +468,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
* Build a HandlerMethodResolver for the given handler type.
*/
private ServletHandlerMethodResolver getMethodResolver(Object handler) {
Class handlerClass = ClassUtils.getUserClass(handler);
Class<?> handlerClass = ClassUtils.getUserClass(handler);
ServletHandlerMethodResolver resolver = this.methodResolverCache.get(handlerClass);
if (resolver == null) {
synchronized (this.methodResolverCache) {
@@ -781,7 +782,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
}
@Override
protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception {
protected void raiseMissingParameterException(String paramName, Class<?> paramType) throws Exception {
throw new MissingServletRequestParameterException(paramName, paramType.getSimpleName());
}
@@ -830,7 +831,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
}
@Override
protected Object resolveCookieValue(String cookieName, Class paramType, NativeWebRequest webRequest)
protected Object resolveCookieValue(String cookieName, Class<?> paramType, NativeWebRequest webRequest)
throws Exception {
HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class);
@@ -848,7 +849,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
@Override
@SuppressWarnings({"unchecked"})
protected String resolvePathVariable(String pathVarName, Class paramType, NativeWebRequest webRequest)
protected String resolvePathVariable(String pathVarName, Class<?> paramType, NativeWebRequest webRequest)
throws Exception {
HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class);
@@ -911,7 +912,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
}
@SuppressWarnings("unchecked")
public ModelAndView getModelAndView(Method handlerMethod, Class handlerType, Object returnValue,
public ModelAndView getModelAndView(Method handlerMethod, Class<?> handlerType, Object returnValue,
ExtendedModelMap implicitModel, ServletWebRequest webRequest) throws Exception {
ResponseStatus responseStatusAnn = AnnotationUtils.findAnnotation(handlerMethod, ResponseStatus.class);
@@ -966,7 +967,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
return new ModelAndView().addAllObjects(implicitModel);
}
else if (returnValue instanceof Map) {
return new ModelAndView().addAllObjects(implicitModel).addAllObjects((Map) returnValue);
return new ModelAndView().addAllObjects(implicitModel).addAllObjects((Map<String, ?>) returnValue);
}
else if (returnValue instanceof String) {
return new ModelAndView((String) returnValue).addAllObjects(implicitModel);
@@ -1009,7 +1010,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
HttpInputMessage inputMessage = createHttpInputMessage(webRequest);
HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest);
if (responseEntity instanceof ResponseEntity && outputMessage instanceof ServerHttpResponse) {
((ServerHttpResponse) outputMessage).setStatusCode(((ResponseEntity) responseEntity).getStatusCode());
((ServerHttpResponse) outputMessage).setStatusCode(((ResponseEntity<?>) responseEntity).getStatusCode());
}
HttpHeaders entityHeaders = responseEntity.getHeaders();
if (!entityHeaders.isEmpty()) {
@@ -1025,7 +1026,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
}
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
private void writeWithMessageConverters(Object returnValue,
HttpInputMessage inputMessage, HttpOutputMessage outputMessage)
throws IOException, HttpMediaTypeNotAcceptableException {

View File

@@ -32,12 +32,14 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.transform.Source;
import org.springframework.core.ExceptionDepthComparator;
import org.springframework.core.GenericTypeResolver;
@@ -51,7 +53,6 @@ import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.xml.SourceHttpMessageConverter;
import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter;
import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.ui.Model;
@@ -96,8 +97,9 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc
private WebArgumentResolver[] customArgumentResolvers;
private HttpMessageConverter<?>[] messageConverters =
new HttpMessageConverter[] {new ByteArrayHttpMessageConverter(), new StringHttpMessageConverter(),
new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter()};
new HttpMessageConverter<?>[] {new ByteArrayHttpMessageConverter(), new StringHttpMessageConverter(),
new SourceHttpMessageConverter<Source>(),
new org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter()};
/**
@@ -415,7 +417,7 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc
}
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes", "resource" })
private ModelAndView handleResponseBody(Object returnValue, ServletWebRequest webRequest)
throws ServletException, IOException {

View File

@@ -54,7 +54,7 @@ public interface ModelAndViewResolver {
ModelAndView UNRESOLVED = new ModelAndView();
ModelAndView resolveModelAndView(Method handlerMethod,
Class handlerType,
Class<?> handlerType,
Object returnValue,
ExtendedModelMap implicitModel,
NativeWebRequest webRequest);

View File

@@ -256,7 +256,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
ParamsRequestCondition condition = partialMatch.getParamsCondition();
if (!CollectionUtils.isEmpty(condition.getExpressions()) && (condition.getMatchingCondition(request) == null)) {
Set<String> expressions = new HashSet<String>();
for (NameValueExpression expr : condition.getExpressions()) {
for (NameValueExpression<String> expr : condition.getExpressions()) {
expressions.add(expr.toString());
}
return expressions;

View File

@@ -132,7 +132,7 @@ public abstract class AbstractMessageConverterMethodArgumentResolver implements
for (HttpMessageConverter<?> converter : this.messageConverters) {
if (converter instanceof GenericHttpMessageConverter) {
GenericHttpMessageConverter genericConverter = (GenericHttpMessageConverter) converter;
GenericHttpMessageConverter<?> genericConverter = (GenericHttpMessageConverter<?>) converter;
if (genericConverter.canRead(targetType, contextClass, contentType)) {
if (logger.isDebugEnabled()) {
logger.debug("Reading [" + targetType + "] as \"" +

View File

@@ -79,7 +79,7 @@ public class MvcUriComponentsBuilder extends UriComponentsBuilder {
static {
defaultUriComponentsContributor = new CompositeUriComponentsContributor(
Arrays.asList(
Arrays.<Object> asList(
new PathVariableMethodArgumentResolver(),
new RequestParamMethodArgumentResolver(null, false)));
}
@@ -180,10 +180,10 @@ public class MvcUriComponentsBuilder extends UriComponentsBuilder {
* class AddressController {
*
* &#064;RequestMapping("/{country}")
* public HttpEntity<Void> getAddressesForCountry(&#064;PathVariable String country) { }
* public HttpEntity<Void> getAddressesForCountry(&#064;PathVariable String country) { ... }
*
* &#064;RequestMapping(value="/", method=RequestMethod.POST)
* public void addAddress(Address address) { }
* public void addAddress(Address address) { ... }
* }
* </pre>
*
@@ -434,4 +434,4 @@ public class MvcUriComponentsBuilder extends UriComponentsBuilder {
}
}
}

View File

@@ -137,7 +137,7 @@ public class RequestPartMethodArgumentResolver extends AbstractMessageConverterM
}
else if (isPartCollection(parameter)) {
assertIsMultipartRequest(servletRequest);
arg = new ArrayList(servletRequest.getParts());
arg = new ArrayList<Object>(servletRequest.getParts());
}
else {
try {

View File

@@ -168,7 +168,7 @@ public class MultiActionController extends AbstractController implements LastMod
private final Map<String, Method> lastModifiedMethodMap = new HashMap<String, Method>();
/** Methods, keyed by exception class */
private final Map<Class, Method> exceptionHandlerMap = new HashMap<Class, Method>();
private final Map<Class<?>, Method> exceptionHandlerMap = new HashMap<Class<?>, Method>();
/**
@@ -287,10 +287,10 @@ public class MultiActionController extends AbstractController implements LastMod
* as handler method (to avoid potential stack overflow).
*/
private boolean isHandlerMethod(Method method) {
Class returnType = method.getReturnType();
Class<?> returnType = method.getReturnType();
if (ModelAndView.class.equals(returnType) || Map.class.equals(returnType) || String.class.equals(returnType) ||
void.class.equals(returnType)) {
Class[] parameterTypes = method.getParameterTypes();
Class<?>[] parameterTypes = method.getParameterTypes();
return (parameterTypes.length >= 2 &&
HttpServletRequest.class.equals(parameterTypes[0]) &&
HttpServletResponse.class.equals(parameterTypes[1]) &&
@@ -327,8 +327,8 @@ public class MultiActionController extends AbstractController implements LastMod
try {
Method lastModifiedMethod = delegate.getClass().getMethod(
method.getName() + LAST_MODIFIED_METHOD_SUFFIX,
new Class[] {HttpServletRequest.class});
Class returnType = lastModifiedMethod.getReturnType();
new Class<?>[] {HttpServletRequest.class});
Class<?> returnType = lastModifiedMethod.getReturnType();
if (!(long.class.equals(returnType) || Long.class.equals(returnType))) {
throw new IllegalStateException("last-modified method [" + lastModifiedMethod +
"] declares an invalid return type - needs to be 'long' or 'Long'");
@@ -447,7 +447,7 @@ public class MultiActionController extends AbstractController implements LastMod
}
try {
Class[] paramTypes = method.getParameterTypes();
Class<?>[] paramTypes = method.getParameterTypes();
List<Object> params = new ArrayList<Object>(4);
params.add(request);
params.add(response);
@@ -493,7 +493,7 @@ public class MultiActionController extends AbstractController implements LastMod
return (ModelAndView) returnValue;
}
else if (returnValue instanceof Map) {
return new ModelAndView().addAllObjects((Map) returnValue);
return new ModelAndView().addAllObjects((Map<String, ?>) returnValue);
}
else if (returnValue instanceof String) {
return new ModelAndView((String) returnValue);
@@ -603,7 +603,7 @@ public class MultiActionController extends AbstractController implements LastMod
* @param exception the exception to handle
*/
protected Method getExceptionHandler(Throwable exception) {
Class exceptionClass = exception.getClass();
Class<?> exceptionClass = exception.getClass();
if (logger.isDebugEnabled()) {
logger.debug("Trying to find handler for exception class [" + exceptionClass.getName() + "]");
}

View File

@@ -52,7 +52,7 @@ public class NoSuchRequestHandlingMethodException extends ServletException {
* @param method the HTTP request method of the request
* @param parameterMap the request's parameters as map
*/
public NoSuchRequestHandlingMethodException(String urlPath, String method, Map parameterMap) {
public NoSuchRequestHandlingMethodException(String urlPath, String method, Map<String, String[]> parameterMap) {
super("No matching handler method found for servlet request: path '" + urlPath +
"', method '" + method + "', parameters " + StylerUtils.style(parameterMap));
}
@@ -62,7 +62,7 @@ public class NoSuchRequestHandlingMethodException extends ServletException {
* @param methodName the name of the handler method that wasn't found
* @param controllerClass the class the handler method was expected to be in
*/
public NoSuchRequestHandlingMethodException(String methodName, Class controllerClass) {
public NoSuchRequestHandlingMethodException(String methodName, Class<?> controllerClass) {
super("No request handling method with name '" + methodName +
"' in class [" + controllerClass.getName() + "]");
this.methodName = methodName;

View File

@@ -86,7 +86,7 @@ public class PropertiesMethodNameResolver extends AbstractUrlMethodNameResolver
if (methodName != null) {
return methodName;
}
Enumeration propNames = this.mappings.propertyNames();
Enumeration<?> propNames = this.mappings.propertyNames();
while (propNames.hasMoreElements()) {
String registeredPath = (String) propNames.nextElement();
if (this.pathMatcher.match(registeredPath, urlPath)) {

View File

@@ -38,7 +38,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
private Set<String> excludedPackages = Collections.singleton("org.springframework.web.servlet.mvc");
private Set<Class> excludedClasses = Collections.emptySet();
private Set<Class<?>> excludedClasses = Collections.emptySet();
/**
@@ -69,9 +69,9 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
* Specify controller classes that should be excluded from this mapping.
* Any such classes will simply be ignored by this HandlerMapping.
*/
public void setExcludedClasses(Class[] excludedClasses) {
public void setExcludedClasses(Class<?>[] excludedClasses) {
this.excludedClasses = (excludedClasses != null) ?
new HashSet<Class>(Arrays.asList(excludedClasses)) : new HashSet<Class>();
new HashSet<Class<?>>(Arrays.asList(excludedClasses)) : new HashSet<Class<?>>();
}
@@ -81,7 +81,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
*/
@Override
protected String[] determineUrlsForHandler(String beanName) {
Class beanClass = getApplicationContext().getType(beanName);
Class<?> beanClass = getApplicationContext().getType(beanName);
if (isEligibleForMapping(beanName, beanClass)) {
return buildUrlsForHandler(beanName, beanClass);
}
@@ -98,7 +98,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
* @see #setExcludedPackages
* @see #setExcludedClasses
*/
protected boolean isEligibleForMapping(String beanName, Class beanClass) {
protected boolean isEligibleForMapping(String beanName, Class<?> beanClass) {
if (beanClass == null) {
if (logger.isDebugEnabled()) {
logger.debug("Excluding controller bean '" + beanName + "' from class name mapping " +
@@ -131,7 +131,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
* that is supported by this mapping strategy.
* @param beanClass the class to introspect
*/
protected boolean isControllerType(Class beanClass) {
protected boolean isControllerType(Class<?> beanClass) {
return this.predicate.isControllerType(beanClass);
}
@@ -140,7 +140,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
* that dispatches to multiple action methods.
* @param beanClass the class to introspect
*/
protected boolean isMultiActionControllerType(Class beanClass) {
protected boolean isMultiActionControllerType(Class<?> beanClass) {
return this.predicate.isMultiActionControllerType(beanClass);
}
@@ -151,6 +151,6 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
* @param beanClass the type of the bean
* @return the URLs determined for the bean
*/
protected abstract String[] buildUrlsForHandler(String beanName, Class beanClass);
protected abstract String[] buildUrlsForHandler(String beanName, Class<?> beanClass);
}

View File

@@ -29,13 +29,13 @@ import org.springframework.stereotype.Controller;
class AnnotationControllerTypePredicate extends ControllerTypePredicate {
@Override
public boolean isControllerType(Class beanClass) {
public boolean isControllerType(Class<?> beanClass) {
return (super.isControllerType(beanClass) ||
AnnotationUtils.findAnnotation(beanClass, Controller.class) != null);
}
@Override
public boolean isMultiActionControllerType(Class beanClass) {
public boolean isMultiActionControllerType(Class<?> beanClass) {
return (super.isMultiActionControllerType(beanClass) ||
AnnotationUtils.findAnnotation(beanClass, Controller.class) != null);
}

View File

@@ -65,7 +65,7 @@ public class ControllerBeanNameHandlerMapping extends AbstractControllerUrlHandl
@Override
protected String[] buildUrlsForHandler(String beanName, Class beanClass) {
protected String[] buildUrlsForHandler(String beanName, Class<?> beanClass) {
List<String> urls = new ArrayList<String>();
urls.add(generatePathMapping(beanName));
String[] aliases = getApplicationContext().getAliases(beanName);

View File

@@ -122,7 +122,7 @@ public class ControllerClassNameHandlerMapping extends AbstractControllerUrlHand
@Override
protected String[] buildUrlsForHandler(String beanName, Class beanClass) {
protected String[] buildUrlsForHandler(String beanName, Class<?> beanClass) {
return generatePathMappings(beanClass);
}
@@ -133,7 +133,7 @@ public class ControllerClassNameHandlerMapping extends AbstractControllerUrlHand
* @param beanClass the controller bean class to generate a mapping for
* @return the URL path mappings for the given controller
*/
protected String[] generatePathMappings(Class beanClass) {
protected String[] generatePathMappings(Class<?> beanClass) {
StringBuilder pathMapping = buildPathPrefix(beanClass);
String className = ClassUtils.getShortName(beanClass);
String path = (className.endsWith(CONTROLLER_SUFFIX) ?
@@ -159,7 +159,7 @@ public class ControllerClassNameHandlerMapping extends AbstractControllerUrlHand
* @param beanClass the controller bean class to generate a mapping for
* @return the path prefix, potentially including subpackage names as path elements
*/
private StringBuilder buildPathPrefix(Class beanClass) {
private StringBuilder buildPathPrefix(Class<?> beanClass) {
StringBuilder pathMapping = new StringBuilder();
if (this.pathPrefix != null) {
pathMapping.append(this.pathPrefix);

View File

@@ -27,11 +27,11 @@ import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
*/
class ControllerTypePredicate {
public boolean isControllerType(Class beanClass) {
public boolean isControllerType(Class<?> beanClass) {
return Controller.class.isAssignableFrom(beanClass);
}
public boolean isMultiActionControllerType(Class beanClass) {
public boolean isMultiActionControllerType(Class<?> beanClass) {
return MultiActionController.class.isAssignableFrom(beanClass);
}

View File

@@ -61,13 +61,13 @@ public class BindStatus {
private Object value;
private Class valueType;
private Class<?> valueType;
private Object actualValue;
private PropertyEditor editor;
private List objectErrors;
private List<? extends ObjectError> objectErrors;
private String[] errorCodes;
@@ -161,7 +161,7 @@ public class BindStatus {
private void initErrorCodes() {
this.errorCodes = new String[this.objectErrors.size()];
for (int i = 0; i < this.objectErrors.size(); i++) {
ObjectError error = (ObjectError) this.objectErrors.get(i);
ObjectError error = this.objectErrors.get(i);
this.errorCodes[i] = error.getCode();
}
}
@@ -173,7 +173,7 @@ public class BindStatus {
if (this.errorMessages == null) {
this.errorMessages = new String[this.objectErrors.size()];
for (int i = 0; i < this.objectErrors.size(); i++) {
ObjectError error = (ObjectError) this.objectErrors.get(i);
ObjectError error = this.objectErrors.get(i);
this.errorMessages[i] = this.requestContext.getMessage(error, this.htmlEscape);
}
}
@@ -214,7 +214,7 @@ public class BindStatus {
* '{@code getValue().getClass()}' since '{@code getValue()}' may
* return '{@code null}'.
*/
public Class getValueType() {
public Class<?> getValueType() {
return this.valueType;
}
@@ -318,7 +318,7 @@ public class BindStatus {
* @param valueClass the value class that an editor is needed for
* @return the associated PropertyEditor, or {@code null} if none
*/
public PropertyEditor findEditor(Class valueClass) {
public PropertyEditor findEditor(Class<?> valueClass) {
return (this.bindingResult != null ? this.bindingResult.findEditor(this.expression, valueClass) : null);
}

View File

@@ -624,7 +624,7 @@ public class RequestContext {
* @param defaultMessage String to return if the lookup fails
* @return the message
*/
public String getMessage(String code, List args, String defaultMessage) {
public String getMessage(String code, List<?> args, String defaultMessage) {
return getMessage(code, (args != null ? args.toArray() : null), defaultMessage, isDefaultHtmlEscape());
}
@@ -669,7 +669,7 @@ public class RequestContext {
* @return the message
* @throws org.springframework.context.NoSuchMessageException if not found
*/
public String getMessage(String code, List args) throws NoSuchMessageException {
public String getMessage(String code, List<?> args) throws NoSuchMessageException {
return getMessage(code, (args != null ? args.toArray() : null), isDefaultHtmlEscape());
}
@@ -742,7 +742,7 @@ public class RequestContext {
* @param defaultMessage String to return if the lookup fails
* @return the message
*/
public String getThemeMessage(String code, List args, String defaultMessage) {
public String getThemeMessage(String code, List<?> args, String defaultMessage) {
return getTheme().getMessageSource().getMessage(code, (args != null ? args.toArray() : null), defaultMessage,
this.locale);
}
@@ -781,7 +781,7 @@ public class RequestContext {
* @return the message
* @throws org.springframework.context.NoSuchMessageException if not found
*/
public String getThemeMessage(String code, List args) throws NoSuchMessageException {
public String getThemeMessage(String code, List<?> args) throws NoSuchMessageException {
return getTheme().getMessageSource().getMessage(code, (args != null ? args.toArray() : null), this.locale);
}

View File

@@ -17,9 +17,9 @@
package org.springframework.web.servlet.tags;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.el.VariableResolver;
import org.springframework.context.expression.BeanFactoryResolver;
import org.springframework.context.expression.EnvironmentAccessor;
@@ -151,11 +151,12 @@ public class EvalTag extends HtmlEscapingAwareTag {
}
@SuppressWarnings("deprecation")
private static class JspPropertyAccessor implements PropertyAccessor {
private final PageContext pageContext;
private final VariableResolver variableResolver;
private final javax.servlet.jsp.el.VariableResolver variableResolver;
public JspPropertyAccessor(PageContext pageContext) {
this.pageContext = pageContext;

View File

@@ -287,7 +287,7 @@ public class MessageTag extends HtmlEscapingAwareTag implements ArgumentAware {
return (Object[]) arguments;
}
else if (arguments instanceof Collection) {
return ((Collection) arguments).toArray();
return ((Collection<?>) arguments).toArray();
}
else if (arguments != null) {
// Assume a single argument object.

View File

@@ -19,6 +19,7 @@ package org.springframework.web.servlet.tags.form;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.jsp.JspException;
import org.springframework.beans.BeanWrapper;
@@ -185,6 +186,7 @@ public abstract class AbstractMultiCheckedElementTag extends AbstractCheckedElem
* value matches the bound value.
*/
@Override
@SuppressWarnings("rawtypes")
protected int writeTagContent(TagWriter tagWriter) throws JspException {
Object items = getItems();
Object itemsObject = (items instanceof String ? evaluate("items", items) : items);
@@ -213,15 +215,15 @@ public abstract class AbstractMultiCheckedElementTag extends AbstractCheckedElem
}
}
else if (itemsObject instanceof Collection) {
final Collection optionCollection = (Collection) itemsObject;
final Collection<?> optionCollection = (Collection<?>) itemsObject;
int itemIndex = 0;
for (Iterator it = optionCollection.iterator(); it.hasNext(); itemIndex++) {
for (Iterator<?> it = optionCollection.iterator(); it.hasNext(); itemIndex++) {
Object item = it.next();
writeObjectEntry(tagWriter, valueProperty, labelProperty, item, itemIndex);
}
}
else if (itemsObject instanceof Map) {
final Map optionMap = (Map) itemsObject;
final Map<?, ?> optionMap = (Map<?, ?>) itemsObject;
int itemIndex = 0;
for (Iterator it = optionMap.entrySet().iterator(); it.hasNext(); itemIndex++) {
Map.Entry entry = (Map.Entry) it.next();
@@ -254,7 +256,7 @@ public abstract class AbstractMultiCheckedElementTag extends AbstractCheckedElem
}
private void writeMapEntry(TagWriter tagWriter, String valueProperty,
String labelProperty, Map.Entry entry, int itemIndex) throws JspException {
String labelProperty, Map.Entry<?, ?> entry, int itemIndex) throws JspException {
Object mapKey = entry.getKey();
Object mapValue = entry.getValue();

View File

@@ -70,7 +70,7 @@ public class CheckboxTag extends AbstractSingleCheckedElementTag {
tagWriter.writeAttribute("type", getInputType());
Object boundValue = getBoundValue();
Class valueType = getBindStatus().getValueType();
Class<?> valueType = getBindStatus().getValueType();
if (Boolean.class.equals(valueType) || boolean.class.equals(valueType)) {
// the concrete type may not be a Boolean - can be String

View File

@@ -135,7 +135,7 @@ class OptionWriter {
else if (this.optionSource instanceof Map) {
renderFromMap(tagWriter);
}
else if (this.optionSource instanceof Class && ((Class) this.optionSource).isEnum()) {
else if (this.optionSource instanceof Class && ((Class<?>) this.optionSource).isEnum()) {
renderFromEnum(tagWriter);
}
else {
@@ -158,8 +158,8 @@ class OptionWriter {
* @see #renderOption(TagWriter, Object, Object, Object)
*/
private void renderFromMap(TagWriter tagWriter) throws JspException {
Map<?, ?> optionMap = (Map) this.optionSource;
for (Map.Entry entry : optionMap.entrySet()) {
Map<?, ?> optionMap = (Map<?, ?>) this.optionSource;
for (Map.Entry<?, ?> entry : optionMap.entrySet()) {
Object mapKey = entry.getKey();
Object mapValue = entry.getValue();
Object renderValue = (this.valueProperty != null ?
@@ -177,7 +177,7 @@ class OptionWriter {
* @see #doRenderFromCollection(java.util.Collection, TagWriter)
*/
private void renderFromCollection(TagWriter tagWriter) throws JspException {
doRenderFromCollection((Collection) this.optionSource, tagWriter);
doRenderFromCollection((Collection<?>) this.optionSource, tagWriter);
}
/**
@@ -185,7 +185,7 @@ class OptionWriter {
* @see #doRenderFromCollection(java.util.Collection, TagWriter)
*/
private void renderFromEnum(TagWriter tagWriter) throws JspException {
doRenderFromCollection(CollectionUtils.arrayToList(((Class) this.optionSource).getEnumConstants()), tagWriter);
doRenderFromCollection(CollectionUtils.arrayToList(((Class<?>) this.optionSource).getEnumConstants()), tagWriter);
}
/**
@@ -194,7 +194,7 @@ class OptionWriter {
* when rendering the '{@code value}' of the '{@code option}' and the value of the
* {@link #labelProperty} property is used when rendering the label.
*/
private void doRenderFromCollection(Collection optionCollection, TagWriter tagWriter) throws JspException {
private void doRenderFromCollection(Collection<?> optionCollection, TagWriter tagWriter) throws JspException {
for (Object item : optionCollection) {
BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(item);
Object value;

View File

@@ -261,7 +261,7 @@ public class SelectTag extends AbstractHtmlInputElementTag {
*/
private boolean forceMultiple() throws JspException {
BindStatus bindStatus = getBindStatus();
Class valueType = bindStatus.getValueType();
Class<?> valueType = bindStatus.getValueType();
if (valueType != null && typeRequiresMultiple(valueType)) {
return true;
}
@@ -278,7 +278,7 @@ public class SelectTag extends AbstractHtmlInputElementTag {
* Returns '{@code true}' for arrays, {@link Collection Collections}
* and {@link Map Maps}.
*/
private static boolean typeRequiresMultiple(Class type) {
private static boolean typeRequiresMultiple(Class<?> type) {
return (type.isArray() || Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type));
}

View File

@@ -89,10 +89,10 @@ abstract class SelectedValueComparator {
selected = collectionCompare(CollectionUtils.arrayToList(boundValue), candidateValue, bindStatus);
}
else if (boundValue instanceof Collection) {
selected = collectionCompare((Collection) boundValue, candidateValue, bindStatus);
selected = collectionCompare((Collection<?>) boundValue, candidateValue, bindStatus);
}
else if (boundValue instanceof Map) {
selected = mapCompare((Map) boundValue, candidateValue, bindStatus);
selected = mapCompare((Map<?, ?>) boundValue, candidateValue, bindStatus);
}
if (!selected) {
selected = exhaustiveCompare(boundValue, candidateValue, bindStatus.getEditor(), null);
@@ -100,7 +100,7 @@ abstract class SelectedValueComparator {
return selected;
}
private static boolean collectionCompare(Collection boundCollection, Object candidateValue, BindStatus bindStatus) {
private static boolean collectionCompare(Collection<?> boundCollection, Object candidateValue, BindStatus bindStatus) {
try {
if (boundCollection.contains(candidateValue)) {
return true;
@@ -112,7 +112,7 @@ abstract class SelectedValueComparator {
return exhaustiveCollectionCompare(boundCollection, candidateValue, bindStatus);
}
private static boolean mapCompare(Map boundMap, Object candidateValue, BindStatus bindStatus) {
private static boolean mapCompare(Map<?, ?> boundMap, Object candidateValue, BindStatus bindStatus) {
try {
if (boundMap.containsKey(candidateValue)) {
return true;
@@ -125,7 +125,7 @@ abstract class SelectedValueComparator {
}
private static boolean exhaustiveCollectionCompare(
Collection collection, Object candidateValue, BindStatus bindStatus) {
Collection<?> collection, Object candidateValue, BindStatus bindStatus) {
Map<PropertyEditor, Object> convertedValueCache = new HashMap<PropertyEditor, Object>(1);
PropertyEditor editor = null;
@@ -149,7 +149,7 @@ abstract class SelectedValueComparator {
String candidateDisplayString = ValueFormatter.getDisplayString(candidate, editor, false);
if (boundValue.getClass().isEnum()) {
Enum boundEnum = (Enum) boundValue;
Enum<?> boundEnum = (Enum<?>) boundValue;
String enumCodeAsString = ObjectUtils.getDisplayString(boundEnum.name());
if (enumCodeAsString.equals(candidateDisplayString)) {
return true;

View File

@@ -45,7 +45,7 @@ public class TagWriter {
/**
* Stores {@link TagStateEntry tag state}. Stack model naturally supports tag nesting.
*/
private final Stack tagState = new Stack();
private final Stack<TagStateEntry> tagState = new Stack<TagStateEntry>();
/**
@@ -194,7 +194,7 @@ public class TagWriter {
}
private TagStateEntry currentState() {
return (TagStateEntry) this.tagState.peek();
return this.tagState.peek();
}

View File

@@ -117,8 +117,8 @@ public abstract class AbstractTemplateView extends AbstractUrlBasedView {
Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
if (this.exposeRequestAttributes) {
for (Enumeration en = request.getAttributeNames(); en.hasMoreElements();) {
String attribute = (String) en.nextElement();
for (Enumeration<String> en = request.getAttributeNames(); en.hasMoreElements();) {
String attribute = en.nextElement();
if (model.containsKey(attribute) && !this.allowRequestOverride) {
throw new ServletException("Cannot expose request attribute '" + attribute +
"' because of an existing model object of the same name");
@@ -135,8 +135,8 @@ public abstract class AbstractTemplateView extends AbstractUrlBasedView {
if (this.exposeSessionAttributes) {
HttpSession session = request.getSession(false);
if (session != null) {
for (Enumeration en = session.getAttributeNames(); en.hasMoreElements();) {
String attribute = (String) en.nextElement();
for (Enumeration<String> en = session.getAttributeNames(); en.hasMoreElements();) {
String attribute = en.nextElement();
if (model.containsKey(attribute) && !this.allowSessionOverride) {
throw new ServletException("Cannot expose session attribute '" + attribute +
"' because of an existing model object of the same name");

View File

@@ -44,7 +44,7 @@ public class AbstractTemplateViewResolver extends UrlBasedViewResolver {
@Override
protected Class requiredViewClass() {
protected Class<?> requiredViewClass() {
return AbstractTemplateView.class;
}

View File

@@ -63,7 +63,7 @@ public class InternalResourceViewResolver extends UrlBasedViewResolver {
* is present.
*/
public InternalResourceViewResolver() {
Class viewClass = requiredViewClass();
Class<?> viewClass = requiredViewClass();
if (viewClass.equals(InternalResourceView.class) && jstlPresent) {
viewClass = JstlView.class;
}
@@ -74,7 +74,7 @@ public class InternalResourceViewResolver extends UrlBasedViewResolver {
* This resolver requires {@link InternalResourceView}.
*/
@Override
protected Class requiredViewClass() {
protected Class<?> requiredViewClass() {
return InternalResourceView.class;
}

View File

@@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -381,7 +382,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
valueIter = Arrays.asList(ObjectUtils.toObjectArray(rawValue)).iterator();
}
else if (rawValue instanceof Collection) {
valueIter = ((Collection) rawValue).iterator();
valueIter = ((Collection<Object>) rawValue).iterator();
}
else {
valueIter = Collections.singleton(rawValue).iterator();
@@ -458,7 +459,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
return true;
}
if (value instanceof Collection) {
Collection coll = (Collection) value;
Collection<?> coll = (Collection<?>) value;
if (coll.isEmpty()) {
return false;
}

View File

@@ -100,7 +100,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
public static final String FORWARD_URL_PREFIX = "forward:";
private Class viewClass;
private Class<?> viewClass;
private String prefix = "";
@@ -129,7 +129,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
* (by default, AbstractUrlBasedView)
* @see AbstractUrlBasedView
*/
public void setViewClass(Class viewClass) {
public void setViewClass(Class<?> viewClass) {
if (viewClass == null || !requiredViewClass().isAssignableFrom(viewClass)) {
throw new IllegalArgumentException(
"Given view class [" + (viewClass != null ? viewClass.getName() : null) +
@@ -141,7 +141,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
/**
* Return the view class to be used to create views.
*/
protected Class getViewClass() {
protected Class<?> getViewClass() {
return this.viewClass;
}
@@ -150,7 +150,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
* This implementation returns AbstractUrlBasedView.
* @see AbstractUrlBasedView
*/
protected Class requiredViewClass() {
protected Class<?> requiredViewClass() {
return AbstractUrlBasedView.class;
}

View File

@@ -48,7 +48,7 @@ public class FreeMarkerViewResolver extends AbstractTemplateViewResolver {
* Requires {@link FreeMarkerView}.
*/
@Override
protected Class requiredViewClass() {
protected Class<?> requiredViewClass() {
return FreeMarkerView.class;
}

View File

@@ -314,7 +314,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
"'reportDataKey' for main report is required when specifying a value for 'subReportDataKeys'");
}
this.subReports = new HashMap<String, JasperReport>(this.subReportUrls.size());
for (Enumeration urls = this.subReportUrls.propertyNames(); urls.hasMoreElements();) {
for (Enumeration<?> urls = this.subReportUrls.propertyNames(); urls.hasMoreElements();) {
String key = (String) urls.nextElement();
String path = this.subReportUrls.getProperty(key);
Resource resource = getApplicationContext().getResource(path);
@@ -434,7 +434,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
String fieldName = fqFieldName.substring(index + 1);
try {
Class cls = ClassUtils.forName(className, getApplicationContext().getClassLoader());
Class<?> cls = ClassUtils.forName(className, getApplicationContext().getClassLoader());
Field field = cls.getField(fieldName);
if (JRExporterParameter.class.isAssignableFrom(field.getType())) {
@@ -644,7 +644,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
}
}
else {
Collection values = model.values();
Collection<?> values = model.values();
jrDataSource = CollectionUtils.findValueOfType(values, JRDataSource.class);
if (jrDataSource == null) {
JRDataSourceProvider provider = CollectionUtils.findValueOfType(values, JRDataSourceProvider.class);
@@ -712,7 +712,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
*/
private void populateHeaders(HttpServletResponse response) {
// Apply the headers to the response.
for (Enumeration en = this.headers.propertyNames(); en.hasMoreElements();) {
for (Enumeration<?> en = this.headers.propertyNames(); en.hasMoreElements();) {
String key = (String) en.nextElement();
response.addHeader(key, this.headers.getProperty(key));
}
@@ -802,8 +802,8 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
* <p>Default value types are: {@code java.util.Collection} and {@code Object} array.
* @return the value types in prioritized order
*/
protected Class[] getReportDataTypes() {
return new Class[] {Collection.class, Object[].class};
protected Class<?>[] getReportDataTypes() {
return new Class<?>[] {Collection.class, Object[].class};
}

View File

@@ -51,7 +51,7 @@ public class JasperReportsViewResolver extends UrlBasedViewResolver {
* Requires the view class to be a subclass of {@link AbstractJasperReportsView}.
*/
@Override
protected Class requiredViewClass() {
protected Class<?> requiredViewClass() {
return AbstractJasperReportsView.class;
}

View File

@@ -71,9 +71,9 @@ public class SpringTilesApplicationContextFactory extends AbstractTilesApplicati
public SpringWildcardServletTilesApplicationContext(ServletContext servletContext, Map<String, String> params) {
super(servletContext);
this.mergedInitParams = new LinkedHashMap<String, String>();
Enumeration initParamNames = servletContext.getInitParameterNames();
Enumeration<String> initParamNames = servletContext.getInitParameterNames();
while (initParamNames.hasMoreElements()) {
String initParamName = (String) initParamNames.nextElement();
String initParamName = initParamNames.nextElement();
this.mergedInitParams.put(initParamName, servletContext.getInitParameter(initParamName));
}
if (params != null) {

View File

@@ -196,7 +196,7 @@ public class TilesConfigurer implements ServletContextAware, InitializingBean, D
public void setCompleteAutoload(boolean completeAutoload) {
if (completeAutoload) {
try {
Class clazz = getClass().getClassLoader().loadClass(
Class<?> clazz = getClass().getClassLoader().loadClass(
"org.apache.tiles.extras.complete.CompleteAutoloadTilesInitializer");
this.tilesInitializer = (TilesInitializer) clazz.newInstance();
}
@@ -529,9 +529,9 @@ public class TilesConfigurer implements ServletContextAware, InitializingBean, D
logger.debug("Registering Tiles 2.2 AttributeEvaluatorFactory for JSP 2.1");
try {
ClassLoader cl = TilesElActivator.class.getClassLoader();
Class aef = cl.loadClass("org.apache.tiles.evaluator.AttributeEvaluatorFactory");
Class baef = cl.loadClass("org.apache.tiles.evaluator.BasicAttributeEvaluatorFactory");
Constructor baefCtor = baef.getConstructor(AttributeEvaluator.class);
Class<?> aef = cl.loadClass("org.apache.tiles.evaluator.AttributeEvaluatorFactory");
Class<?> baef = cl.loadClass("org.apache.tiles.evaluator.BasicAttributeEvaluatorFactory");
Constructor<?> baefCtor = baef.getConstructor(AttributeEvaluator.class);
ELAttributeEvaluator evaluator = new ELAttributeEvaluator();
evaluator.setApplicationContext(container.getApplicationContext());
evaluator.init(new HashMap<String, String>());

View File

@@ -18,6 +18,7 @@ package org.springframework.web.servlet.view.tiles2;
import java.util.Locale;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -30,11 +31,9 @@ import org.apache.tiles.impl.BasicTilesContainer;
import org.apache.tiles.servlet.context.ServletTilesApplicationContext;
import org.apache.tiles.servlet.context.ServletTilesRequestContext;
import org.apache.tiles.servlet.context.ServletUtil;
import org.springframework.web.servlet.support.JstlUtils;
import org.springframework.web.servlet.support.RequestContext;
import org.springframework.web.servlet.view.AbstractUrlBasedView;
import org.springframework.web.util.WebUtils;
/**
* {@link org.springframework.web.servlet.View} implementation that retrieves a

View File

@@ -47,7 +47,7 @@ public class TilesViewResolver extends UrlBasedViewResolver {
* Requires {@link TilesView}.
*/
@Override
protected Class requiredViewClass() {
protected Class<?> requiredViewClass() {
return TilesView.class;
}

View File

@@ -46,7 +46,7 @@ public class VelocityLayoutViewResolver extends VelocityViewResolver {
* @see VelocityLayoutView
*/
@Override
protected Class requiredViewClass() {
protected Class<?> requiredViewClass() {
return VelocityLayoutView.class;
}

View File

@@ -108,7 +108,7 @@ public class VelocityToolboxView extends VelocityView {
if (getToolboxConfigLocation() != null) {
ToolboxManager toolboxManager = ServletToolboxManager.getInstance(
getServletContext(), getToolboxConfigLocation());
Map toolboxContext = toolboxManager.getToolbox(velocityContext);
Map<?, ?> toolboxContext = toolboxManager.getToolbox(velocityContext);
velocityContext.setToolbox(toolboxContext);
}

View File

@@ -86,7 +86,7 @@ import org.springframework.web.util.NestedServletException;
*/
public class VelocityView extends AbstractTemplateView {
private Map<String, Class> toolAttributes;
private Map<String, Class<?>> toolAttributes;
private String dateToolAttribute;
@@ -128,7 +128,7 @@ public class VelocityView extends AbstractTemplateView {
* @see #setDateToolAttribute
* @see #setNumberToolAttribute
*/
public void setToolAttributes(Map<String, Class> toolAttributes) {
public void setToolAttributes(Map<String, Class<?>> toolAttributes) {
this.toolAttributes = toolAttributes;
}
@@ -393,9 +393,9 @@ public class VelocityView extends AbstractTemplateView {
protected void exposeToolAttributes(Context velocityContext, HttpServletRequest request) throws Exception {
// Expose generic attributes.
if (this.toolAttributes != null) {
for (Map.Entry<String, Class> entry : this.toolAttributes.entrySet()) {
for (Map.Entry<String, Class<?>> entry : this.toolAttributes.entrySet()) {
String attributeName = entry.getKey();
Class toolClass = entry.getValue();
Class<?> toolClass = entry.getValue();
try {
Object tool = toolClass.newInstance();
initTool(tool, velocityContext);

View File

@@ -58,7 +58,7 @@ public class VelocityViewResolver extends AbstractTemplateViewResolver {
* Requires {@link VelocityView}.
*/
@Override
protected Class requiredViewClass() {
protected Class<?> requiredViewClass() {
return VelocityView.class;
}

View File

@@ -73,7 +73,7 @@ import org.springframework.web.util.WebUtils;
*/
public class XsltView extends AbstractUrlBasedView {
private Class transformerFactoryClass;
private Class<?> transformerFactoryClass;
private String sourceKey;
@@ -97,7 +97,7 @@ public class XsltView extends AbstractUrlBasedView {
* <p>The default constructor of the specified class will be called
* to build the TransformerFactory for this view.
*/
public void setTransformerFactoryClass(Class transformerFactoryClass) {
public void setTransformerFactoryClass(Class<?> transformerFactoryClass) {
Assert.isAssignable(TransformerFactory.class, transformerFactoryClass);
this.transformerFactoryClass = transformerFactoryClass;
}
@@ -195,7 +195,7 @@ public class XsltView extends AbstractUrlBasedView {
* @see #setTransformerFactoryClass
* @see #getTransformerFactory()
*/
protected TransformerFactory newTransformerFactory(Class transformerFactoryClass) {
protected TransformerFactory newTransformerFactory(Class<?> transformerFactoryClass) {
if (transformerFactoryClass != null) {
try {
return (TransformerFactory) transformerFactoryClass.newInstance();
@@ -283,8 +283,8 @@ public class XsltView extends AbstractUrlBasedView {
* {@link Reader}, {@link InputStream} and {@link Resource}.
* @return the supported source types
*/
protected Class[] getSourceTypes() {
return new Class[] {Source.class, Document.class, Node.class, Reader.class, InputStream.class, Resource.class};
protected Class<?>[] getSourceTypes() {
return new Class<?>[] {Source.class, Document.class, Node.class, Reader.class, InputStream.class, Resource.class};
}
/**
@@ -362,7 +362,7 @@ public class XsltView extends AbstractUrlBasedView {
*/
protected final void copyOutputProperties(Transformer transformer) {
if (this.outputProperties != null) {
Enumeration en = this.outputProperties.propertyNames();
Enumeration<?> en = this.outputProperties.propertyNames();
while (en.hasMoreElements()) {
String name = (String) en.nextElement();
transformer.setOutputProperty(name, this.outputProperties.getProperty(name));

View File

@@ -118,7 +118,7 @@ public class XsltViewResolver extends UrlBasedViewResolver {
@Override
protected Class requiredViewClass() {
protected Class<?> requiredViewClass() {
return XsltView.class;
}