Browse Source

Polishing

pull/1386/merge
Juergen Hoeller 8 years ago
parent
commit
0b118322b0
  1. 3
      spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java
  2. 15
      spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java
  3. 2
      spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java
  4. 2
      spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java
  5. 1
      spring-web/src/main/java/org/springframework/web/filter/ForwardedHeaderFilter.java
  6. 7
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletInvocableHandlerMethod.java

3
spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java

@ -60,8 +60,7 @@ public abstract class AbstractApplicationEventMulticaster
private final ListenerRetriever defaultRetriever = new ListenerRetriever(false); private final ListenerRetriever defaultRetriever = new ListenerRetriever(false);
final Map<ListenerCacheKey, ListenerRetriever> retrieverCache = final Map<ListenerCacheKey, ListenerRetriever> retrieverCache = new ConcurrentHashMap<>(64);
new ConcurrentHashMap<>(64);
private ClassLoader beanClassLoader; private ClassLoader beanClassLoader;

15
spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java

@ -139,40 +139,35 @@ public class GenericTypeResolverTests {
assertThat(x, equalTo((Type) Long.class)); assertThat(x, equalTo((Type) Long.class));
} }
@Test @Test // SPR-11030
public void getGenericsCannotBeResolved() throws Exception { public void getGenericsCannotBeResolved() throws Exception {
// SPR-11030
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(List.class, Iterable.class); Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(List.class, Iterable.class);
assertNull(resolved); assertNull(resolved);
} }
@Test @Test // SPR-11052
public void getRawMapTypeCannotBeResolved() throws Exception { public void getRawMapTypeCannotBeResolved() throws Exception {
// SPR-11052
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(Map.class, Map.class); Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(Map.class, Map.class);
assertNull(resolved); assertNull(resolved);
} }
@Test @Test // SPR-11044
public void getGenericsOnArrayFromParamCannotBeResolved() throws Exception { public void getGenericsOnArrayFromParamCannotBeResolved() throws Exception {
// SPR-11044
MethodParameter methodParameter = MethodParameter.forExecutable( MethodParameter methodParameter = MethodParameter.forExecutable(
WithArrayBase.class.getDeclaredMethod("array", Object[].class), 0); WithArrayBase.class.getDeclaredMethod("array", Object[].class), 0);
Class<?> resolved = GenericTypeResolver.resolveParameterType(methodParameter, WithArray.class); Class<?> resolved = GenericTypeResolver.resolveParameterType(methodParameter, WithArray.class);
assertThat(resolved, equalTo((Class<?>) Object[].class)); assertThat(resolved, equalTo((Class<?>) Object[].class));
} }
@Test @Test // SPR-11044
public void getGenericsOnArrayFromReturnCannotBeResolved() throws Exception { public void getGenericsOnArrayFromReturnCannotBeResolved() throws Exception {
// SPR-11044
Class<?> resolved = GenericTypeResolver.resolveReturnType( Class<?> resolved = GenericTypeResolver.resolveReturnType(
WithArrayBase.class.getDeclaredMethod("array", Object[].class), WithArray.class); WithArrayBase.class.getDeclaredMethod("array", Object[].class), WithArray.class);
assertThat(resolved, equalTo((Class<?>) Object[].class)); assertThat(resolved, equalTo((Class<?>) Object[].class));
} }
@Test @Test // SPR-11763
public void resolveIncompleteTypeVariables() { public void resolveIncompleteTypeVariables() {
// SPR-11763
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(IdFixingRepository.class, Repository.class); Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(IdFixingRepository.class, Repository.class);
assertNotNull(resolved); assertNotNull(resolved);
assertEquals(2, resolved.length); assertEquals(2, resolved.length);

2
spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

2
spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

1
spring-web/src/main/java/org/springframework/web/filter/ForwardedHeaderFilter.java

@ -71,6 +71,7 @@ public class ForwardedHeaderFilter extends OncePerRequestFilter {
private final UrlPathHelper pathHelper; private final UrlPathHelper pathHelper;
public ForwardedHeaderFilter() { public ForwardedHeaderFilter() {
this.pathHelper = new UrlPathHelper(); this.pathHelper = new UrlPathHelper();
this.pathHelper.setUrlDecode(false); this.pathHelper.setUrlDecode(false);

7
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletInvocableHandlerMethod.java

@ -249,13 +249,10 @@ public class ServletInvocableHandlerMethod extends InvocableHandlerMethod {
public ConcurrentResultMethodParameter(Object returnValue) { public ConcurrentResultMethodParameter(Object returnValue) {
super(-1); super(-1);
this.returnValue = returnValue; this.returnValue = returnValue;
ResolvableType candidateReturnType = ResolvableType candidateReturnType =
ResolvableType.forType(super.getGenericParameterType()).getGeneric(0); ResolvableType.forType(super.getGenericParameterType()).getGeneric(0);
this.returnType = (returnValue instanceof ReactiveTypeHandler.CollectedValuesList ?
this.returnType = returnValue instanceof ReactiveTypeHandler.CollectedValuesList ? ResolvableType.forClassWithGenerics(List.class, candidateReturnType) : candidateReturnType);
ResolvableType.forClassWithGenerics(List.class, candidateReturnType) :
candidateReturnType;
} }
public ConcurrentResultMethodParameter(ConcurrentResultMethodParameter original) { public ConcurrentResultMethodParameter(ConcurrentResultMethodParameter original) {

Loading…
Cancel
Save