@ -19,7 +19,6 @@ package org.springframework.expression.spel;
import java.lang.reflect.Array ;
import java.lang.reflect.Array ;
import java.lang.reflect.Field ;
import java.lang.reflect.Field ;
import java.lang.reflect.Method ;
import java.lang.reflect.Method ;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.Arrays ;
import java.util.Collection ;
import java.util.Collection ;
@ -151,6 +150,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class Spr5899Class {
static class Spr5899Class {
public Spr5899Class ( ) {
public Spr5899Class ( ) {
@ -276,7 +276,6 @@ public class SpelReproTests extends AbstractExpressionTests {
public Properties jdbcProperties = new Properties ( ) ;
public Properties jdbcProperties = new Properties ( ) ;
public Properties foo = new Properties ( ) ;
public Properties foo = new Properties ( ) ;
TestProperties ( ) {
TestProperties ( ) {
jdbcProperties . put ( "username" , "Dave" ) ;
jdbcProperties . put ( "username" , "Dave" ) ;
jdbcProperties . put ( "alias" , "Dave2" ) ;
jdbcProperties . put ( "alias" , "Dave2" ) ;
@ -285,6 +284,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class MapAccessor implements PropertyAccessor {
static class MapAccessor implements PropertyAccessor {
@Override
@Override
@ -304,8 +304,7 @@ public class SpelReproTests extends AbstractExpressionTests {
@Override
@Override
@SuppressWarnings ( "unchecked" )
@SuppressWarnings ( "unchecked" )
public void write ( EvaluationContext context , Object target , String name , Object newValue )
public void write ( EvaluationContext context , Object target , String name , Object newValue ) throws AccessException {
throws AccessException {
( ( Map < String , Object > ) target ) . put ( name , newValue ) ;
( ( Map < String , Object > ) target ) . put ( name , newValue ) ;
}
}
@ -326,15 +325,13 @@ public class SpelReproTests extends AbstractExpressionTests {
checkTemplateParsingError ( "abc${ {}( 'abc'" , "Missing closing ')' for '(' at position 8" ) ;
checkTemplateParsingError ( "abc${ {}( 'abc'" , "Missing closing ')' for '(' at position 8" ) ;
checkTemplateParsingError ( "abc${ {}[ 'abc'" , "Missing closing ']' for '[' at position 8" ) ;
checkTemplateParsingError ( "abc${ {}[ 'abc'" , "Missing closing ']' for '[' at position 8" ) ;
checkTemplateParsingError ( "abc${ {}{ 'abc'" , "Missing closing '}' for '{' at position 8" ) ;
checkTemplateParsingError ( "abc${ {}{ 'abc'" , "Missing closing '}' for '{' at position 8" ) ;
checkTemplateParsingError ( "abc${ ( 'abc' }" ,
checkTemplateParsingError ( "abc${ ( 'abc' }" , "Found closing '}' at position 14 but most recent opening is '(' at position 6" ) ;
"Found closing '}' at position 14 but most recent opening is '(' at position 6" ) ;
checkTemplateParsingError ( "abc${ '... }" , "Found non terminating string literal starting at position 6" ) ;
checkTemplateParsingError ( "abc${ '... }" , "Found non terminating string literal starting at position 6" ) ;
checkTemplateParsingError ( "abc${ \"... }" , "Found non terminating string literal starting at position 6" ) ;
checkTemplateParsingError ( "abc${ \"... }" , "Found non terminating string literal starting at position 6" ) ;
checkTemplateParsingError ( "abc${ ) }" , "Found closing ')' at position 6 without an opening '('" ) ;
checkTemplateParsingError ( "abc${ ) }" , "Found closing ')' at position 6 without an opening '('" ) ;
checkTemplateParsingError ( "abc${ ] }" , "Found closing ']' at position 6 without an opening '['" ) ;
checkTemplateParsingError ( "abc${ ] }" , "Found closing ']' at position 6 without an opening '['" ) ;
checkTemplateParsingError ( "abc${ } }" , "No expression defined within delimiter '${}' at character 3" ) ;
checkTemplateParsingError ( "abc${ } }" , "No expression defined within delimiter '${}' at character 3" ) ;
checkTemplateParsingError ( "abc$[ } ]" , DOLLARSQUARE_TEMPLATE_PARSER_CONTEXT ,
checkTemplateParsingError ( "abc$[ } ]" , DOLLARSQUARE_TEMPLATE_PARSER_CONTEXT , "Found closing '}' at position 6 without an opening '{'" ) ;
"Found closing '}' at position 6 without an opening '{'" ) ;
checkTemplateParsing ( "abc ${\"def''g}hi\"} jkl" , "abc def'g}hi jkl" ) ;
checkTemplateParsing ( "abc ${\"def''g}hi\"} jkl" , "abc def'g}hi jkl" ) ;
checkTemplateParsing ( "abc ${'def''g}hi'} jkl" , "abc def'g}hi jkl" ) ;
checkTemplateParsing ( "abc ${'def''g}hi'} jkl" , "abc def'g}hi jkl" ) ;
@ -343,19 +340,13 @@ public class SpelReproTests extends AbstractExpressionTests {
checkTemplateParsing ( "Hello ${'}'}]" , "Hello }]" ) ;
checkTemplateParsing ( "Hello ${'}'}]" , "Hello }]" ) ;
checkTemplateParsing ( "Hello ${'}'}" , "Hello }" ) ;
checkTemplateParsing ( "Hello ${'}'}" , "Hello }" ) ;
checkTemplateParsingError ( "Hello ${ ( " , "No ending suffix '}' for expression starting at character 6: ${ ( " ) ;
checkTemplateParsingError ( "Hello ${ ( " , "No ending suffix '}' for expression starting at character 6: ${ ( " ) ;
checkTemplateParsingError ( "Hello ${ ( }" ,
checkTemplateParsingError ( "Hello ${ ( }" , "Found closing '}' at position 11 but most recent opening is '(' at position 9" ) ;
"Found closing '}' at position 11 but most recent opening is '(' at position 9" ) ;
checkTemplateParsing ( "#{'Unable to render embedded object: File ({#this == 2}'}" , hashes , "Unable to render embedded object: File ({#this == 2}" ) ;
checkTemplateParsing ( "#{'Unable to render embedded object: File ({#this == 2}'}" , hashes ,
checkTemplateParsing ( "This is the last odd number in the list: ${listOfNumbersUpToTen.$[#this%2==1]}" , dollars , "This is the last odd number in the list: 9" ) ;
"Unable to render embedded object: File ({#this == 2}" ) ;
checkTemplateParsing ( "This is the last odd number in the list: ${listOfNumbersUpToTen.$[#this%2==1]}" , dollars ,
"This is the last odd number in the list: 9" ) ;
checkTemplateParsing ( "Hello ${'here is a curly bracket }'}" , dollars , "Hello here is a curly bracket }" ) ;
checkTemplateParsing ( "Hello ${'here is a curly bracket }'}" , dollars , "Hello here is a curly bracket }" ) ;
checkTemplateParsing ( "He${'${'}llo ${'here is a curly bracket }'}}" , dollars ,
checkTemplateParsing ( "He${'${'}llo ${'here is a curly bracket }'}}" , dollars , "He${llo here is a curly bracket }}" ) ;
"He${llo here is a curly bracket }}" ) ;
checkTemplateParsing ( "Hello ${'()()()}{}{}{][]{}{][}[][][}{()()'} World" , dollars , "Hello ()()()}{}{}{][]{}{][}[][][}{()() World" ) ;
checkTemplateParsing ( "Hello ${'()()()}{}{}{][]{}{][}[][][}{()()'} World" , dollars ,
checkTemplateParsing ( "Hello ${'inner literal that''s got {[(])]}an escaped quote in it'} World" , "Hello inner literal that's got {[(])]}an escaped quote in it World" ) ;
"Hello ()()()}{}{}{][]{}{][}[][][}{()() World" ) ;
checkTemplateParsing ( "Hello ${'inner literal that''s got {[(])]}an escaped quote in it'} World" ,
"Hello inner literal that's got {[(])]}an escaped quote in it World" ) ;
checkTemplateParsingError ( "Hello ${" , "No ending suffix '}' for expression starting at character 6: ${" ) ;
checkTemplateParsingError ( "Hello ${" , "No ending suffix '}' for expression starting at character 6: ${" ) ;
}
}
@ -384,11 +375,8 @@ public class SpelReproTests extends AbstractExpressionTests {
@Test
@Test
public void nestedProperties_SPR6923 ( ) {
public void nestedProperties_SPR6923 ( ) {
StandardEvaluationContext eContext = new StandardEvaluationContext ( new Foo ( ) ) ;
StandardEvaluationContext eContext = new StandardEvaluationContext ( new Foo ( ) ) ;
String name = null ;
Expression expr = new SpelExpressionParser ( ) . parseRaw ( "resource.resource.server" ) ;
Expression expr = null ;
String name = expr . getValue ( eContext , String . class ) ;
expr = new SpelExpressionParser ( ) . parseRaw ( "resource.resource.server" ) ;
name = expr . getValue ( eContext , String . class ) ;
assertEquals ( "abc" , name ) ;
assertEquals ( "abc" , name ) ;
}
}
@ -398,11 +386,11 @@ public class SpelReproTests extends AbstractExpressionTests {
public ResourceSummary resource = new ResourceSummary ( ) ;
public ResourceSummary resource = new ResourceSummary ( ) ;
}
}
static class ResourceSummary {
static class ResourceSummary {
private final Resource resource ;
private final Resource resource ;
ResourceSummary ( ) {
ResourceSummary ( ) {
this . resource = new Resource ( ) ;
this . resource = new Resource ( ) ;
}
}
@ -412,6 +400,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class Resource {
static class Resource {
public String getServer ( ) {
public String getServer ( ) {
@ -500,8 +489,7 @@ public class SpelReproTests extends AbstractExpressionTests {
// will access the field 'wibble' and not use a getter
// will access the field 'wibble' and not use a getter
name = expr . getValue ( eContext , String . class ) ;
name = expr . getValue ( eContext , String . class ) ;
assertEquals ( "wobble" , name ) ;
assertEquals ( "wobble" , name ) ;
name = expr . getValue ( eContext , String . class ) ; // will be using the cached accessor
name = expr . getValue ( eContext , String . class ) ; // will be using the cached accessor this time
// this time
assertEquals ( "wobble" , name ) ;
assertEquals ( "wobble" , name ) ;
}
}
@ -519,8 +507,7 @@ public class SpelReproTests extends AbstractExpressionTests {
// will access the field 'wibble' and not use a getter
// will access the field 'wibble' and not use a getter
expr . getValue ( eContext , String . class ) ;
expr . getValue ( eContext , String . class ) ;
assertEquals ( "world" , g . wibble ) ;
assertEquals ( "world" , g . wibble ) ;
expr . getValue ( eContext , String . class ) ; // will be using the cached accessor this
expr . getValue ( eContext , String . class ) ; // will be using the cached accessor this time
// time
assertEquals ( "world" , g . wibble ) ;
assertEquals ( "world" , g . wibble ) ;
}
}
@ -533,8 +520,7 @@ public class SpelReproTests extends AbstractExpressionTests {
expr = new SpelExpressionParser ( ) . parseRaw ( "instance[bar]='world'" ) ;
expr = new SpelExpressionParser ( ) . parseRaw ( "instance[bar]='world'" ) ;
expr . getValue ( eContext , String . class ) ;
expr . getValue ( eContext , String . class ) ;
assertEquals ( "world" , g . value ) ;
assertEquals ( "world" , g . value ) ;
expr . getValue ( eContext , String . class ) ; // will be using the cached accessor this
expr . getValue ( eContext , String . class ) ; // will be using the cached accessor this time
// time
assertEquals ( "world" , g . value ) ;
assertEquals ( "world" , g . value ) ;
}
}
@ -563,7 +549,6 @@ public class SpelReproTests extends AbstractExpressionTests {
public String floo = "bar" ;
public String floo = "bar" ;
public XX ( ) {
public XX ( ) {
m = new HashMap < String , String > ( ) ;
m = new HashMap < String , String > ( ) ;
m . put ( "$foo" , "wibble" ) ;
m . put ( "$foo" , "wibble" ) ;
@ -571,6 +556,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class Goo {
static class Goo {
public static Goo instance = new Goo ( ) ;
public static Goo instance = new Goo ( ) ;
@ -581,7 +567,6 @@ public class SpelReproTests extends AbstractExpressionTests {
public String wibble = "wobble" ;
public String wibble = "wobble" ;
public String getKey ( ) {
public String getKey ( ) {
return "hello" ;
return "hello" ;
}
}
@ -591,6 +576,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class Holder {
static class Holder {
public Map < String , String > map = new HashMap < String , String > ( ) ;
public Map < String , String > map = new HashMap < String , String > ( ) ;
@ -610,12 +596,10 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
private void checkTemplateParsingError ( String expression , String expectedMessage ) throws Exception {
private void checkTemplateParsingError ( String expression , String expectedMessage ) throws Exception {
checkTemplateParsingError ( expression , TemplateExpressionParsingTests . DEFAULT_TEMPLATE_PARSER_CONTEXT ,
checkTemplateParsingError ( expression , TemplateExpressionParsingTests . DEFAULT_TEMPLATE_PARSER_CONTEXT , expectedMessage ) ;
expectedMessage ) ;
}
}
private void checkTemplateParsingError ( String expression , ParserContext context , String expectedMessage )
private void checkTemplateParsingError ( String expression , ParserContext context , String expectedMessage ) throws Exception {
throws Exception {
SpelExpressionParser parser = new SpelExpressionParser ( ) ;
SpelExpressionParser parser = new SpelExpressionParser ( ) ;
try {
try {
parser . parseExpression ( expression , context ) ;
parser . parseExpression ( expression , context ) ;
@ -635,17 +619,14 @@ public class SpelReproTests extends AbstractExpressionTests {
private static final ParserContext DOLLARSQUARE_TEMPLATE_PARSER_CONTEXT = new ParserContext ( ) {
private static final ParserContext DOLLARSQUARE_TEMPLATE_PARSER_CONTEXT = new ParserContext ( ) {
@Override
@Override
public String getExpressionPrefix ( ) {
public String getExpressionPrefix ( ) {
return "$[" ;
return "$[" ;
}
}
@Override
@Override
public String getExpressionSuffix ( ) {
public String getExpressionSuffix ( ) {
return "]" ;
return "]" ;
}
}
@Override
@Override
public boolean isTemplate ( ) {
public boolean isTemplate ( ) {
return true ;
return true ;
@ -660,11 +641,11 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class Message {
static class Message {
private String payload ;
private String payload ;
public String getPayload ( ) {
public String getPayload ( ) {
return payload ;
return payload ;
}
}
@ -711,7 +692,7 @@ public class SpelReproTests extends AbstractExpressionTests {
assertEquals ( SpelMessage . EXCEPTION_DURING_BEAN_RESOLUTION , see . getMessageCode ( ) ) ;
assertEquals ( SpelMessage . EXCEPTION_DURING_BEAN_RESOLUTION , see . getMessageCode ( ) ) ;
assertEquals ( "goo" , see . getInserts ( ) [ 0 ] ) ;
assertEquals ( "goo" , see . getInserts ( ) [ 0 ] ) ;
assertTrue ( see . getCause ( ) instanceof AccessException ) ;
assertTrue ( see . getCause ( ) instanceof AccessException ) ;
assertTrue ( ( ( AccessException ) see . getCause ( ) ) . getMessage ( ) . startsWith ( "DONT" ) ) ;
assertTrue ( see . getCause ( ) . getMessage ( ) . startsWith ( "DONT" ) ) ;
}
}
// bean exists
// bean exists
@ -864,7 +845,6 @@ public class SpelReproTests extends AbstractExpressionTests {
public String [ ] as ;
public String [ ] as ;
public Map < String , String > ms ;
public Map < String , String > ms ;
C ( ) {
C ( ) {
ls = new ArrayList < String > ( ) ;
ls = new ArrayList < String > ( ) ;
ls . add ( "abc" ) ;
ls . add ( "abc" ) ;
@ -876,11 +856,11 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class D {
static class D {
public String a ;
public String a ;
private D ( String s ) {
private D ( String s ) {
a = s ;
a = s ;
}
}
@ -932,11 +912,9 @@ public class SpelReproTests extends AbstractExpressionTests {
@SuppressWarnings ( "unused" )
@SuppressWarnings ( "unused" )
class ConversionPriority1 {
class ConversionPriority1 {
public int getX ( Number i ) {
public int getX ( Number i ) {
return 20 ;
return 20 ;
}
}
public int getX ( int i ) {
public int getX ( int i ) {
return 10 ;
return 10 ;
}
}
@ -944,11 +922,9 @@ public class SpelReproTests extends AbstractExpressionTests {
@SuppressWarnings ( "unused" )
@SuppressWarnings ( "unused" )
class ConversionPriority2 {
class ConversionPriority2 {
public int getX ( int i ) {
public int getX ( int i ) {
return 10 ;
return 10 ;
}
}
public int getX ( Number i ) {
public int getX ( Number i ) {
return 20 ;
return 20 ;
}
}
@ -989,27 +965,22 @@ public class SpelReproTests extends AbstractExpressionTests {
public void wideningPrimitiveConversion_8224 ( ) throws Exception {
public void wideningPrimitiveConversion_8224 ( ) throws Exception {
class WideningPrimitiveConversion {
class WideningPrimitiveConversion {
public int getX ( long i ) {
public int getX ( long i ) {
return 10 ;
return 10 ;
}
}
}
}
final Integer INTEGER_VALUE = Integer . valueOf ( 7 ) ;
final Integer INTEGER_VALUE = Integer . valueOf ( 7 ) ;
WideningPrimitiveConversion target = new WideningPrimitiveConversion ( ) ;
WideningPrimitiveConversion target = new WideningPrimitiveConversion ( ) ;
EvaluationContext emptyEvalContext = new StandardEvaluationContext ( ) ;
EvaluationContext emptyEvalContext = new StandardEvaluationContext ( ) ;
List < TypeDescriptor > args = new ArrayList < TypeDescriptor > ( ) ;
List < TypeDescriptor > args = new ArrayList < TypeDescriptor > ( ) ;
args . add ( TypeDescriptor . forObject ( INTEGER_VALUE ) ) ;
args . add ( TypeDescriptor . forObject ( INTEGER_VALUE ) ) ;
MethodExecutor me = new ReflectiveMethodResolver ( true ) . resolve ( emptyEvalContext , target , "getX" , args ) ;
MethodExecutor me = new ReflectiveMethodResolver ( true ) . resolve ( emptyEvalContext , target , "getX" , args ) ;
final int actual = ( Integer ) me . execute ( emptyEvalContext , target , INTEGER_VALUE ) . getValue ( ) ;
final int actual = ( Integer ) me . execute ( emptyEvalContext , target , INTEGER_VALUE ) . getValue ( ) ;
final int compiler = target . getX ( INTEGER_VALUE ) ;
final int compiler = target . getX ( INTEGER_VALUE ) ;
assertEquals ( compiler , actual ) ;
assertEquals ( compiler , actual ) ;
}
}
@ -1130,12 +1101,9 @@ public class SpelReproTests extends AbstractExpressionTests {
// "DIV","EQ","GE","GT","LE","LT","MOD","NE","NOT"
// "DIV","EQ","GE","GT","LE","LT","MOD","NE","NOT"
@SuppressWarnings ( "unused" )
@SuppressWarnings ( "unused" )
class Reserver {
class Reserver {
public Reserver getReserver ( ) {
public Reserver getReserver ( ) {
return this ;
return this ;
}
}
public String NE = "abc" ;
public String NE = "abc" ;
public String ne = "def" ;
public String ne = "def" ;
@ -1144,7 +1112,6 @@ public class SpelReproTests extends AbstractExpressionTests {
public Map < String , String > m = new HashMap < String , String > ( ) ;
public Map < String , String > m = new HashMap < String , String > ( ) ;
Reserver ( ) {
Reserver ( ) {
m . put ( "NE" , "xyz" ) ;
m . put ( "NE" , "xyz" ) ;
}
}
@ -1215,7 +1182,6 @@ public class SpelReproTests extends AbstractExpressionTests {
private String mapName ;
private String mapName ;
public TestPropertyAccessor ( String mapName ) {
public TestPropertyAccessor ( String mapName ) {
this . mapName = mapName ;
this . mapName = mapName ;
}
}
@ -1252,12 +1218,12 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Override
@Override
public void write ( EvaluationContext context , Object target , String name , Object newValue )
public void write ( EvaluationContext context , Object target , String name , Object newValue ) throws AccessException {
throws AccessException {
getMap ( target ) . put ( name , ( String ) newValue ) ;
getMap ( target ) . put ( name , ( String ) newValue ) ;
}
}
}
}
class ContextObject {
class ContextObject {
public Map < String , String > firstContext = new HashMap < String , String > ( ) ;
public Map < String , String > firstContext = new HashMap < String , String > ( ) ;
@ -1265,7 +1231,6 @@ public class SpelReproTests extends AbstractExpressionTests {
public Map < String , String > thirdContext = new HashMap < String , String > ( ) ;
public Map < String , String > thirdContext = new HashMap < String , String > ( ) ;
public Map < String , String > fourthContext = new HashMap < String , String > ( ) ;
public Map < String , String > fourthContext = new HashMap < String , String > ( ) ;
public ContextObject ( ) {
public ContextObject ( ) {
firstContext . put ( "shouldBeFirst" , "first" ) ;
firstContext . put ( "shouldBeFirst" , "first" ) ;
secondContext . put ( "shouldBeFirst" , "second" ) ;
secondContext . put ( "shouldBeFirst" , "second" ) ;
@ -1310,7 +1275,6 @@ public class SpelReproTests extends AbstractExpressionTests {
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
List < MethodResolver > methodResolvers = new ArrayList < MethodResolver > ( ) ;
List < MethodResolver > methodResolvers = new ArrayList < MethodResolver > ( ) ;
methodResolvers . add ( new ReflectiveMethodResolver ( ) {
methodResolvers . add ( new ReflectiveMethodResolver ( ) {
@Override
@Override
protected Method [ ] getMethods ( Class < ? > type ) {
protected Method [ ] getMethods ( Class < ? > type ) {
try {
try {
@ -1360,10 +1324,10 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatFunctionResolver ( ) throws Exception {
public void SPR9486_floatFunctionResolver ( ) throws Exception {
Number expectedResult = Math . abs ( - 10 . 2f ) ;
Number expectedResult = Math . abs ( - 10 . 2f ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
SPR_ 9486_FunctionsClass testObject = new SPR_ 9486_FunctionsClass ( ) ;
SPR9486_FunctionsClass testObject = new SPR9486_FunctionsClass ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
Expression expression = parser . parseExpression ( "abs(-10.2f)" ) ;
Expression expression = parser . parseExpression ( "abs(-10.2f)" ) ;
@ -1372,7 +1336,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
class SPR_ 9486_FunctionsClass {
class SPR9486_FunctionsClass {
public int abs ( int value ) {
public int abs ( int value ) {
return Math . abs ( value ) ;
return Math . abs ( value ) ;
@ -1385,7 +1349,7 @@ public class SpelReproTests extends AbstractExpressionTests {
@Test
@Test
public void SPR_ 9486_addFloatWithDouble ( ) {
public void SPR9486_addFloatWithDouble ( ) {
Number expectedNumber = 10 . 21f + 10 . 2 ;
Number expectedNumber = 10 . 21f + 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1395,7 +1359,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_addFloatWithFloat ( ) {
public void SPR9486_addFloatWithFloat ( ) {
Number expectedNumber = 10 . 21f + 10 . 2f ;
Number expectedNumber = 10 . 21f + 10 . 2f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1405,7 +1369,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_subtractFloatWithDouble ( ) {
public void SPR9486_subtractFloatWithDouble ( ) {
Number expectedNumber = 10 . 21f - 10 . 2 ;
Number expectedNumber = 10 . 21f - 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1415,7 +1379,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_subtractFloatWithFloat ( ) {
public void SPR9486_subtractFloatWithFloat ( ) {
Number expectedNumber = 10 . 21f - 10 . 2f ;
Number expectedNumber = 10 . 21f - 10 . 2f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1425,7 +1389,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_multiplyFloatWithDouble ( ) {
public void SPR9486_multiplyFloatWithDouble ( ) {
Number expectedNumber = 10 . 21f * 10 . 2 ;
Number expectedNumber = 10 . 21f * 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1435,7 +1399,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_multiplyFloatWithFloat ( ) {
public void SPR9486_multiplyFloatWithFloat ( ) {
Number expectedNumber = 10 . 21f * 10 . 2f ;
Number expectedNumber = 10 . 21f * 10 . 2f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1445,7 +1409,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatDivideByFloat ( ) {
public void SPR9486_floatDivideByFloat ( ) {
Number expectedNumber = - 10 . 21f / - 10 . 2f ;
Number expectedNumber = - 10 . 21f / - 10 . 2f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1455,7 +1419,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatDivideByDouble ( ) {
public void SPR9486_floatDivideByDouble ( ) {
Number expectedNumber = - 10 . 21f / - 10 . 2 ;
Number expectedNumber = - 10 . 21f / - 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1465,7 +1429,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatEqFloatUnaryMinus ( ) {
public void SPR9486_floatEqFloatUnaryMinus ( ) {
Boolean expectedResult = - 10 . 21f = = - 10 . 2f ;
Boolean expectedResult = - 10 . 21f = = - 10 . 2f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1475,7 +1439,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatEqDoubleUnaryMinus ( ) {
public void SPR9486_floatEqDoubleUnaryMinus ( ) {
Boolean expectedResult = - 10 . 21f = = - 10 . 2 ;
Boolean expectedResult = - 10 . 21f = = - 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1485,7 +1449,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatEqFloat ( ) {
public void SPR9486_floatEqFloat ( ) {
Boolean expectedResult = 10 . 215f = = 10 . 2109f ;
Boolean expectedResult = 10 . 215f = = 10 . 2109f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1495,7 +1459,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatEqDouble ( ) {
public void SPR9486_floatEqDouble ( ) {
Boolean expectedResult = 10 . 215f = = 10 . 2109 ;
Boolean expectedResult = 10 . 215f = = 10 . 2109 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1505,7 +1469,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatNotEqFloat ( ) {
public void SPR9486_floatNotEqFloat ( ) {
Boolean expectedResult = 10 . 215f ! = 10 . 2109f ;
Boolean expectedResult = 10 . 215f ! = 10 . 2109f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1515,7 +1479,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatNotEqDouble ( ) {
public void SPR9486_floatNotEqDouble ( ) {
Boolean expectedResult = 10 . 215f ! = 10 . 2109 ;
Boolean expectedResult = 10 . 215f ! = 10 . 2109 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1525,7 +1489,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatLessThanFloat ( ) {
public void SPR9486_floatLessThanFloat ( ) {
Boolean expectedNumber = - 10 . 21f < - 10 . 2f ;
Boolean expectedNumber = - 10 . 21f < - 10 . 2f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1535,7 +1499,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatLessThanDouble ( ) {
public void SPR9486_floatLessThanDouble ( ) {
Boolean expectedNumber = - 10 . 21f < - 10 . 2 ;
Boolean expectedNumber = - 10 . 21f < - 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1545,7 +1509,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatLessThanOrEqualFloat ( ) {
public void SPR9486_floatLessThanOrEqualFloat ( ) {
Boolean expectedNumber = - 10 . 21f < = - 10 . 22f ;
Boolean expectedNumber = - 10 . 21f < = - 10 . 22f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1555,7 +1519,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatLessThanOrEqualDouble ( ) {
public void SPR9486_floatLessThanOrEqualDouble ( ) {
Boolean expectedNumber = - 10 . 21f < = - 10 . 2 ;
Boolean expectedNumber = - 10 . 21f < = - 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1565,7 +1529,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatGreaterThanFloat ( ) {
public void SPR9486_floatGreaterThanFloat ( ) {
Boolean expectedNumber = - 10 . 21f > - 10 . 2f ;
Boolean expectedNumber = - 10 . 21f > - 10 . 2f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1575,7 +1539,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatGreaterThanDouble ( ) {
public void SPR9486_floatGreaterThanDouble ( ) {
Boolean expectedResult = - 10 . 21f > - 10 . 2 ;
Boolean expectedResult = - 10 . 21f > - 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1585,7 +1549,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatGreaterThanOrEqualFloat ( ) {
public void SPR9486_floatGreaterThanOrEqualFloat ( ) {
Boolean expectedNumber = - 10 . 21f > = - 10 . 2f ;
Boolean expectedNumber = - 10 . 21f > = - 10 . 2f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1595,7 +1559,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatGreaterThanEqualDouble ( ) {
public void SPR9486_floatGreaterThanEqualDouble ( ) {
Boolean expectedResult = - 10 . 21f > = - 10 . 2 ;
Boolean expectedResult = - 10 . 21f > = - 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1605,7 +1569,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatModulusFloat ( ) {
public void SPR9486_floatModulusFloat ( ) {
Number expectedResult = 10 . 21f % 10 . 2f ;
Number expectedResult = 10 . 21f % 10 . 2f ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1615,7 +1579,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatModulusDouble ( ) {
public void SPR9486_floatModulusDouble ( ) {
Number expectedResult = 10 . 21f % 10 . 2 ;
Number expectedResult = 10 . 21f % 10 . 2 ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1625,7 +1589,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatPowerFloat ( ) {
public void SPR9486_floatPowerFloat ( ) {
Number expectedResult = Math . pow ( 10 . 21f , - 10 . 2f ) ;
Number expectedResult = Math . pow ( 10 . 21f , - 10 . 2f ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1635,7 +1599,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9486_floatPowerDouble ( ) {
public void SPR9486_floatPowerDouble ( ) {
Number expectedResult = Math . pow ( 10 . 21f , 10 . 2 ) ;
Number expectedResult = Math . pow ( 10 . 21f , 10 . 2 ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
@ -1645,7 +1609,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9994_bridgeMethods ( ) throws Exception {
public void SPR9994_bridgeMethods ( ) throws Exception {
ReflectivePropertyAccessor accessor = new ReflectivePropertyAccessor ( ) ;
ReflectivePropertyAccessor accessor = new ReflectivePropertyAccessor ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
Object target = new GenericImplementation ( ) ;
Object target = new GenericImplementation ( ) ;
@ -1654,7 +1618,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10162_onlyBridgeMethod ( ) throws Exception {
public void SPR10162_onlyBridgeMethod ( ) throws Exception {
ReflectivePropertyAccessor accessor = new ReflectivePropertyAccessor ( ) ;
ReflectivePropertyAccessor accessor = new ReflectivePropertyAccessor ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
Object target = new OnlyBridgeMethod ( ) ;
Object target = new OnlyBridgeMethod ( ) ;
@ -1663,7 +1627,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10091_simpleTestValueType ( ) {
public void SPR10091_simpleTestValueType ( ) {
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext evaluationContext = new StandardEvaluationContext ( new BooleanHolder ( ) ) ;
StandardEvaluationContext evaluationContext = new StandardEvaluationContext ( new BooleanHolder ( ) ) ;
Class < ? > valueType = parser . parseExpression ( "simpleProperty" ) . getValueType ( evaluationContext ) ;
Class < ? > valueType = parser . parseExpression ( "simpleProperty" ) . getValueType ( evaluationContext ) ;
@ -1671,7 +1635,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10091_simpleTestValue ( ) {
public void SPR10091_simpleTestValue ( ) {
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext evaluationContext = new StandardEvaluationContext ( new BooleanHolder ( ) ) ;
StandardEvaluationContext evaluationContext = new StandardEvaluationContext ( new BooleanHolder ( ) ) ;
Object value = parser . parseExpression ( "simpleProperty" ) . getValue ( evaluationContext ) ;
Object value = parser . parseExpression ( "simpleProperty" ) . getValue ( evaluationContext ) ;
@ -1679,7 +1643,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10091_primitiveTestValueType ( ) {
public void SPR10091_primitiveTestValueType ( ) {
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext evaluationContext = new StandardEvaluationContext ( new BooleanHolder ( ) ) ;
StandardEvaluationContext evaluationContext = new StandardEvaluationContext ( new BooleanHolder ( ) ) ;
Class < ? > valueType = parser . parseExpression ( "primitiveProperty" ) . getValueType ( evaluationContext ) ;
Class < ? > valueType = parser . parseExpression ( "primitiveProperty" ) . getValueType ( evaluationContext ) ;
@ -1687,7 +1651,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10091_primitiveTestValue ( ) {
public void SPR10091_primitiveTestValue ( ) {
ExpressionParser parser = new SpelExpressionParser ( ) ;
ExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext evaluationContext = new StandardEvaluationContext ( new BooleanHolder ( ) ) ;
StandardEvaluationContext evaluationContext = new StandardEvaluationContext ( new BooleanHolder ( ) ) ;
Object value = parser . parseExpression ( "primitiveProperty" ) . getValue ( evaluationContext ) ;
Object value = parser . parseExpression ( "primitiveProperty" ) . getValue ( evaluationContext ) ;
@ -1695,7 +1659,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10146_malformedExpressions ( ) throws Exception {
public void SPR10146_malformedExpressions ( ) throws Exception {
doTestSpr10146 ( "/foo" , "EL1070E:(pos 0): Problem parsing left operand" ) ;
doTestSpr10146 ( "/foo" , "EL1070E:(pos 0): Problem parsing left operand" ) ;
doTestSpr10146 ( "*foo" , "EL1070E:(pos 0): Problem parsing left operand" ) ;
doTestSpr10146 ( "*foo" , "EL1070E:(pos 0): Problem parsing left operand" ) ;
doTestSpr10146 ( "%foo" , "EL1070E:(pos 0): Problem parsing left operand" ) ;
doTestSpr10146 ( "%foo" , "EL1070E:(pos 0): Problem parsing left operand" ) ;
@ -1714,18 +1678,18 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10125 ( ) throws Exception {
public void SPR10125 ( ) throws Exception {
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
String fromInterface = parser . parseExpression ( "T(" + StaticFinalImpl1 . class . getName ( ) + ").VALUE" ) . getValue (
String fromInterface = parser . parseExpression ( "T(" + StaticFinalImpl1 . class . getName ( ) + ").VALUE" ) . getValue (
context , String . class ) ;
context , String . class ) ;
assertThat ( fromInterface , is ( "interfaceValue" ) ) ;
assertThat ( fromInterface , is ( "interfaceValue" ) ) ;
String fromClass = parser . parseExpression ( "T(" + StaticFinalImpl2 . class . getName ( ) + ").VALUE" ) . getValue (
String fromClass = parser . parseExpression ( "T(" + StaticFinalImpl2 . class . getName ( ) + ").VALUE" ) . getValue (
context , String . class ) ;
context , String . class ) ;
assertThat ( fromClass , is ( "interfaceValue" ) ) ;
assertThat ( fromClass , is ( "interfaceValue" ) ) ;
}
}
@Test
@Test
public void SPR_ 10210 ( ) throws Exception {
public void SPR10210 ( ) throws Exception {
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
context . setVariable ( "bridgeExample" , new org . springframework . expression . spel . spr10210 . D ( ) ) ;
context . setVariable ( "bridgeExample" , new org . springframework . expression . spel . spr10210 . D ( ) ) ;
Expression parseExpression = parser . parseExpression ( "#bridgeExample.bridgeMethod()" ) ;
Expression parseExpression = parser . parseExpression ( "#bridgeExample.bridgeMethod()" ) ;
@ -1733,7 +1697,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10328 ( ) throws Exception {
public void SPR10328 ( ) throws Exception {
thrown . expect ( SpelParseException . class ) ;
thrown . expect ( SpelParseException . class ) ;
thrown . expectMessage ( "EL1071E:(pos 2): A required selection expression has not been specified" ) ;
thrown . expectMessage ( "EL1071E:(pos 2): A required selection expression has not been specified" ) ;
Expression exp = parser . parseExpression ( "$[]" ) ;
Expression exp = parser . parseExpression ( "$[]" ) ;
@ -1741,7 +1705,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10452 ( ) throws Exception {
public void SPR10452 ( ) throws Exception {
SpelParserConfiguration configuration = new SpelParserConfiguration ( false , false ) ;
SpelParserConfiguration configuration = new SpelParserConfiguration ( false , false ) ;
ExpressionParser parser = new SpelExpressionParser ( configuration ) ;
ExpressionParser parser = new SpelExpressionParser ( configuration ) ;
@ -1766,7 +1730,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9495 ( ) throws Exception {
public void SPR9495 ( ) throws Exception {
SpelParserConfiguration configuration = new SpelParserConfiguration ( false , false ) ;
SpelParserConfiguration configuration = new SpelParserConfiguration ( false , false ) ;
ExpressionParser parser = new SpelExpressionParser ( configuration ) ;
ExpressionParser parser = new SpelExpressionParser ( configuration ) ;
@ -1782,20 +1746,17 @@ public class SpelReproTests extends AbstractExpressionTests {
assertEquals ( ABC . C , Array . get ( result , 2 ) ) ;
assertEquals ( ABC . C , Array . get ( result , 2 ) ) ;
context . addMethodResolver ( new MethodResolver ( ) {
context . addMethodResolver ( new MethodResolver ( ) {
@Override
@Override
public MethodExecutor resolve ( EvaluationContext context , Object targetObject , String name ,
public MethodExecutor resolve ( EvaluationContext context , Object targetObject , String name ,
List < TypeDescriptor > argumentTypes ) throws AccessException {
List < TypeDescriptor > argumentTypes ) throws AccessException {
return new MethodExecutor ( ) {
return new MethodExecutor ( ) {
@Override
@Override
public TypedValue execute ( EvaluationContext context , Object target , Object . . . arguments )
public TypedValue execute ( EvaluationContext context , Object target , Object . . . arguments )
throws AccessException {
throws AccessException {
try {
try {
Method method = XYZ . class . getMethod ( "values" ) ;
Method method = XYZ . class . getMethod ( "values" ) ;
Object value = method . invoke ( target , arguments ) ;
Object value = method . invoke ( target , arguments ) ;
return new TypedValue ( value ,
return new TypedValue ( value , new TypeDescriptor ( new MethodParameter ( method , - 1 ) ) . narrow ( value ) ) ;
new TypeDescriptor ( new MethodParameter ( method , - 1 ) ) . narrow ( value ) ) ;
}
}
catch ( Exception ex ) {
catch ( Exception ex ) {
throw new AccessException ( ex . getMessage ( ) , ex ) ;
throw new AccessException ( ex . getMessage ( ) , ex ) ;
@ -1813,7 +1774,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 10486 ( ) throws Exception {
public void SPR10486 ( ) throws Exception {
SpelExpressionParser parser = new SpelExpressionParser ( ) ;
SpelExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
SPR10486 rootObject = new SPR10486 ( ) ;
SPR10486 rootObject = new SPR10486 ( ) ;
@ -1824,7 +1785,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 11142 ( ) throws Exception {
public void SPR11142 ( ) throws Exception {
SpelExpressionParser parser = new SpelExpressionParser ( ) ;
SpelExpressionParser parser = new SpelExpressionParser ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
StandardEvaluationContext context = new StandardEvaluationContext ( ) ;
SPR11142 rootObject = new SPR11142 ( ) ;
SPR11142 rootObject = new SPR11142 ( ) ;
@ -1835,7 +1796,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 9194 ( ) {
public void SPR9194 ( ) {
TestClass2 one = new TestClass2 ( "abc" ) ;
TestClass2 one = new TestClass2 ( "abc" ) ;
TestClass2 two = new TestClass2 ( "abc" ) ;
TestClass2 two = new TestClass2 ( "abc" ) ;
Map < String , TestClass2 > map = new HashMap < String , TestClass2 > ( ) ;
Map < String , TestClass2 > map = new HashMap < String , TestClass2 > ( ) ;
@ -1848,7 +1809,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
@Test
@Test
public void SPR_ 11348 ( ) {
public void SPR11348 ( ) {
Collection < String > coll = new HashSet < String > ( ) ;
Collection < String > coll = new HashSet < String > ( ) ;
coll . add ( "one" ) ;
coll . add ( "one" ) ;
coll . add ( "two" ) ;
coll . add ( "two" ) ;
@ -1864,14 +1825,18 @@ public class SpelReproTests extends AbstractExpressionTests {
assertEquals ( "two" , list . get ( 1 ) ) ;
assertEquals ( "two" , list . get ( 1 ) ) ;
}
}
@Test
private static enum ABC {
public void SPR11494 ( ) {
A , B , C
Expression exp = new SpelExpressionParser ( ) . parseExpression ( "T(java.util.Arrays).asList('a','b')" ) ;
List < String > list = ( List < String > ) exp . getValue ( ) ;
assertThat ( list . size ( ) , is ( 2 ) ) ;
}
}
private static enum XYZ {
X , Y , Z
private static enum ABC { A , B , C }
}
private static enum XYZ { X , Y , Z }
public static class BooleanHolder {
public static class BooleanHolder {
@ -1879,7 +1844,6 @@ public class SpelReproTests extends AbstractExpressionTests {
private boolean primitiveProperty = true ;
private boolean primitiveProperty = true ;
public Boolean isSimpleProperty ( ) {
public Boolean isSimpleProperty ( ) {
return simpleProperty ;
return simpleProperty ;
}
}
@ -1897,11 +1861,13 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
private static interface GenericInterface < T extends Number > {
private static interface GenericInterface < T extends Number > {
public T getProperty ( ) ;
public T getProperty ( ) ;
}
}
private static class GenericImplementation implements GenericInterface < Integer > {
private static class GenericImplementation implements GenericInterface < Integer > {
@Override
@Override
@ -1910,6 +1876,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class PackagePrivateClassWithGetter {
static class PackagePrivateClassWithGetter {
public Integer getProperty ( ) {
public Integer getProperty ( ) {
@ -1917,28 +1884,33 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
public static class OnlyBridgeMethod extends PackagePrivateClassWithGetter {
public static class OnlyBridgeMethod extends PackagePrivateClassWithGetter {
}
}
public static interface StaticFinal {
public static interface StaticFinal {
public static final String VALUE = "interfaceValue" ;
public static final String VALUE = "interfaceValue" ;
}
}
public abstract static class AbstractStaticFinal implements StaticFinal {
public abstract static class AbstractStaticFinal implements StaticFinal {
}
}
public static class StaticFinalImpl1 extends AbstractStaticFinal implements StaticFinal {
public static class StaticFinalImpl1 extends AbstractStaticFinal implements StaticFinal {
}
}
public static class StaticFinalImpl2 extends AbstractStaticFinal {
public static class StaticFinalImpl2 extends AbstractStaticFinal {
}
}
public static class SPR10486 {
public static class SPR10486 {
private String name = "name" ;
private String name = "name" ;
public String getName ( ) {
public String getName ( ) {
return name ;
return name ;
}
}
@ -1948,6 +1920,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class SPR11142 {
static class SPR11142 {
public String isSomething ( ) {
public String isSomething ( ) {
@ -1955,6 +1928,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
}
}
}
static class TestClass2 { // SPR-9194
static class TestClass2 { // SPR-9194
String string ;
String string ;