@ -322,30 +321,10 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@@ -322,30 +321,10 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@ -476,13 +455,12 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@@ -476,13 +455,12 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
// Code gen is different for -1 .. 6 because there are bytecode instructions specifically for those
// values
// Code gen is different for -1 .. 6 because there are bytecode instructions specifically for those values
// Not an int literal but an opminus with one operand:
// expression = parser.parseExpression("-1");
// assertCanCompile(expression);
// assertEquals(-1, expression.getValue());
// expression = parser.parseExpression("-1");
// assertCanCompile(expression);
// assertEquals(-1, expression.getValue());
expression=parser.parseExpression("0");
assertCanCompile(expression);
assertEquals(0,expression.getValue());
@ -527,8 +505,8 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@@ -527,8 +505,8 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@ -3314,10 +3292,10 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@@ -3314,10 +3292,10 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertCanCompile(expression);
Objecto=expression.getValue();
assertEquals(testclass8,o.getClass().getName());
TestClass8tc8=(TestClass8)o;
TestClass8tc8=(TestClass8)o;
assertEquals(42,tc8.i);
assertEquals("123",tc8.s);
assertEquals(4.0d,tc8.d,0.5d);
assertEquals(4.0d,tc8.d,0.5d);
assertEquals(true,tc8.z);
// no-arg ctor
@ -4372,7 +4350,8 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@@ -4372,7 +4350,8 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@ -4380,7 +4359,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@@ -4380,7 +4359,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@ -4620,14 +4599,16 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@@ -4620,14 +4599,16 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
// This next call was failing because the isCompilable check in Indexer did not check on the key being compilable
// (and also generateCode in the Indexer was missing the optimization that it didn't need necessarily need to call
// generateCode for that accessor)
// This next call was failing because the isCompilable check in Indexer
// did not check on the key being compilable (and also generateCode in the
// Indexer was missing the optimization that it didn't need necessarily
// need to call generateCode for that accessor)
assertEquals("wibble",expression.getValue(root));
assertCanCompile(expression);
@ -4803,6 +4784,25 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
@@ -4803,6 +4784,25 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertIsCompiled(exp);
}
@Test
publicvoidrepeatedCompilation()throwsException{
// Verifying that after a number of compilations, the classloaders
// used to load the compiled expressions are discarded/replaced.
@ -241,7 +219,6 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -241,7 +219,6 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
@ -287,12 +264,6 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -287,12 +264,6 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
System.out.println("One million iterations: "+(System.currentTimeMillis()-stime)+"ms");
@ -313,8 +284,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -313,8 +284,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
longetime=System.currentTimeMillis();
longinterpretedSpeed=(etime-stime);
iTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
iTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
}
logln();
@ -329,8 +300,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -329,8 +300,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
longetime=System.currentTimeMillis();
longcompiledSpeed=(etime-stime);
cTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
cTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
}
logln();
@ -376,8 +347,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -376,8 +347,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longinterpretedSpeed=(etime-stime);
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
}
logln();
@ -392,8 +363,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -392,8 +363,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longcompiledSpeed=(etime-stime);
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
}
logln();
@ -407,28 +378,6 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -407,28 +378,6 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@ -450,8 +399,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -450,8 +399,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longinterpretedSpeed=(etime-stime);
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
}
logln();
@ -466,8 +415,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -466,8 +415,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longcompiledSpeed=(etime-stime);
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
}
logln();
@ -481,7 +430,6 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -481,7 +430,6 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@ -497,8 +445,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -497,8 +445,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longinterpretedSpeed=(etime-stime);
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
}
logln();
@ -513,8 +461,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -513,8 +461,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longcompiledSpeed=(etime-stime);
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
}
logln();
@ -542,8 +490,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -542,8 +490,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longinterpretedSpeed=(etime-stime);
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
}
logln();
@ -558,8 +506,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -558,8 +506,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longcompiledSpeed=(etime-stime);
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
}
logln();
@ -635,8 +583,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -635,8 +583,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longinterpretedSpeed=(etime-stime);
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
interpretedTotal+=interpretedSpeed;
log(interpretedSpeed+"ms ");
}
logln();
@ -652,8 +600,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -652,8 +600,8 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
}
etime=System.currentTimeMillis();
longcompiledSpeed=(etime-stime);
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
compiledTotal+=compiledSpeed;
log(compiledSpeed+"ms ");
}
logln();
@ -661,21 +609,22 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -661,21 +609,22 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
logln(">>"+title+": average for "+count+": compiled="+averageCompiled+"ms interpreted="+averageInterpreted+"ms: compiled takes "+((int)ratio)+"% of the interpreted time");
if(averageCompiled>averageInterpreted){
fail("Compiled version took longer than interpreted! CompiledSpeed=~"+averageCompiled+
fail("Compiled version took longer than interpreted! CompiledSpeed=~"+averageCompiled+
"ms InterpretedSpeed="+averageInterpreted+"ms");
}
logln();
}
@ -688,7 +637,7 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -688,7 +637,7 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
privatevoidlogln(String...message){
if(noisyTests){
if(message!=null&&message.length>0){
if(message.length>0){
System.out.println(message[0]);
}
else{
@ -700,4 +649,84 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {
@@ -700,4 +649,84 @@ public class SpelCompilationPerformanceTests extends AbstractExpressionTests {