Commit Graph

227 Commits

Author SHA1 Message Date
Juergen Hoeller 214d0d76a5 Polishing 2017-02-18 01:01:35 +01:00
Juergen Hoeller 81aca78579 Delegate to common ClassUtils.getQualifiedName
Issue: SPR-15237
2017-02-10 10:53:08 +01:00
Christoph Dreis 5cfa7e71bb Use Class.getTypeName() where appropriate
Issue: SPR-15237
2017-02-08 20:36:41 +01:00
Andy Clement d41d28f8ce Fix compilation of SpEL elvis/ternary expressions
Without this fix the compiled version of elvis
actual behaved differently to the interpreted version
if the value being queried was an empty string. This
is now fixed. It also now correctly handles the
query value being a primitive and addresses the
findings of SPR-15192 where some type inferencing
logic was trying to be too clever, that code has
been deleted.

Issue: SPR-15192
2017-02-06 09:43:10 -08:00
Juergen Hoeller f84907a1fc Polishing 2017-01-31 12:00:13 +01:00
Juergen Hoeller 1b2dc3638f Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
2017-01-30 22:15:55 +01:00
Juergen Hoeller 62e530ec94 Resolve minor 4.3.x deprecations in master
Issue: SPR-15139
2017-01-16 21:43:12 +01:00
Juergen Hoeller f6fc0a86b3 Polishing
(cherry picked from commit 0028b29)
2016-12-01 20:11:47 +01:00
Juergen Hoeller 80931b211c Shared DefaultConversionService instance for simple fallback purposes
Issue: SPR-14948
2016-11-24 15:29:17 +01:00
Juergen Hoeller 14eba5034d Consistent ExpressionException-style quoting of expression string and position
Issue: SPR-14942
2016-11-24 11:08:55 +01:00
Juergen Hoeller 3e419cde7d Polishing
Issue: SPR-14863
2016-11-02 12:44:12 +01:00
Juergen Hoeller 82fa4ef274 Polishing
Issue: SPR-14863
2016-11-02 11:45:59 +01:00
Andy Clement 9000acd39d Rework compilation of OpNE/OpEQ SpEL operators
For SPR-14863 we need to adjust the code generation for OpNE
to use !x.equals(y) rather than x!=y. There are also further
cases in the equalityCheck() code in Operator that were not
being handled in the compilation case (when comparators are
used for example). This latter issue also affects OpEQ.

Rather than add yet more bytecode generation, both OpNE and
OpEQ generateCode() methods have been simplified. The
generated code now delegates to equalityCheck() in Operator
which is exactly what the interpreted case does.

This ensures that the compiled code continues to behave just
like the interpreted case. It ensures changes to the interpreted
case are automatically picked up for the compiled case. It
makes the bytecode generation simpler.

The benefit of compilation of SpEL expressions is to avoid
slow reflective calls - that doesn't apply for a basic
(in)equality test so there is no need to go crazy in bytecode
gen.

Issue: SPR-14863
2016-11-01 13:42:23 -07:00
Juergen Hoeller 45fc449550 Polishing 2016-10-31 19:24:45 +01:00
Juergen Hoeller ac80ac6f8b Consistent instanceof/casting of Class references 2016-10-30 21:40:27 +01:00
Juergen Hoeller e2b1dcbaca AccessorLValue reliably downcasts to CompilablePropertyAccessor in concurrent scenarios
Issue: SPR-14850
2016-10-28 15:15:38 +02:00
Juergen Hoeller 3726c6f18d Polishing 2016-10-21 12:26:27 +02:00
Juergen Hoeller fb7ae010c8 Avoid unnecessary generics on emptyMap/Set/List 2016-09-26 18:04:49 +02:00
Juergen Hoeller ce42ed4d44 Polishing 2016-09-13 21:58:41 +02:00
Sam Brannen d6d05e8ca0 Remove trailing whitespace in Java source code 2016-08-29 15:25:10 +02:00
Juergen Hoeller 99be15f58b Revise encoding steps towards use of JDK Charset and StandardCharsets
Issue: SPR-14492
2016-07-19 23:43:06 +02:00
Juergen Hoeller aaac199e8b Consistently use constructor-based instantiation instead of Class.newInstance / BeanUtils.instantiate
Issue: SPR-14486
2016-07-19 19:21:06 +02:00
Juergen Hoeller 6d91d54fc9 StandardTypeConverter initializes default ConversionService against volatile field
Issue: SPR-14465
2016-07-14 21:10:24 +02:00
Stephane Nicoll 2bf9bc312e Remove Guava cache support
This commit removes `GuavaCache` and support classes. Caffeine supersedes
the caching support in the Google Guava library with an actively maintained
Java 8+ version in standalone form.

As it is the only Guava feature Spring framework integrates with, this
commit removes effectively any reference to Guava.

Issue: SPR-13797
2016-07-08 10:57:05 +02:00
Juergen Hoeller a1f5fb53db Java 8 getParameterCount() instead of getParameterTypes().length
Issue: SPR-13188
2016-07-07 01:04:24 +02:00
Juergen Hoeller 39e3f2ebf6 MethodParameter supports Java 8 Executable/Parameter and validates parameter indexes
Also, equals insists on the same class now, differentiating from SynthesizingMethodParameter.

Issue: SPR-14055
Issue: SPR-13456
Issue: SPR-14438
2016-07-07 00:37:52 +02:00
Juergen Hoeller 102dc8a4dd Polishing 2016-07-06 15:29:15 +02:00
Stephane Nicoll e4b0486c5a Add @FunctionalInterface on candidate interfaces
Issue: SPR-14432
2016-07-06 14:32:13 +02:00
Sam Brannen 1391248ea6 Introduce log4j 2 for Spring's test suite
This commit adds a test runtime dependency on log4j 2 for every project
and migrates all log4j.properties files to log4j2-test.xml files.

Issue: SPR-14431
2016-07-05 19:19:09 +02:00
Stephane Nicoll 00d2606b00 Explicit type can be replaced by <>
Issue: SPR-13188
2016-07-05 17:00:34 +02:00
Juergen Hoeller 66ec1c1618 Add missing package-info files for common packages
Issue: SPR-14420
2016-06-30 21:39:06 +02:00
Andy Clement a31f0bb3c0 Fix compilation of expressions using instanceof and primitives
Prior to this commit the SpEL compiler would generate bad bytecode
if the left hand operand of an instanceof was a primitive or
if the right hand operand was a primitive type reference.
With the fixes primitives on the left hand side are now
correctly boxed and special handling is in place for when the
right hand side is a primitive type reference. Using a primitive
type reference on the right always causes the instanceof
check to return false.

Additionally a guard has been added such that compilation is
not allowed when the right hand side of an expression
is not a type reference. If it is, for example, a variable
reference that evaluates to a type reference then that
cannot be expressed in bytecode so compilation is not performed.

Issue: SPR-14250
2016-05-05 09:57:15 -07:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +02:00
Juergen Hoeller e38bfb1a68 Consistent public constructors in ast package
Issue: SPR-14181
2016-04-15 22:26:58 +02:00
Juergen Hoeller 4ae065996b Polishing
(cherry picked from commit aa5c12c)
2016-04-08 23:06:25 +02:00
Juergen Hoeller 54aeb7a5d6 Cache key classes implement Comparable and consistently provide a toString representation
Issue: SPR-14017
2016-03-26 14:32:10 +01:00
Juergen Hoeller 517ebd1d3e Consistent formatting 2016-03-24 19:22:50 +01:00
Sam Brannen 61824b1ade Remove trailing whitespace from source code 2016-02-29 18:52:57 +01:00
Juergen Hoeller 43bcab9c1a ReflectiveMethodResolver lets local static methods override java.lang.Class methods
Issue: SPR-13918
2016-02-08 13:23:02 +01:00
Andy Clement a12f23936c Allow use of '&' prefix to access factory bean in SpEL
Prior to this change SpEL did not have an syntactic
construct enabling easy access to a FactoryBean. With this
change it is now possible to use &foo in an expression when
the factory bean should be returned.

Issue: SPR-9511
2016-01-21 16:14:16 -08:00
Juergen Hoeller 21329df7e1 Polishing 2015-12-14 00:56:06 +01:00
Juergen Hoeller ef1e17fd15 Polishing 2015-12-13 01:14:38 +01:00
Juergen Hoeller 04f765506e Fine-tuned method/field access checks 2015-12-13 01:10:01 +01:00
Andy Clement a28fc760ba Fix SpEL compilation of static method/property/field operations
Before this change the compilation of a method reference or property/field
access was not properly cleaning up the stack if compilation meant
calling a static method or accessing a static field. In these cases there
is no need for a target object on the stack and it should be removed if
present. For a simple expression it is harmless since the end result of
the expression is the thing on the top of the stack, but for nested
expressions if the inner expression suffered this issue, the outer
expression can find itself operating on the wrong element.

The particular issue covered the case of a static field access but this
fix (and associated tests) cover static method, property and field access.

Issue: SPR-13781
2015-12-11 15:59:40 -08:00
Juergen Hoeller 11806b9215 Class identity comparisons wherever possible (and further polishing)
Issue: SPR-12926
2015-12-09 12:28:09 +01:00
Juergen Hoeller 8c4436926f Polishing 2015-11-26 02:09:37 +01:00
Juergen Hoeller fd84262e71 Polishing 2015-11-25 23:09:24 +01:00
Andy Clement 58756b023c Ensure cast correctly included for OpPlus compilation
When the plus operator is used between strings in a SpEL
expression and that expression is compiled, it is
important to include a cast if computation of any of
the operands isn't obviously leaving strings on the
stack. Likewise if the stack contents are known to
be strings, a cast should not be included.

Issue: SPR-12426
2015-11-24 16:35:08 -08:00
Juergen Hoeller 20a286b4d6 ASM ClassWriter uses application ClassLoader for its getCommonSuperClass check
Issue: SPR-13695
2015-11-24 17:38:02 +01:00
Juergen Hoeller 667fc7e4a9 Polishing 2015-09-04 14:38:47 +02:00