Skip to content

Commit 62a6c37

Browse files
committed
Polishing
(cherry picked from commit e9d24d5)
1 parent e353af6 commit 62a6c37

File tree

10 files changed

+67
-65
lines changed

10 files changed

+67
-65
lines changed

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

Lines changed: 2 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-2014 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.
@@ -139,7 +139,7 @@ protected String buildDefaultBeanName(BeanDefinition definition, BeanDefinitionR
139139
* <p>The default implementation simply builds a decapitalized version
140140
* of the short class name: e.g. "mypackage.MyJdbcDao" -> "myJdbcDao".
141141
* <p>Note that inner classes will thus have names of the form
142-
* "outerClassName.innerClassName", which because of the period in the
142+
* "outerClassName.InnerClassName", which because of the period in the
143143
* name may be an issue if you are autowiring by name.
144144
* @param definition the bean definition to build a bean name for
145145
* @return the default bean name (never {@code null})

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,8 @@ public BeanMethodInterceptor(ConfigurableBeanFactory beanFactory) {
240240
/**
241241
* Enhance a {@link Bean @Bean} method to check the supplied BeanFactory for the
242242
* existence of this bean object.
243-
* @throws Throwable as a catch-all for any exception that may be thrown when
244-
* invoking the super implementation of the proxied method i.e., the actual
245-
* {@code @Bean} method.
243+
* @throws Throwable as a catch-all for any exception that may be thrown when invoking the
244+
* super implementation of the proxied method i.e., the actual {@code @Bean} method
246245
*/
247246
public Object intercept(Object enhancedConfigInstance, Method beanMethod, Object[] beanMethodArgs,
248247
MethodProxy cglibMethodProxy) throws Throwable {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ private Collection<ApplicationListener> retrieveApplicationListeners(
227227
* for the given event type
228228
*/
229229
protected boolean supportsEvent(
230-
ApplicationListener listener, Class<? extends ApplicationEvent> eventType, Class sourceType) {
230+
ApplicationListener listener, Class<? extends ApplicationEvent> eventType, Class<?> sourceType) {
231231

232232
SmartApplicationListener smartListener = (listener instanceof SmartApplicationListener ?
233233
(SmartApplicationListener) listener : new GenericApplicationListenerAdapter(listener));

spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java

Lines changed: 17 additions & 16 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-2014 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.
@@ -107,7 +107,7 @@ public class MBeanClientInterceptor
107107

108108
private boolean useStrictCasing = true;
109109

110-
private Class managementInterface;
110+
private Class<?> managementInterface;
111111

112112
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
113113

@@ -215,15 +215,15 @@ public void setUseStrictCasing(boolean useStrictCasing) {
215215
* setters and getters for MBean attributes and conventional Java methods
216216
* for MBean operations.
217217
*/
218-
public void setManagementInterface(Class managementInterface) {
218+
public void setManagementInterface(Class<?> managementInterface) {
219219
this.managementInterface = managementInterface;
220220
}
221221

222222
/**
223223
* Return the management interface of the target MBean,
224224
* or {@code null} if none specified.
225225
*/
226-
protected final Class getManagementInterface() {
226+
protected final Class<?> getManagementInterface() {
227227
return this.managementInterface;
228228
}
229229

@@ -262,7 +262,7 @@ public void prepare() {
262262
this.invocationHandler = null;
263263
if (this.useStrictCasing) {
264264
// Use the JDK's own MBeanServerInvocationHandler,
265-
// in particular for native MXBean support on Java 6.
265+
// in particular for native MXBean support on Java 6+.
266266
if (JmxUtils.isMXBeanSupportAvailable()) {
267267
this.invocationHandler =
268268
new MBeanServerInvocationHandler(this.serverToUse, this.objectName,
@@ -297,7 +297,7 @@ private void retrieveMBeanInfo() throws MBeanInfoRetrievalException {
297297
MBeanOperationInfo[] operationInfo = info.getOperations();
298298
this.allowedOperations = new HashMap<MethodCacheKey, MBeanOperationInfo>(operationInfo.length);
299299
for (MBeanOperationInfo infoEle : operationInfo) {
300-
Class[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
300+
Class<?>[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
301301
this.allowedOperations.put(new MethodCacheKey(infoEle.getName(), paramTypes), infoEle);
302302
}
303303
}
@@ -531,7 +531,7 @@ private Object invokeOperation(Method method, Object[] args) throws JMException,
531531
* is necessary
532532
*/
533533
protected Object convertResultValueIfNecessary(Object result, MethodParameter parameter) {
534-
Class targetClass = parameter.getParameterType();
534+
Class<?> targetClass = parameter.getParameterType();
535535
try {
536536
if (result == null) {
537537
return null;
@@ -549,7 +549,7 @@ else if (result instanceof CompositeData[]) {
549549
return convertDataArrayToTargetArray(array, targetClass);
550550
}
551551
else if (Collection.class.isAssignableFrom(targetClass)) {
552-
Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
552+
Class<?> elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
553553
if (elementType != null) {
554554
return convertDataArrayToTargetCollection(array, targetClass, elementType);
555555
}
@@ -565,7 +565,7 @@ else if (result instanceof TabularData[]) {
565565
return convertDataArrayToTargetArray(array, targetClass);
566566
}
567567
else if (Collection.class.isAssignableFrom(targetClass)) {
568-
Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
568+
Class<?> elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
569569
if (elementType != null) {
570570
return convertDataArrayToTargetCollection(array, targetClass, elementType);
571571
}
@@ -581,8 +581,8 @@ else if (Collection.class.isAssignableFrom(targetClass)) {
581581
}
582582
}
583583

584-
private Object convertDataArrayToTargetArray(Object[] array, Class targetClass) throws NoSuchMethodException {
585-
Class targetType = targetClass.getComponentType();
584+
private Object convertDataArrayToTargetArray(Object[] array, Class<?> targetClass) throws NoSuchMethodException {
585+
Class<?> targetType = targetClass.getComponentType();
586586
Method fromMethod = targetType.getMethod("from", array.getClass().getComponentType());
587587
Object resultArray = Array.newInstance(targetType, array.length);
588588
for (int i = 0; i < array.length; i++) {
@@ -592,11 +592,11 @@ private Object convertDataArrayToTargetArray(Object[] array, Class targetClass)
592592
}
593593

594594
@SuppressWarnings("unchecked")
595-
private Collection convertDataArrayToTargetCollection(Object[] array, Class collectionType, Class elementType)
595+
private Collection<?> convertDataArrayToTargetCollection(Object[] array, Class<?> collectionType, Class<?> elementType)
596596
throws NoSuchMethodException {
597597

598598
Method fromMethod = elementType.getMethod("from", array.getClass().getComponentType());
599-
Collection resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array));
599+
Collection<Object> resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array));
600600
for (int i = 0; i < array.length; i++) {
601601
resultColl.add(ReflectionUtils.invokeMethod(fromMethod, null, array[i]));
602602
}
@@ -608,6 +608,7 @@ public void destroy() {
608608
this.connector.close();
609609
}
610610

611+
611612
/**
612613
* Simple wrapper class around a method name and its signature.
613614
* Used as the key when caching methods.
@@ -616,17 +617,17 @@ private static class MethodCacheKey {
616617

617618
private final String name;
618619

619-
private final Class[] parameterTypes;
620+
private final Class<?>[] parameterTypes;
620621

621622
/**
622623
* Create a new instance of {@code MethodCacheKey} with the supplied
623624
* method name and parameter list.
624625
* @param name the name of the method
625626
* @param parameterTypes the arguments in the method signature
626627
*/
627-
public MethodCacheKey(String name, Class[] parameterTypes) {
628+
public MethodCacheKey(String name, Class<?>[] parameterTypes) {
628629
this.name = name;
629-
this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class[0]);
630+
this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class<?>[0]);
630631
}
631632

632633
@Override

spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public static MBeanServer locateMBeanServer(String agentId) throws MBeanServerNo
145145
* @return the parameter types as classes
146146
* @throws ClassNotFoundException if a parameter type could not be resolved
147147
*/
148-
public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException {
148+
public static Class<?>[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException {
149149
return parameterInfoToTypes(paramInfo, ClassUtils.getDefaultClassLoader());
150150
}
151151

@@ -157,12 +157,12 @@ public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throw
157157
* @return the parameter types as classes
158158
* @throws ClassNotFoundException if a parameter type could not be resolved
159159
*/
160-
public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader)
160+
public static Class<?>[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader)
161161
throws ClassNotFoundException {
162162

163-
Class[] types = null;
163+
Class<?>[] types = null;
164164
if (paramInfo != null && paramInfo.length > 0) {
165-
types = new Class[paramInfo.length];
165+
types = new Class<?>[paramInfo.length];
166166
for (int x = 0; x < paramInfo.length; x++) {
167167
types[x] = ClassUtils.forName(paramInfo[x].getType(), classLoader);
168168
}
@@ -178,7 +178,7 @@ public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, Class
178178
* @return the signature as array of argument types
179179
*/
180180
public static String[] getMethodSignature(Method method) {
181-
Class[] types = method.getParameterTypes();
181+
Class<?>[] types = method.getParameterTypes();
182182
String[] signature = new String[types.length];
183183
for (int x = 0; x < types.length; x++) {
184184
signature[x] = types[x].getName();
@@ -282,7 +282,7 @@ public static Class<?> getMBeanInterface(Class<?> clazz) {
282282
return null;
283283
}
284284
String mbeanInterfaceName = clazz.getName() + MBEAN_SUFFIX;
285-
Class[] implementedInterfaces = clazz.getInterfaces();
285+
Class<?>[] implementedInterfaces = clazz.getInterfaces();
286286
for (Class<?> iface : implementedInterfaces) {
287287
if (iface.getName().equals(mbeanInterfaceName)) {
288288
return iface;
@@ -302,7 +302,7 @@ public static Class<?> getMXBeanInterface(Class<?> clazz) {
302302
if (clazz == null || clazz.getSuperclass() == null) {
303303
return null;
304304
}
305-
Class[] implementedInterfaces = clazz.getInterfaces();
305+
Class<?>[] implementedInterfaces = clazz.getInterfaces();
306306
for (Class<?> iface : implementedInterfaces) {
307307
boolean isMxBean = iface.getName().endsWith(MXBEAN_SUFFIX);
308308
if (mxBeanAnnotationAvailable) {

spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java

Lines changed: 10 additions & 11 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-2014 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.
@@ -143,7 +143,7 @@ static boolean isBridgeMethodFor(Method bridgeMethod, Method candidateMethod, Ma
143143
*/
144144
private static Method findGenericDeclaration(Method bridgeMethod) {
145145
// Search parent types for method that has same signature as bridge.
146-
Class superclass = bridgeMethod.getDeclaringClass().getSuperclass();
146+
Class<?> superclass = bridgeMethod.getDeclaringClass().getSuperclass();
147147
while (superclass != null && !Object.class.equals(superclass)) {
148148
Method method = searchForMatch(superclass, bridgeMethod);
149149
if (method != null && !method.isBridge()) {
@@ -153,8 +153,8 @@ private static Method findGenericDeclaration(Method bridgeMethod) {
153153
}
154154

155155
// Search interfaces.
156-
Class[] interfaces = ClassUtils.getAllInterfacesForClass(bridgeMethod.getDeclaringClass());
157-
for (Class ifc : interfaces) {
156+
Class<?>[] interfaces = ClassUtils.getAllInterfacesForClass(bridgeMethod.getDeclaringClass());
157+
for (Class<?> ifc : interfaces) {
158158
Method method = searchForMatch(ifc, bridgeMethod);
159159
if (method != null && !method.isBridge()) {
160160
return method;
@@ -174,13 +174,13 @@ private static boolean isResolvedTypeMatch(
174174
Method genericMethod, Method candidateMethod, Map<TypeVariable, Type> typeVariableMap) {
175175

176176
Type[] genericParameters = genericMethod.getGenericParameterTypes();
177-
Class[] candidateParameters = candidateMethod.getParameterTypes();
177+
Class<?>[] candidateParameters = candidateMethod.getParameterTypes();
178178
if (genericParameters.length != candidateParameters.length) {
179179
return false;
180180
}
181181
for (int i = 0; i < genericParameters.length; i++) {
182182
Type genericParameter = genericParameters[i];
183-
Class candidateParameter = candidateParameters[i];
183+
Class<?> candidateParameter = candidateParameters[i];
184184
if (candidateParameter.isArray()) {
185185
// An array type: compare the component type.
186186
Type rawType = GenericTypeResolver.getRawType(genericParameter, typeVariableMap);
@@ -193,7 +193,7 @@ private static boolean isResolvedTypeMatch(
193193
}
194194
}
195195
// A non-array type: compare the type itself.
196-
Class resolvedParameter = GenericTypeResolver.resolveType(genericParameter, typeVariableMap);
196+
Class<?> resolvedParameter = GenericTypeResolver.resolveType(genericParameter, typeVariableMap);
197197
if (!candidateParameter.equals(resolvedParameter)) {
198198
return false;
199199
}
@@ -206,7 +206,7 @@ private static boolean isResolvedTypeMatch(
206206
* that of the supplied {@link Method}, then this matching {@link Method} is returned,
207207
* otherwise {@code null} is returned.
208208
*/
209-
private static Method searchForMatch(Class type, Method bridgeMethod) {
209+
private static Method searchForMatch(Class<?> type, Method bridgeMethod) {
210210
return ReflectionUtils.findMethod(type, bridgeMethod.getName(), bridgeMethod.getParameterTypes());
211211
}
212212

@@ -221,9 +221,8 @@ public static boolean isVisibilityBridgeMethodPair(Method bridgeMethod, Method b
221221
if (bridgeMethod == bridgedMethod) {
222222
return true;
223223
}
224-
return Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes()) &&
225-
bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType());
224+
return (Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes()) &&
225+
bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType()));
226226
}
227227

228-
229228
}

spring-web/src/main/java/org/springframework/http/client/ClientHttpRequest.java

Lines changed: 5 additions & 4 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-2014 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.
@@ -23,10 +23,11 @@
2323
import org.springframework.http.HttpRequest;
2424

2525
/**
26-
* Represents a client-side HTTP request. Created via an implementation of the {@link ClientHttpRequestFactory}.
26+
* Represents a client-side HTTP request.
27+
* Created via an implementation of the {@link ClientHttpRequestFactory}.
2728
*
28-
* <p>A {@code HttpRequest} can be {@linkplain #execute() executed}, getting a {@link ClientHttpResponse}
29-
* which can be read from.
29+
* <p>A {@code ClientHttpRequest} can be {@linkplain #execute() executed},
30+
* receiving a {@link ClientHttpResponse} which can be read from.
3031
*
3132
* @author Arjen Poutsma
3233
* @since 3.0

spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java

Lines changed: 6 additions & 5 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-2014 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.
@@ -23,10 +23,11 @@
2323
import org.springframework.http.HttpStatus;
2424

2525
/**
26-
* Represents a client-side HTTP response. Obtained via an calling of the {@link ClientHttpRequest#execute()}.
26+
* Represents a client-side HTTP response.
27+
* Obtained via an calling of the {@link ClientHttpRequest#execute()}.
2728
*
28-
* <p>A {@code ClientHttpResponse} must be {@linkplain #close() closed}, typically in a
29-
* {@code finally} block.
29+
* <p>A {@code ClientHttpResponse} must be {@linkplain #close() closed},
30+
* typically in a {@code finally} block.
3031
*
3132
* @author Arjen Poutsma
3233
* @since 3.0
@@ -55,7 +56,7 @@ public interface ClientHttpResponse extends HttpInputMessage, Closeable {
5556
String getStatusText() throws IOException;
5657

5758
/**
58-
* Closes this response, freeing any resources created.
59+
* Close this response, freeing any resources created.
5960
*/
6061
void close();
6162

spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void setUp() throws Exception {
7373

7474
// final Template expectedTemplate = new Template();
7575
fc = new FreeMarkerConfigurer();
76-
fc.setTemplateLoaderPaths(new String[] { "classpath:/", "file://" + System.getProperty("java.io.tmpdir") });
76+
fc.setTemplateLoaderPaths("classpath:/", "file://" + System.getProperty("java.io.tmpdir"));
7777
fc.afterPropertiesSet();
7878

7979
wac.getDefaultListableBeanFactory().registerSingleton("freeMarkerConfigurer", fc);
@@ -86,6 +86,7 @@ public void setUp() throws Exception {
8686
response = new MockHttpServletResponse();
8787
}
8888

89+
8990
@Test
9091
public void testExposeSpringMacroHelpers() throws Exception {
9192
FreeMarkerView fv = new FreeMarkerView() {
@@ -128,7 +129,8 @@ protected void processTemplate(Template template, SimpleHash model, HttpServletR
128129

129130
try {
130131
fv.render(model, request, response);
131-
} catch (Exception ex) {
132+
}
133+
catch (Exception ex) {
132134
assertTrue(ex instanceof ServletException);
133135
assertTrue(ex.getMessage().contains(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE));
134136
}

0 commit comments

Comments
 (0)