Skip to content

Commit 0e3f23e

Browse files
committed
Polishing
1 parent e306d3e commit 0e3f23e

File tree

8 files changed

+47
-42
lines changed

8 files changed

+47
-42
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, final
252252
}
253253
catch (NoSuchBeanDefinitionException ex) {
254254
throw new BeanCreationException(beanName,
255-
"Cannot apply @Lookup to beans without corresponding bean definition");
255+
"Cannot apply @Lookup to beans without corresponding bean definition");
256256
}
257257
}
258258
});

spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ public ConstructorResolver(AbstractAutowireCapableBeanFactory beanFactory) {
107107
* or {@code null} if none (-> use constructor argument values from bean definition)
108108
* @return a BeanWrapper for the new instance
109109
*/
110-
public BeanWrapper autowireConstructor(final String beanName, final RootBeanDefinition mbd,
111-
@Nullable Constructor<?>[] chosenCtors, @Nullable final Object[] explicitArgs) {
110+
public BeanWrapper autowireConstructor(String beanName, RootBeanDefinition mbd,
111+
@Nullable Constructor<?>[] chosenCtors, @Nullable Object[] explicitArgs) {
112112

113113
BeanWrapperImpl bw = new BeanWrapperImpl();
114114
this.beanFactory.initBeanWrapper(bw);
@@ -326,7 +326,7 @@ else if (!Arrays.equals(uniqueCandidate.getParameterTypes(), candidate.getParame
326326
* the {@link RootBeanDefinition#isNonPublicAccessAllowed()} flag.
327327
* Called as the starting point for factory method determination.
328328
*/
329-
private Method[] getCandidateMethods(final Class<?> factoryClass, final RootBeanDefinition mbd) {
329+
private Method[] getCandidateMethods(Class<?> factoryClass, RootBeanDefinition mbd) {
330330
if (System.getSecurityManager() != null) {
331331
return AccessController.doPrivileged((PrivilegedAction<Method[]>) () ->
332332
(mbd.isNonPublicAccessAllowed() ?
@@ -354,7 +354,7 @@ private Method[] getCandidateMethods(final Class<?> factoryClass, final RootBean
354354
* @return a BeanWrapper for the new instance
355355
*/
356356
public BeanWrapper instantiateUsingFactoryMethod(
357-
final String beanName, final RootBeanDefinition mbd, @Nullable final Object[] explicitArgs) {
357+
String beanName, RootBeanDefinition mbd, @Nullable Object[] explicitArgs) {
358358

359359
BeanWrapperImpl bw = new BeanWrapperImpl();
360360
this.beanFactory.initBeanWrapper(bw);
@@ -417,13 +417,13 @@ public BeanWrapper instantiateUsingFactoryMethod(
417417
factoryClass = ClassUtils.getUserClass(factoryClass);
418418

419419
Method[] rawCandidates = getCandidateMethods(factoryClass, mbd);
420-
List<Method> candidateSet = new ArrayList<>();
420+
List<Method> candidateList = new ArrayList<>();
421421
for (Method candidate : rawCandidates) {
422422
if (Modifier.isStatic(candidate.getModifiers()) == isStatic && mbd.isFactoryMethod(candidate)) {
423-
candidateSet.add(candidate);
423+
candidateList.add(candidate);
424424
}
425425
}
426-
Method[] candidates = candidateSet.toArray(new Method[0]);
426+
Method[] candidates = candidateList.toArray(new Method[0]);
427427
AutowireUtils.sortFactoryMethods(candidates);
428428

429429
ConstructorArgumentValues resolvedValues = null;
@@ -456,7 +456,7 @@ public BeanWrapper instantiateUsingFactoryMethod(
456456
if (paramTypes.length >= minNrOfArgs) {
457457
ArgumentsHolder argsHolder;
458458

459-
if (explicitArgs != null){
459+
if (explicitArgs != null) {
460460
// Explicit arguments given -> arguments length must match exactly.
461461
if (paramTypes.length != explicitArgs.length) {
462462
continue;
@@ -529,7 +529,7 @@ else if (factoryMethodToUse != null && typeDiffWeight == minTypeDiffWeight &&
529529
argTypes.add(arg != null ? arg.getClass().getSimpleName() : "null");
530530
}
531531
}
532-
else if (resolvedValues != null){
532+
else if (resolvedValues != null) {
533533
Set<ValueHolder> valueHolders = new LinkedHashSet<>(resolvedValues.getArgumentCount());
534534
valueHolders.addAll(resolvedValues.getIndexedArgumentValues().values());
535535
valueHolders.addAll(resolvedValues.getGenericArgumentValues());

spring-beans/src/main/java/org/springframework/beans/factory/support/InstantiationStrategy.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -38,8 +38,8 @@ public interface InstantiationStrategy {
3838
/**
3939
* Return an instance of the bean with the given name in this factory.
4040
* @param bd the bean definition
41-
* @param beanName the name of the bean when it's created in this context.
42-
* The name can be {@code null} if we're autowiring a bean which doesn't
41+
* @param beanName the name of the bean when it is created in this context.
42+
* The name can be {@code null} if we are autowiring a bean which doesn't
4343
* belong to the factory.
4444
* @param owner the owning BeanFactory
4545
* @return a bean instance for this bean definition
@@ -52,8 +52,8 @@ Object instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory
5252
* Return an instance of the bean with the given name in this factory,
5353
* creating it via the given constructor.
5454
* @param bd the bean definition
55-
* @param beanName the name of the bean when it's created in this context.
56-
* The name can be {@code null} if we're autowiring a bean which doesn't
55+
* @param beanName the name of the bean when it is created in this context.
56+
* The name can be {@code null} if we are autowiring a bean which doesn't
5757
* belong to the factory.
5858
* @param owner the owning BeanFactory
5959
* @param ctor the constructor to use
@@ -68,8 +68,8 @@ Object instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory
6868
* Return an instance of the bean with the given name in this factory,
6969
* creating it via the given factory method.
7070
* @param bd the bean definition
71-
* @param beanName the name of the bean when it's created in this context.
72-
* The name can be {@code null} if we're autowiring a bean which doesn't
71+
* @param beanName the name of the bean when it is created in this context.
72+
* The name can be {@code null} if we are autowiring a bean which doesn't
7373
* belong to the factory.
7474
* @param owner the owning BeanFactory
7575
* @param factoryBean the factory bean instance to call the factory method on,

spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCache.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.cache.jcache;
1818

1919
import java.util.concurrent.Callable;
20+
import javax.cache.Cache;
2021
import javax.cache.processor.EntryProcessor;
2122
import javax.cache.processor.EntryProcessorException;
2223
import javax.cache.processor.MutableEntry;
@@ -37,14 +38,14 @@
3738
*/
3839
public class JCacheCache extends AbstractValueAdaptingCache {
3940

40-
private final javax.cache.Cache<Object, Object> cache;
41+
private final Cache<Object, Object> cache;
4142

4243

4344
/**
4445
* Create an {@link org.springframework.cache.jcache.JCacheCache} instance.
4546
* @param jcache backing JCache Cache instance
4647
*/
47-
public JCacheCache(javax.cache.Cache<Object, Object> jcache) {
48+
public JCacheCache(Cache<Object, Object> jcache) {
4849
this(jcache, true);
4950
}
5051

@@ -53,7 +54,7 @@ public JCacheCache(javax.cache.Cache<Object, Object> jcache) {
5354
* @param jcache backing JCache Cache instance
5455
* @param allowNullValues whether to accept and convert null values for this cache
5556
*/
56-
public JCacheCache(javax.cache.Cache<Object, Object> jcache, boolean allowNullValues) {
57+
public JCacheCache(Cache<Object, Object> jcache, boolean allowNullValues) {
5758
super(allowNullValues);
5859
Assert.notNull(jcache, "Cache must not be null");
5960
this.cache = jcache;
@@ -66,7 +67,7 @@ public final String getName() {
6667
}
6768

6869
@Override
69-
public final javax.cache.Cache<Object, Object> getNativeCache() {
70+
public final Cache<Object, Object> getNativeCache() {
7071
return this.cache;
7172
}
7273

spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCacheManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
public class JCacheCacheManager extends AbstractTransactionSupportingCacheManager {
4040

4141
@Nullable
42-
private javax.cache.CacheManager cacheManager;
42+
private CacheManager cacheManager;
4343

4444
private boolean allowNullValues = true;
4545

@@ -63,15 +63,15 @@ public JCacheCacheManager(CacheManager cacheManager) {
6363
/**
6464
* Set the backing JCache {@link javax.cache.CacheManager}.
6565
*/
66-
public void setCacheManager(@Nullable javax.cache.CacheManager cacheManager) {
66+
public void setCacheManager(@Nullable CacheManager cacheManager) {
6767
this.cacheManager = cacheManager;
6868
}
6969

7070
/**
7171
* Return the backing JCache {@link javax.cache.CacheManager}.
7272
*/
7373
@Nullable
74-
public javax.cache.CacheManager getCacheManager() {
74+
public CacheManager getCacheManager() {
7575
return this.cacheManager;
7676
}
7777

spring-context/src/main/java/org/springframework/cache/annotation/SpringCacheAnnotationParser.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -62,7 +62,7 @@ public Collection<CacheOperation> parseCacheAnnotations(Method method) {
6262
}
6363

6464
@Nullable
65-
protected Collection<CacheOperation> parseCacheAnnotations(DefaultCacheConfig cachingConfig, AnnotatedElement ae) {
65+
private Collection<CacheOperation> parseCacheAnnotations(DefaultCacheConfig cachingConfig, AnnotatedElement ae) {
6666
Collection<CacheOperation> ops = parseCacheAnnotations(cachingConfig, ae, false);
6767
if (ops != null && ops.size() > 1 && ae.getAnnotations().length > 0) {
6868
// More than one operation found -> local declarations override interface-declared ones...
@@ -88,6 +88,7 @@ private Collection<CacheOperation> parseCacheAnnotations(
8888
ops.add(parseCacheableAnnotation(ae, cachingConfig, cacheable));
8989
}
9090
}
91+
9192
Collection<CacheEvict> evicts = (localOnly ? AnnotatedElementUtils.getAllMergedAnnotations(ae, CacheEvict.class) :
9293
AnnotatedElementUtils.findAllMergedAnnotations(ae, CacheEvict.class));
9394
if (!evicts.isEmpty()) {
@@ -96,6 +97,7 @@ private Collection<CacheOperation> parseCacheAnnotations(
9697
ops.add(parseEvictAnnotation(ae, cachingConfig, evict));
9798
}
9899
}
100+
99101
Collection<CachePut> puts = (localOnly ? AnnotatedElementUtils.getAllMergedAnnotations(ae, CachePut.class) :
100102
AnnotatedElementUtils.findAllMergedAnnotations(ae, CachePut.class));
101103
if (!puts.isEmpty()) {
@@ -104,6 +106,7 @@ private Collection<CacheOperation> parseCacheAnnotations(
104106
ops.add(parsePutAnnotation(ae, cachingConfig, put));
105107
}
106108
}
109+
107110
Collection<Caching> cachings = (localOnly ? AnnotatedElementUtils.getAllMergedAnnotations(ae, Caching.class) :
108111
AnnotatedElementUtils.findAllMergedAnnotations(ae, Caching.class));
109112
if (!cachings.isEmpty()) {
@@ -313,7 +316,6 @@ else if (StringUtils.hasText(this.cacheManager)) {
313316
builder.setCacheManager(this.cacheManager);
314317
}
315318
}
316-
317319
}
318320

319321
}

spring-core/src/main/java/org/springframework/util/xml/StaxStreamXMLReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ private void handleComment() throws SAXException {
243243

244244
private void handleDtd() throws SAXException {
245245
if (getLexicalHandler() != null) {
246-
javax.xml.stream.Location location = this.reader.getLocation();
246+
Location location = this.reader.getLocation();
247247
getLexicalHandler().startDTD(null, location.getPublicId(), location.getSystemId());
248248
}
249249
if (getLexicalHandler() != null) {

spring-web/src/main/java/org/springframework/http/codec/xml/XmlEventDecoder.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,19 @@
4747
import org.springframework.util.xml.StaxUtils;
4848

4949
/**
50-
* Decodes a {@link DataBuffer} stream into a stream of {@link XMLEvent}s.
51-
* That is, given the following XML:
50+
* Decodes a {@link DataBuffer} stream into a stream of {@link XMLEvent XMLEvents}.
5251
*
53-
* <pre>{@code
54-
* <root>
55-
* <child>foo</child>
56-
* <child>bar</child>
57-
* </root>}
52+
* <p>Given the following XML:
53+
*
54+
* <pre class="code">
55+
* &lt;root>
56+
* &lt;child&gt;foo&lt;/child&gt;
57+
* &lt;child&gt;bar&lt;/child&gt;
58+
* &lt;/root&gt;
5859
* </pre>
5960
*
60-
* this method with result in a flux with the following events:
61+
* this decoder will produce a {@link Flux} with the following events:
62+
*
6163
* <ol>
6264
* <li>{@link javax.xml.stream.events.StartDocument}</li>
6365
* <li>{@link javax.xml.stream.events.StartElement} {@code root}</li>
@@ -70,8 +72,8 @@
7072
* <li>{@link javax.xml.stream.events.EndElement} {@code root}</li>
7173
* </ol>
7274
*
73-
* Note that this decoder is not registered by default but used internally
74-
* by other decoders who are there by default.
75+
* <p>Note that this decoder is not registered by default but is used internally
76+
* by other decoders which are registered by default.
7577
*
7678
* @author Arjen Poutsma
7779
* @since 5.0
@@ -97,7 +99,7 @@ public Flux<XMLEvent> decode(Publisher<DataBuffer> inputStream, ResolvableType e
9799
@Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
98100

99101
Flux<DataBuffer> flux = Flux.from(inputStream);
100-
if (useAalto) {
102+
if (this.useAalto) {
101103
AaltoDataBufferToXmlEvent aaltoMapper = new AaltoDataBufferToXmlEvent();
102104
return flux.flatMap(aaltoMapper)
103105
.doFinally(signalType -> aaltoMapper.endOfInput());
@@ -135,15 +137,15 @@ private static class AaltoDataBufferToXmlEvent implements Function<DataBuffer, P
135137
@Override
136138
public Publisher<? extends XMLEvent> apply(DataBuffer dataBuffer) {
137139
try {
138-
streamReader.getInputFeeder().feedInput(dataBuffer.asByteBuffer());
140+
this.streamReader.getInputFeeder().feedInput(dataBuffer.asByteBuffer());
139141
List<XMLEvent> events = new ArrayList<>();
140142
while (true) {
141-
if (streamReader.next() == AsyncXMLStreamReader.EVENT_INCOMPLETE) {
143+
if (this.streamReader.next() == AsyncXMLStreamReader.EVENT_INCOMPLETE) {
142144
// no more events with what currently has been fed to the reader
143145
break;
144146
}
145147
else {
146-
XMLEvent event = eventAllocator.allocate(streamReader);
148+
XMLEvent event = this.eventAllocator.allocate(this.streamReader);
147149
events.add(event);
148150
if (event.isEndDocument()) {
149151
break;

0 commit comments

Comments
 (0)