Polishing

This commit is contained in:
Juergen Hoeller
2017-02-18 01:01:35 +01:00
parent 0f51ff5ebc
commit 214d0d76a5
6 changed files with 60 additions and 66 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ import org.springframework.util.StringUtils;
public class Elvis extends SpelNodeImpl {
public Elvis(int pos, SpelNodeImpl... args) {
super(pos,args);
super(pos, args);
}
@@ -88,7 +88,7 @@ public class Elvis extends SpelNodeImpl {
mv.visitLdcInsn("");
mv.visitInsn(SWAP);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "equals", "(Ljava/lang/Object;)Z",false);
mv.visitJumpInsn(IFEQ, endOfIf); // If not empty, drop through to elseTarget
mv.visitJumpInsn(IFEQ, endOfIf); // if not empty, drop through to elseTarget
mv.visitLabel(elseTarget);
mv.visitInsn(POP);
this.children[1].generateCode(mv, cf);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ import org.springframework.expression.spel.SpelMessage;
public class Ternary extends SpelNodeImpl {
public Ternary(int pos, SpelNodeImpl... args) {
super(pos,args);
super(pos, args);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -4787,30 +4787,6 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertIsCompiled(exp);
}
private void assertIsCompiled(Expression ex) {
try {
Field f = SpelExpression.class.getDeclaredField("compiledAst");
f.setAccessible(true);
Object object = f.get(ex);
assertNotNull(object);
} catch (Exception e) {
fail(e.toString());
}
}
public static class Foo {
public String bar() {
return "BAR";
}
public String bar(String arg) {
return arg.toUpperCase();
}
}
// helper methods
@@ -4871,6 +4847,20 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
}
}
private void assertIsCompiled(Expression expression) {
try {
Field field = SpelExpression.class.getDeclaredField("compiledAst");
field.setAccessible(true);
Object object = field.get(expression);
assertNotNull(object);
}
catch (Exception ex) {
fail(ex.toString());
}
}
// nested types
public interface Message<T> {
@@ -4987,7 +4977,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
try {
method = Payload2.class.getDeclaredMethod("getField", String.class);
}
catch (Exception e) {
catch (Exception ex) {
}
}
String descriptor = cf.lastDescriptor();
@@ -5845,4 +5835,16 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
}
}
public static class Foo {
public String bar() {
return "BAR";
}
public String bar(String arg) {
return arg.toUpperCase();
}
}
}