Skip to content

Commit 7387475

Browse files
committed
Polishing
1 parent c52484e commit 7387475

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public void doWith(Method method) throws IllegalArgumentException, IllegalAccess
274274
if (requiredConstructor != null) {
275275
throw new BeanCreationException(beanName,
276276
"Invalid autowire-marked constructor: " + candidate +
277-
". Found another constructor with 'required' Autowired annotation: " +
277+
". Found constructor with 'required' Autowired annotation already: " +
278278
requiredConstructor);
279279
}
280280
if (candidate.getParameterTypes().length == 0) {
@@ -286,7 +286,7 @@ public void doWith(Method method) throws IllegalArgumentException, IllegalAccess
286286
if (!candidates.isEmpty()) {
287287
throw new BeanCreationException(beanName,
288288
"Invalid autowire-marked constructors: " + candidates +
289-
". Found another constructor with 'required' Autowired annotation: " +
289+
". Found constructor with 'required' Autowired annotation: " +
290290
candidate);
291291
}
292292
requiredConstructor = candidate;

spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelCompiler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.expression.spel.standard;
1718

1819
import java.io.File;
@@ -77,7 +78,7 @@ public class SpelCompiler implements Opcodes {
7778
// The child ClassLoader used to load the compiled expression classes
7879
private final ChildClassLoader ccl;
7980

80-
// counter suffix for generated classes within this SpelCompiler instance
81+
// Counter suffix for generated classes within this SpelCompiler instance
8182
private final AtomicInteger suffixId = new AtomicInteger(1);
8283

8384

@@ -131,8 +132,7 @@ private Class<? extends CompiledExpression> createExpressionClass(SpelNodeImpl e
131132
// Create class outline 'spel/ExNNN extends org.springframework.expression.spel.CompiledExpression'
132133
String clazzName = "spel/Ex" + getNextSuffix();
133134
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS|ClassWriter.COMPUTE_FRAMES);
134-
cw.visit(V1_5, ACC_PUBLIC, clazzName, null,
135-
"org/springframework/expression/spel/CompiledExpression", null);
135+
cw.visit(V1_5, ACC_PUBLIC, clazzName, null, "org/springframework/expression/spel/CompiledExpression", null);
136136

137137
// Create default constructor
138138
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
@@ -199,8 +199,8 @@ public static boolean compile(Expression expression) {
199199
}
200200

201201
/**
202-
* Request to revert to the interpreter for expression evaluation. Any compiled form
203-
* is discarded but can be recreated by later recompiling again.
202+
* Request to revert to the interpreter for expression evaluation.
203+
* Any compiled form is discarded but can be recreated by later recompiling again.
204204
* @param expression the expression
205205
*/
206206
public static void revertToInterpreted(Expression expression) {

spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
7777

7878
private InvokerPair lastReadInvokerPair;
7979

80+
8081
/**
8182
* Returns {@code null} which means this is a general purpose accessor.
8283
*/
@@ -662,27 +663,28 @@ public void write(EvaluationContext context, Object target, String name, Object
662663
@Override
663664
public boolean isCompilable() {
664665
// If non public must continue to use reflection
665-
if (!Modifier.isPublic(member.getModifiers()) || !Modifier.isPublic(member.getDeclaringClass().getModifiers())) {
666+
if (!Modifier.isPublic(this.member.getModifiers()) ||
667+
!Modifier.isPublic(this.member.getDeclaringClass().getModifiers())) {
666668
return false;
667669
}
668670
return true;
669671
}
670672

671673
@Override
672674
public Class<?> getPropertyType() {
673-
if (member instanceof Field) {
674-
return ((Field) member).getType();
675+
if (this.member instanceof Field) {
676+
return ((Field) this.member).getType();
675677
}
676678
else {
677-
return ((Method) member).getReturnType();
679+
return ((Method) this.member).getReturnType();
678680
}
679681
}
680682

681683
@Override
682684
public void generateCode(String propertyName, MethodVisitor mv, CodeFlow codeflow) {
683-
boolean isStatic = Modifier.isStatic(member.getModifiers());
685+
boolean isStatic = Modifier.isStatic(this.member.getModifiers());
684686
String descriptor = codeflow.lastDescriptor();
685-
String memberDeclaringClassSlashedDescriptor = member.getDeclaringClass().getName().replace('.','/');
687+
String memberDeclaringClassSlashedDescriptor = this.member.getDeclaringClass().getName().replace('.', '/');
686688
if (!isStatic) {
687689
if (descriptor == null) {
688690
codeflow.loadTarget(mv);
@@ -691,16 +693,15 @@ public void generateCode(String propertyName, MethodVisitor mv, CodeFlow codeflo
691693
mv.visitTypeInsn(CHECKCAST, memberDeclaringClassSlashedDescriptor);
692694
}
693695
}
694-
if (member instanceof Field) {
696+
if (this.member instanceof Field) {
695697
mv.visitFieldInsn(isStatic ? GETSTATIC : GETFIELD, memberDeclaringClassSlashedDescriptor,
696-
member.getName(), CodeFlow.toJVMDescriptor(((Field) member).getType()));
698+
this.member.getName(), CodeFlow.toJVMDescriptor(((Field) this.member).getType()));
697699
}
698700
else {
699701
mv.visitMethodInsn(isStatic ? INVOKESTATIC : INVOKEVIRTUAL, memberDeclaringClassSlashedDescriptor,
700-
member.getName(), CodeFlow.createSignatureDescriptor((Method) member),false);
702+
this.member.getName(), CodeFlow.createSignatureDescriptor((Method) this.member),false);
701703
}
702704
}
703-
704705
}
705706

706707
}

0 commit comments

Comments
 (0)