Skip to content

Commit f8c690c

Browse files
committed
Java 5 code style
1 parent fda7100 commit f8c690c

File tree

55 files changed

+355
-444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+355
-444
lines changed

org.springframework.aop/src/main/java/org/springframework/aop/aspectj/AspectJPointcutAdvisor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2008 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.
@@ -52,7 +52,7 @@ public AspectJPointcutAdvisor(AbstractAspectJAdvice advice) {
5252
}
5353

5454
public void setOrder(int order) {
55-
this.order = new Integer(order);
55+
this.order = order;
5656
}
5757

5858

@@ -70,7 +70,7 @@ public Pointcut getPointcut() {
7070

7171
public int getOrder() {
7272
if (this.order != null) {
73-
return this.order.intValue();
73+
return this.order;
7474
}
7575
else {
7676
return this.advice.getOrder();

org.springframework.aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
159159
try {
160160
if (!this.equalsDefined && AopUtils.isEqualsMethod(method)) {
161161
// The target does not implement the equals(Object) method itself.
162-
return (equals(args[0]) ? Boolean.TRUE : Boolean.FALSE);
162+
return equals(args[0]);
163163
}
164164
if (!this.hashCodeDefined && AopUtils.isHashCodeMethod(method)) {
165165
// The target does not implement the hashCode() method itself.
166-
return new Integer(hashCode());
166+
return hashCode();
167167
}
168168
if (!this.advised.opaque && method.getDeclaringClass().isInterface() &&
169169
method.getDeclaringClass().isAssignableFrom(Advised.class)) {

org.springframework.beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,11 @@ private class ServiceLocatorInvocationHandler implements InvocationHandler {
345345
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
346346
if (ReflectionUtils.isEqualsMethod(method)) {
347347
// Only consider equal when proxies are identical.
348-
return (proxy == args[0] ? Boolean.TRUE : Boolean.FALSE);
348+
return (proxy == args[0]);
349349
}
350350
else if (ReflectionUtils.isHashCodeMethod(method)) {
351351
// Use hashCode of service locator proxy.
352-
return new Integer(System.identityHashCode(proxy));
352+
return System.identityHashCode(proxy);
353353
}
354354
else if (ReflectionUtils.isToStringMethod(method)) {
355355
return "Service locator: " + serviceLocatorInterface.getName();

org.springframework.context/src/main/java/org/springframework/jmx/export/MBeanExporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public void setAutodetect(boolean autodetect) {
227227
* @see #AUTODETECT_NONE
228228
*/
229229
public void setAutodetectMode(int autodetectMode) {
230-
if (!constants.getValues(CONSTANT_PREFIX_AUTODETECT).contains(new Integer(autodetectMode))) {
230+
if (!constants.getValues(CONSTANT_PREFIX_AUTODETECT).contains(autodetectMode)) {
231231
throw new IllegalArgumentException("Only values of autodetect constants allowed");
232232
}
233233
this.autodetectMode = autodetectMode;

org.springframework.context/src/main/java/org/springframework/jmx/export/assembler/AbstractReflectiveMBeanInfoAssembler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
9898
* accessors or mutators for attributes.
9999
* @see #FIELD_VISIBILITY
100100
*/
101-
protected static final Integer ATTRIBUTE_OPERATION_VISIBILITY = new Integer(4);
101+
protected static final int ATTRIBUTE_OPERATION_VISIBILITY = 4;
102102

103103
/**
104104
* Constant identifier for the class field in a JMX {@link Descriptor}.

org.springframework.context/src/main/java/org/springframework/scripting/bsh/BshScriptUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ public BshObjectInvocationHandler(XThis xt) {
175175

176176
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
177177
if (ReflectionUtils.isEqualsMethod(method)) {
178-
return (isProxyForSameBshObject(args[0]) ? Boolean.TRUE : Boolean.FALSE);
178+
return (isProxyForSameBshObject(args[0]));
179179
}
180180
else if (ReflectionUtils.isHashCodeMethod(method)) {
181-
return new Integer(this.xt.hashCode());
181+
return this.xt.hashCode();
182182
}
183183
else if (ReflectionUtils.isToStringMethod(method)) {
184184
return "BeanShell object [" + this.xt + "]";

org.springframework.context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public RubyObjectInvocationHandler(IRubyObject rubyObject, Ruby ruby) {
162162

163163
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
164164
if (ReflectionUtils.isEqualsMethod(method)) {
165-
return (isProxyForSameRubyObject(args[0]) ? Boolean.TRUE : Boolean.FALSE);
165+
return (isProxyForSameRubyObject(args[0]));
166166
}
167167
else if (ReflectionUtils.isHashCodeMethod(method)) {
168168
return this.rubyObject.hashCode();

org.springframework.core/src/main/java/org/springframework/core/style/ToStringCreator.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2008 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.
@@ -106,33 +106,33 @@ public ToStringCreator append(String fieldName, int value) {
106106
}
107107

108108
/**
109-
* Append a float field value.
109+
* Append a long field value.
110110
* @param fieldName the name of the field, usually the member variable name
111111
* @param value the field value
112112
* @return this, to support call-chaining
113113
*/
114-
public ToStringCreator append(String fieldName, float value) {
115-
return append(fieldName, new Float(value));
114+
public ToStringCreator append(String fieldName, long value) {
115+
return append(fieldName, new Long(value));
116116
}
117117

118118
/**
119-
* Append a double field value.
119+
* Append a float field value.
120120
* @param fieldName the name of the field, usually the member variable name
121121
* @param value the field value
122122
* @return this, to support call-chaining
123123
*/
124-
public ToStringCreator append(String fieldName, double value) {
125-
return append(fieldName, new Double(value));
124+
public ToStringCreator append(String fieldName, float value) {
125+
return append(fieldName, new Float(value));
126126
}
127127

128128
/**
129-
* Append a long field value.
129+
* Append a double field value.
130130
* @param fieldName the name of the field, usually the member variable name
131131
* @param value the field value
132132
* @return this, to support call-chaining
133133
*/
134-
public ToStringCreator append(String fieldName, long value) {
135-
return append(fieldName, new Long(value));
134+
public ToStringCreator append(String fieldName, double value) {
135+
return append(fieldName, new Double(value));
136136
}
137137

138138
/**
@@ -142,7 +142,7 @@ public ToStringCreator append(String fieldName, long value) {
142142
* @return this, to support call-chaining
143143
*/
144144
public ToStringCreator append(String fieldName, boolean value) {
145-
return append(fieldName, value ? Boolean.TRUE : Boolean.FALSE);
145+
return append(fieldName, Boolean.valueOf(value));
146146
}
147147

148148
/**

org.springframework.core/src/main/java/org/springframework/util/NumberUtils.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,24 @@ else if (targetClass.equals(Byte.class)) {
6363
if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {
6464
raiseOverflowException(number, targetClass);
6565
}
66-
return new Byte(number.byteValue());
66+
return number.byteValue();
6767
}
6868
else if (targetClass.equals(Short.class)) {
6969
long value = number.longValue();
7070
if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {
7171
raiseOverflowException(number, targetClass);
7272
}
73-
return new Short(number.shortValue());
73+
return number.shortValue();
7474
}
7575
else if (targetClass.equals(Integer.class)) {
7676
long value = number.longValue();
7777
if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {
7878
raiseOverflowException(number, targetClass);
7979
}
80-
return new Integer(number.intValue());
80+
return number.intValue();
8181
}
8282
else if (targetClass.equals(Long.class)) {
83-
return new Long(number.longValue());
83+
return number.longValue();
8484
}
8585
else if (targetClass.equals(BigInteger.class)) {
8686
if (number instanceof BigDecimal) {
@@ -93,10 +93,10 @@ else if (targetClass.equals(BigInteger.class)) {
9393
}
9494
}
9595
else if (targetClass.equals(Float.class)) {
96-
return new Float(number.floatValue());
96+
return number.floatValue();
9797
}
9898
else if (targetClass.equals(Double.class)) {
99-
return new Double(number.doubleValue());
99+
return number.doubleValue();
100100
}
101101
else if (targetClass.equals(BigDecimal.class)) {
102102
// always use BigDecimal(String) here to avoid unpredictability of BigDecimal(double)

org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
12721272
}
12731273
else if (method.getName().equals("equals")) {
12741274
// Only consider equal when proxies are identical.
1275-
return (proxy == args[0] ? Boolean.TRUE : Boolean.FALSE);
1275+
return (proxy == args[0]);
12761276
}
12771277
else if (method.getName().equals("hashCode")) {
12781278
// Use hashCode of PersistenceManager proxy.

0 commit comments

Comments
 (0)