Skip to content

Commit d879bad

Browse files
committed
Polishing
(cherry picked from commit 7ed7f98)
1 parent ff76be2 commit d879bad

File tree

10 files changed

+119
-121
lines changed

10 files changed

+119
-121
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -219,8 +219,7 @@ protected void processProperties(ConfigurableListableBeanFactory beanFactoryToPr
219219
throws BeansException {
220220

221221
StringValueResolver valueResolver = new PlaceholderResolvingStringValueResolver(props);
222-
223-
this.doProcessProperties(beanFactoryToProcess, valueResolver);
222+
doProcessProperties(beanFactoryToProcess, valueResolver);
224223
}
225224

226225
/**

spring-context/src/main/java/org/springframework/context/annotation/Role.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2011 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,16 +28,16 @@
2828
* Indicates the 'role' hint for a given bean.
2929
*
3030
* <p>May be used on any class directly or indirectly annotated with
31-
* {@link org.springframework.stereotype.Component} or on methods annotated with
32-
* {@link Bean}.
31+
* {@link org.springframework.stereotype.Component} or on methods
32+
* annotated with {@link Bean}.
3333
*
34-
* <p>If this annotation is not present on a Component or Bean definition, the
35-
* default value of {@link BeanDefinition#ROLE_APPLICATION} will apply.
34+
* <p>If this annotation is not present on a Component or Bean definition,
35+
* the default value of {@link BeanDefinition#ROLE_APPLICATION} will apply.
3636
*
37-
* <p>If Role is present on a {@link Configuration @Configuration} class, this
38-
* indicates the role of the configuration class bean definition and does not
39-
* cascade to all @{@code Bean} methods defined within. This behavior is
40-
* different than that of the @{@link Lazy} annotation, for example.
37+
* <p>If Role is present on a {@link Configuration @Configuration} class,
38+
* this indicates the role of the configuration class bean definition and
39+
* does not cascade to all @{@code Bean} methods defined within. This behavior
40+
* is different than that of the @{@link Lazy} annotation, for example.
4141
*
4242
* @author Chris Beams
4343
* @since 3.1

spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class ProxyAsyncConfiguration extends AbstractAsyncConfiguration {
4343
public AsyncAnnotationBeanPostProcessor asyncAdvisor() {
4444
Assert.notNull(this.enableAsync, "@EnableAsync annotation metadata was not injected");
4545
AsyncAnnotationBeanPostProcessor bpp = new AsyncAnnotationBeanPostProcessor();
46-
Class<? extends Annotation> customAsyncAnnotation = enableAsync.getClass("annotation");
46+
Class<? extends Annotation> customAsyncAnnotation = this.enableAsync.getClass("annotation");
4747
if (customAsyncAnnotation != AnnotationUtils.getDefaultValue(EnableAsync.class, "annotation")) {
4848
bpp.setAsyncAnnotationType(customAsyncAnnotation);
4949
}

spring-core/src/main/java/org/springframework/util/CollectionUtils.java

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,8 +42,8 @@
4242
public abstract class CollectionUtils {
4343

4444
/**
45-
* Return {@code true} if the supplied Collection is {@code null}
46-
* or empty. Otherwise, return {@code false}.
45+
* Return {@code true} if the supplied Collection is {@code null} or empty.
46+
* Otherwise, return {@code false}.
4747
* @param collection the Collection to check
4848
* @return whether the given Collection is empty
4949
*/
@@ -52,8 +52,8 @@ public static boolean isEmpty(Collection collection) {
5252
}
5353

5454
/**
55-
* Return {@code true} if the supplied Map is {@code null}
56-
* or empty. Otherwise, return {@code false}.
55+
* Return {@code true} if the supplied Map is {@code null} or empty.
56+
* Otherwise, return {@code false}.
5757
* @param map the Map to check
5858
* @return whether the given Map is empty
5959
*/
@@ -62,13 +62,16 @@ public static boolean isEmpty(Map map) {
6262
}
6363

6464
/**
65-
* Convert the supplied array into a List. A primitive array gets
66-
* converted into a List of the appropriate wrapper type.
67-
* <p>A {@code null} source value will be converted to an
68-
* empty List.
65+
* Convert the supplied array into a List. A primitive array gets converted
66+
* into a List of the appropriate wrapper type.
67+
* <p><b>NOTE:</b> Generally prefer the standard {@link Arrays#asList} method.
68+
* This {@code arrayToList} method is just meant to deal with an incoming Object
69+
* value that might be an {@code Object[]} or a primitive array at runtime.
70+
* <p>A {@code null} source value will be converted to an empty List.
6971
* @param source the (potentially primitive) array
7072
* @return the converted List result
7173
* @see ObjectUtils#toObjectArray(Object)
74+
* @see Arrays#asList(Object[])
7275
*/
7376
public static List arrayToList(Object source) {
7477
return Arrays.asList(ObjectUtils.toObjectArray(source));
@@ -312,7 +315,7 @@ else if (candidate != val.getClass()) {
312315
* Enumeration elements must be assignable to the type of the given array. The array
313316
* returned will be a different instance than the array given.
314317
*/
315-
public static <A,E extends A> A[] toArray(Enumeration<E> enumeration, A[] array) {
318+
public static <A, E extends A> A[] toArray(Enumeration<E> enumeration, A[] array) {
316319
ArrayList<A> elements = new ArrayList<A>();
317320
while (enumeration.hasMoreElements()) {
318321
elements.add(enumeration.nextElement());
@@ -330,23 +333,23 @@ public static <E> Iterator<E> toIterator(Enumeration<E> enumeration) {
330333
}
331334

332335
/**
333-
* Adapts a {@code Map<K, List<V>>} to an {@code MultiValueMap<K,V>}.
334-
*
335-
* @param map the map
336+
* Adapt a {@code Map<K, List<V>>} to an {@code MultiValueMap<K, V>}.
337+
* @param map the original map
336338
* @return the multi-value map
339+
* @since 3.1
337340
*/
338341
public static <K, V> MultiValueMap<K, V> toMultiValueMap(Map<K, List<V>> map) {
339342
return new MultiValueMapAdapter<K, V>(map);
340343

341344
}
342345

343346
/**
344-
* Returns an unmodifiable view of the specified multi-value map.
345-
*
347+
* Return an unmodifiable view of the specified multi-value map.
346348
* @param map the map for which an unmodifiable view is to be returned.
347349
* @return an unmodifiable view of the specified multi-value map.
350+
* @since 3.1
348351
*/
349-
public static <K,V> MultiValueMap<K,V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
352+
public static <K, V> MultiValueMap<K, V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
350353
Assert.notNull(map, "'map' must not be null");
351354
Map<K, List<V>> result = new LinkedHashMap<K, List<V>>(map.size());
352355
for (Map.Entry<? extends K, ? extends List<? extends V>> entry : map.entrySet()) {
@@ -358,13 +361,12 @@ public static <K,V> MultiValueMap<K,V> unmodifiableMultiValueMap(MultiValueMap<?
358361
}
359362

360363

361-
362364
/**
363365
* Iterator wrapping an Enumeration.
364366
*/
365367
private static class EnumerationIterator<E> implements Iterator<E> {
366368

367-
private Enumeration<E> enumeration;
369+
private final Enumeration<E> enumeration;
368370

369371
public EnumerationIterator(Enumeration<E> enumeration) {
370372
this.enumeration = enumeration;
@@ -458,8 +460,8 @@ public List<V> remove(Object key) {
458460
return this.map.remove(key);
459461
}
460462

461-
public void putAll(Map<? extends K, ? extends List<V>> m) {
462-
this.map.putAll(m);
463+
public void putAll(Map<? extends K, ? extends List<V>> map) {
464+
this.map.putAll(map);
463465
}
464466

465467
public void clear() {

spring-core/src/test/java/org/springframework/tests/TestGroup.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@
3434
*/
3535
public enum TestGroup {
3636

37-
3837
/**
3938
* Tests that take a considerable amount of time to run. Any test lasting longer than
4039
* 500ms should be considered a candidate in order to avoid making the overall test
@@ -68,6 +67,7 @@ public enum TestGroup {
6867
*/
6968
CUSTOM_COMPILATION;
7069

70+
7171
/**
7272
* Parse the specified comma separates string of groups.
7373
* @param value the comma separated string of groups
@@ -93,4 +93,5 @@ public static Set<TestGroup> parse(String value) {
9393
}
9494
return groups;
9595
}
96+
9697
}

0 commit comments

Comments
 (0)