Polishing
This commit is contained in:
parent
4454ffd2b1
commit
912c270f2b
|
@ -165,8 +165,8 @@ public abstract class AbstractSchedulingTaskExecutorTests {
|
|||
TestCallable task2 = new TestCallable(-1);
|
||||
Future<?> future2 = executor.submit(task2);
|
||||
shutdownExecutor();
|
||||
future1.get();
|
||||
future2.get();
|
||||
future1.get(100, TimeUnit.MILLISECONDS);
|
||||
future2.get(100, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -196,8 +196,8 @@ public abstract class AbstractSchedulingTaskExecutorTests {
|
|||
TestCallable task2 = new TestCallable(-1);
|
||||
ListenableFuture<?> future2 = executor.submitListenable(task2);
|
||||
shutdownExecutor();
|
||||
future1.get();
|
||||
future2.get();
|
||||
future1.get(100, TimeUnit.MILLISECONDS);
|
||||
future2.get(100, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -592,7 +592,8 @@ public abstract class AnnotationUtils {
|
|||
}
|
||||
|
||||
static Set<Method> getAnnotatedMethodsInBaseType(Class<?> baseType) {
|
||||
if (ClassUtils.isJavaLanguageInterface(baseType)) {
|
||||
boolean ifcCheck = baseType.isInterface();
|
||||
if (ifcCheck && ClassUtils.isJavaLanguageInterface(baseType)) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
|
@ -600,10 +601,13 @@ public abstract class AnnotationUtils {
|
|||
if (annotatedMethods != null) {
|
||||
return annotatedMethods;
|
||||
}
|
||||
Method[] methods = (baseType.isInterface() ? baseType.getMethods() : baseType.getDeclaredMethods());
|
||||
Method[] methods = (ifcCheck ? baseType.getMethods() : baseType.getDeclaredMethods());
|
||||
for (Method baseMethod : methods) {
|
||||
try {
|
||||
if (hasSearchableAnnotations(baseMethod)) {
|
||||
// Public methods on interfaces (including interface hierarchy),
|
||||
// non-private (and therefore overridable) methods on base classes
|
||||
if ((ifcCheck || !Modifier.isPrivate(baseMethod.getModifiers())) &&
|
||||
hasSearchableAnnotations(baseMethod)) {
|
||||
if (annotatedMethods == null) {
|
||||
annotatedMethods = new HashSet<>();
|
||||
}
|
||||
|
|
|
@ -711,7 +711,7 @@ public class AnnotationUtilsTests {
|
|||
public void getAttributeOverrideNameFromWrongTargetAnnotation() throws Exception {
|
||||
Method attribute = AliasedComposedContextConfig.class.getDeclaredMethod("xmlConfigFile");
|
||||
assertThat("xmlConfigFile is not an alias for @Component.",
|
||||
getAttributeOverrideName(attribute, Component.class), is(nullValue()));
|
||||
getAttributeOverrideName(attribute, Component.class), is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -905,7 +905,6 @@ public class AnnotationUtilsTests {
|
|||
public void synthesizeAnnotationWithAttributeAliasWithMirroredAliasForWrongAttribute() throws Exception {
|
||||
AliasForWithMirroredAliasForWrongAttribute annotation =
|
||||
AliasForWithMirroredAliasForWrongAttributeClass.class.getAnnotation(AliasForWithMirroredAliasForWrongAttribute.class);
|
||||
|
||||
exception.expect(AnnotationConfigurationException.class);
|
||||
exception.expectMessage(startsWith("Attribute 'bar' in"));
|
||||
exception.expectMessage(containsString(AliasForWithMirroredAliasForWrongAttribute.class.getName()));
|
||||
|
@ -1013,18 +1012,18 @@ public class AnnotationUtilsTests {
|
|||
@Test
|
||||
public void synthesizeAnnotationWithImplicitAliasesWithImpliedAliasNamesOmitted() throws Exception {
|
||||
assertAnnotationSynthesisWithImplicitAliasesWithImpliedAliasNamesOmitted(
|
||||
ValueImplicitAliasesWithImpliedAliasNamesOmittedContextConfigClass.class, "value");
|
||||
ValueImplicitAliasesWithImpliedAliasNamesOmittedContextConfigClass.class, "value");
|
||||
assertAnnotationSynthesisWithImplicitAliasesWithImpliedAliasNamesOmitted(
|
||||
LocationsImplicitAliasesWithImpliedAliasNamesOmittedContextConfigClass.class, "location");
|
||||
LocationsImplicitAliasesWithImpliedAliasNamesOmittedContextConfigClass.class, "location");
|
||||
assertAnnotationSynthesisWithImplicitAliasesWithImpliedAliasNamesOmitted(
|
||||
XmlFilesImplicitAliasesWithImpliedAliasNamesOmittedContextConfigClass.class, "xmlFile");
|
||||
XmlFilesImplicitAliasesWithImpliedAliasNamesOmittedContextConfigClass.class, "xmlFile");
|
||||
}
|
||||
|
||||
private void assertAnnotationSynthesisWithImplicitAliasesWithImpliedAliasNamesOmitted(Class<?> clazz,
|
||||
String expected) throws Exception {
|
||||
private void assertAnnotationSynthesisWithImplicitAliasesWithImpliedAliasNamesOmitted(
|
||||
Class<?> clazz, String expected) {
|
||||
|
||||
ImplicitAliasesWithImpliedAliasNamesOmittedContextConfig config = clazz.getAnnotation(
|
||||
ImplicitAliasesWithImpliedAliasNamesOmittedContextConfig.class);
|
||||
ImplicitAliasesWithImpliedAliasNamesOmittedContextConfig.class);
|
||||
assertNotNull(config);
|
||||
|
||||
ImplicitAliasesWithImpliedAliasNamesOmittedContextConfig synthesizedConfig = synthesizeAnnotation(config);
|
||||
|
@ -1222,7 +1221,6 @@ public class AnnotationUtilsTests {
|
|||
@Test
|
||||
public void synthesizeAnnotationWithAttributeAliasesWithDifferentValues() throws Exception {
|
||||
ContextConfig contextConfig = synthesizeAnnotation(ContextConfigMismatch.class.getAnnotation(ContextConfig.class));
|
||||
|
||||
exception.expect(AnnotationConfigurationException.class);
|
||||
getValue(contextConfig);
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ public final class MockMvc {
|
|||
Assert.notNull(servlet, "DispatcherServlet is required");
|
||||
Assert.notNull(filters, "Filters cannot be null");
|
||||
Assert.noNullElements(filters, "Filters cannot contain null values");
|
||||
|
||||
this.servlet = servlet;
|
||||
this.filters = filters;
|
||||
this.servletContext = servlet.getServletContext();
|
||||
|
@ -201,7 +202,6 @@ public final class MockMvc {
|
|||
for (ResultMatcher matcher : this.defaultResultMatchers) {
|
||||
matcher.match(mvcResult);
|
||||
}
|
||||
|
||||
for (ResultHandler handler : this.defaultResultHandlers) {
|
||||
handler.handle(mvcResult);
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ public class UrlPathHelper {
|
|||
}
|
||||
c1 = requestUri.charAt(index1);
|
||||
}
|
||||
if (c1 == c2 || ignoreCase && (Character.toLowerCase(c1) == Character.toLowerCase(c2))) {
|
||||
if (c1 == c2 || (ignoreCase && (Character.toLowerCase(c1) == Character.toLowerCase(c2)))) {
|
||||
continue;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -63,7 +63,7 @@ import org.springframework.web.servlet.View;
|
|||
public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
||||
implements Ordered, InitializingBean, DisposableBean {
|
||||
|
||||
/** The default basename if no other basename is supplied. */
|
||||
/** The default basename if no other basename is supplied */
|
||||
public static final String DEFAULT_BASENAME = "views";
|
||||
|
||||
|
||||
|
@ -77,14 +77,14 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
|||
@Nullable
|
||||
private Locale[] localesToInitialize;
|
||||
|
||||
private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered
|
||||
|
||||
/* Locale -> BeanFactory */
|
||||
private final Map<Locale, BeanFactory> localeCache = new HashMap<>();
|
||||
|
||||
/* List of ResourceBundle -> BeanFactory */
|
||||
private final Map<List<ResourceBundle>, ConfigurableApplicationContext> bundleCache = new HashMap<>();
|
||||
|
||||
private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered
|
||||
|
||||
|
||||
/**
|
||||
* Set a single basename, following {@link java.util.ResourceBundle} conventions.
|
||||
|
@ -97,7 +97,8 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
|||
* This means that "test.theme" is effectively equivalent to "test/theme",
|
||||
* just like it is for programmatic {@code java.util.ResourceBundle} usage.
|
||||
* @see #setBasenames
|
||||
* @see java.util.ResourceBundle#getBundle(String)
|
||||
* @see ResourceBundle#getBundle(String)
|
||||
* @see ResourceBundle#getBundle(String, Locale)
|
||||
*/
|
||||
public void setBasename(String basename) {
|
||||
setBasenames(basename);
|
||||
|
@ -118,7 +119,7 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
|||
* This means that "test.theme" is effectively equivalent to "test/theme",
|
||||
* just like it is for programmatic {@code java.util.ResourceBundle} usage.
|
||||
* @see #setBasename
|
||||
* @see java.util.ResourceBundle#getBundle(String)
|
||||
* @see ResourceBundle#getBundle(String)
|
||||
*/
|
||||
public void setBasenames(String... basenames) {
|
||||
this.basenames = basenames;
|
||||
|
@ -271,7 +272,7 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
|||
* @param locale the {@code Locale} to look for
|
||||
* @return the corresponding {@code ResourceBundle}
|
||||
* @throws MissingResourceException if no matching bundle could be found
|
||||
* @see java.util.ResourceBundle#getBundle(String, java.util.Locale, ClassLoader)
|
||||
* @see ResourceBundle#getBundle(String, Locale, ClassLoader)
|
||||
*/
|
||||
protected ResourceBundle getBundle(String basename, Locale locale) throws MissingResourceException {
|
||||
return ResourceBundle.getBundle(basename, locale, getBundleClassLoader());
|
||||
|
|
Loading…
Reference in New Issue