Commit Graph

143 Commits

Author SHA1 Message Date
Juergen Hoeller 8325b10080 Consistent formatting of license headers, package javadocs, and import declarations 2014-10-21 01:44:07 +02:00
Juergen Hoeller 92ad02ae8f Consistent number handling in StandardTypeComparator (BigInteger support, doubleValue fallback)
Also includes a fix for the Comparable raw type invocation.

Issue: SPR-9913
Issue: SPR-12353
2014-10-20 17:31:03 +02:00
Andy Clement aae221cb15 Fix SpEL compilation of constructor invocation
The argument processing for compiling constructor references
was very basic and this fix removes that and ensures the
comprehensive logic written for method argument processing
(under SPR-12328) is now used for both method and constructor
argument handling. This fixes the reported issue and ensures
varargs constructor references can be compiled.

This also includes a couple of small fixes for the secondary
testcase reported in SPR-12326. The first is to ensure the
right root context object is used when it is passed
to getValue() indirectly through the evaluation context.
The final fix is to ensure correct boxing of primitives is
done when a method is called upon a primitive.

Issue: SPR-12326
2014-10-17 10:26:54 -07:00
Andy Clement 115f85e44f Enhance SpEL compilation to cover additional expression types
This change introduces support for compilation of expressions
involving inline lists, string concatenation and method
invocations where the method being invoked is declared
with a varargs parameter. It also fixes a problem with
compiling existing method invocations where the target
method is on a non public type.

Issue: SPR-12328
2014-10-16 12:08:49 -07:00
Juergen Hoeller d8160b3c09 Comprehensive revision of SpEL's bytecode generation and number handling (BigInteger support, doubleValue fallback)
Issue: SPR-9913
2014-10-06 23:29:43 +02:00
Andy Clement bd7d56ac54 Fix VerifyError for SpEL ternary compilation
The ternary expression node was failing to generate the
necessary unboxing bytecode when the condition part
of the expression returned a boxed Boolean rather than
a primitive boolean.

Also fixed here is an IllegalAccessError that was
seen in the same expression due to generating a
CHECKCAST bytecode for a private type.

Issue: SPR-12271
2014-10-01 09:26:05 -07:00
Juergen Hoeller 0cc877ad0f MethodReference accesses cached executor in a thread-safe manner
Issue: SPR-12269
2014-09-30 14:06:43 +02:00
Juergen Hoeller cfd9fd6863 Polishing 2014-09-29 17:35:23 +02:00
Juergen Hoeller c508a70c15 MethodReference accesses cached executor in a thread-safe manner
Issue: SPR-12269
2014-09-29 17:31:13 +02:00
Juergen Hoeller cc29db4c50 Polishing 2014-09-18 23:48:58 +02:00
Juergen Hoeller 7387475deb Polishing 2014-09-12 23:49:14 +02:00
Juergen Hoeller 60e58a2012 Polishing 2014-08-21 14:29:14 +02:00
Stephane Nicoll 5b1341f4b5 Fix String equality
Issue: SPR-12105
2014-08-20 17:40:36 +02:00
Stephane Nicoll 0b2c0cfb4f Fix some warning 2014-08-07 15:44:39 +02:00
Andy Clement 095bd99951 Add support for inline maps in SpEL expressions
This commit introduces the ability to specify an inline map in
an expression. The syntax is similar to inline lists and of
the form: "{key:value,key2:value}". The keys can optionally
be quoted. The documentation is also updated with information
on the syntax.

Issue: SPR-9472
2014-08-06 11:15:11 -07:00
Andy Clement 813cc3b339 Fix compilation of SpEL Indexer nodes involving map references
There is special handling for SpEL expressions involving a map
and an unquoted string literal key (e.g. mymap[key1]). SpEL does
not require key1 to be quoted. This special handling which is done
in Indexer getValueRef() was not being also done in the Indexer
generateCode() method that compiles the expression. Also fixed
a problem where the key was not being compiled in a new
sub scope. Without the new scope the key expression was failing
to reload the relevant context object when it needed it.

Issue: SPR-12045
2014-07-30 12:48:54 -07:00
Andy Clement d30174897d Support compilation of the SpEL operator OpModulus
This commit enables the modulus operator to be compiled when
it is used as part of a SpEL expression.

Issue: SPR-12041
2014-07-29 12:34:44 -07:00
Andy Clement 59080ff2b2 Cope with generic methods during SpEL compilation
This commit allows the SpEL compiler to cope with generic methods
being used in expressions involving numeric operands. Due to the
use of unbound type variables the methods may look like they
return Object but in fact they are returning objects of a numeric
type that are suitable for compilation. The changes here ensure
the runtime types are looked at if the discovered declared types
are not providing enough information. This impacts all the
operands involving numerics (mathematical and relational).

Issue: SPR-12040
2014-07-29 11:02:56 -07:00
Juergen Hoeller 4b09fcc67c Revised exitTypeDescriptor handling to avoid NPEs
Issue: SPR-12014
2014-07-22 16:24:39 +02:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Juergen Hoeller bad74dc836 Revision of SpelCompiler support, resolving a subpackage cycle through moving CodeFlow and CompilablePropertyAccessor to the main spel package
Also contains explicit ClassLoader management, passed through StandardBeanExpressionResolver and SpelParserConfiguration to SpelCompiler lookup.

Issue: SPR-10943
2014-07-16 14:41:46 +02:00
Andy Clement 2eeb2e9235 Add a compiler for SpEL
With these changes an optional compiler is added for SpEL
expressions. The compiler is off by default but can be enabled
via the SpEL parser configuration object or system property
(when SpEL is embedded and parser configuration is not possible).
Not all expressions are currently handled but the common
cases are and it is an extensible compilation framework.

Issue: SPR-10943
2014-07-10 17:49:05 +01:00
Juergen Hoeller b559f15a00 Polishing 2014-07-07 21:45:40 +02:00
Juergen Hoeller a8848cb670 TypedValue implements equals/hashCode based on value and TypeDescriptor
Issue: SPR-11960
2014-07-07 11:29:29 +02:00
Juergen Hoeller b0f0d2f289 Polishing 2014-05-15 14:39:06 +02:00
Juergen Hoeller 6cb45f714e General defensiveness about the bootstrap ClassLoader (i.e. null ClassLoader)
Issue: SPR-11721
(cherry picked from commit 59cef3c)
2014-04-28 00:47:21 +02:00
Philippe Marschall 84f6d17c7b Clean up spring-expression tests warnings
Clean up compiler warnings in the tests of spring-expression. This
commit adds type parameters to some of the types (mostly `List` and
`Map`). Some of them can't be cleaned up, some tests are even
specifically for raw types.
2014-04-22 07:30:17 +02:00
Juergen Hoeller 66bae99d86 EQ/NE do not fail in case of a Comparable mismatch and apply a specific CharSequence equality check
Issue: SPR-11708
2014-04-21 23:29:40 +02:00
Sam Brannen d9ee44cd7c Clean up warnings that show up in Gradle build 2014-04-06 16:25:28 +02:00
Juergen Hoeller 3af8a3260a Correctly resolve accessors for static properties on Class
Issue: SPR-11609
2014-03-26 21:46:38 +01:00
Stephane Nicoll 4cd818b9e4 Harmonize log configuration
Prior to this commit, the codebase was using a mix of log4j.xml
and log4j.properties for test-related logging configuration. This
can be an issue as log4j takes the xml variant first when looking
for a default bootstrap configuration.

In practice, some modules declaring the properties variant were
taking the xml variant configuration from another module.

The general structure of the configuration has also been
harmonized to provide a standard console output as well as an
easy way to enable trace logs for the current module.
2014-03-20 09:43:29 -07:00
Juergen Hoeller 4d3ca4319e Polishing 2014-03-11 22:09:46 +01:00
Juergen Hoeller 27cacf0672 SpEL property-not-found message hints at non-public method/field
Issue: SPR-11535
(cherry picked from commit eeb82c4)
2014-03-11 11:20:29 +01:00
Juergen Hoeller 40b81fcc3e SPR11348 test should use LinkedHashSet since it relies on insertion order of elements 2014-03-10 13:33:56 +01:00
Stephane Nicoll 519799e1cf Fix double SPeL evaluation of parameter
When a node of an SPeL expression was a call to a bean referenced
 in a method argument, the expression was resolved twice.

 The resolved arguments are now specified to MethodValueRef instead
 of resolving the arguments again in the constructor

 Issue: SPR-11445
2014-03-06 15:11:22 +01:00
Juergen Hoeller 2a2816dfc3 Restored proper handling of varargs in case of unresolvable type variable
Fixed through falling back to the raw parameter type in the TypeDescriptor(MethodParameter) constructor, properly detecting the vararg array even in case of an unresolvable type variable, and through restoring getElementTypeDescriptor's original behavior for arrays, i.e. always returning a non-null descriptor.

Issue: SPR-11494
2014-03-05 22:36:12 +01:00
Phillip Webb 7efd54e243 Additional caching for ResolvableTypes
Add additional caching to ResolvableTypes and SerializableTypeWrapper
in order to improve SpEL performance.

Issue: SPR-11388
2014-02-18 15:27:28 -08:00
Juergen Hoeller 14e5a02870 Mixed polishing along with recent changes 2014-02-14 21:39:40 +01:00
Sam Brannen c335e99e3f Remove trailing whitespace from source code 2014-02-08 17:30:39 +01:00
Sam Brannen 1f778530b5 Polish test classes
- Consistent importing of org.junit.Assert.*;
- Proper declaration of expected exceptions via @Test(expected).
- Renamed SpEL ExpressionTestCase to AbstractExpressionTests.
- Formatting and test method naming conventions.
2014-02-08 17:24:11 +01:00
Juergen Hoeller 426f52b393 Polishing 2014-02-06 20:35:59 +01:00
Juergen Hoeller 42db41e007 Polishing 2014-01-23 20:59:53 +01:00
Juergen Hoeller 86fc2dd556 Fixed regression in SpEL's constructor resolution
Issue: SPR-11348
2014-01-23 20:52:21 +01:00
Juergen Hoeller 6f5a7f65ac Polishing 2014-01-16 18:18:00 +01:00
Juergen Hoeller 6051ea8ae3 Polishing 2014-01-16 16:54:49 +01:00
Juergen Hoeller 838855b1aa Fixed accidental use of JDK 1.7+ Integer/Long.compare methods
Issue: SPR-11319
2014-01-16 16:54:40 +01:00
Juergen Hoeller 8da9e5466a Turned ArgumentsMatchKind and ArgumentsMatchInfo to package-visible 2014-01-15 15:28:20 +01:00
Juergen Hoeller 5d06bcec70 Fixed getTypeDifferenceWeight algorithm in ReflectionHelper, and removed unused argsRequiringConversion storage
Issue: SPR-11306
2014-01-15 13:36:50 +01:00
Juergen Hoeller 3bed6cfc7c Activated through rename to *Tests, and added method call interaction tests
Issue: SPR-7831
2014-01-03 22:11:12 +01:00
Juergen Hoeller 234272eb8f Polishing
Issue: SPR-11215
2013-12-17 21:39:40 +01:00