Commit Graph

455 Commits

Author SHA1 Message Date
Sam Brannen d57bc176f2 Merge branch '5.3.x' 2022-01-10 14:21:25 +01:00
Sam Brannen df263d01b9 Use idiomatic AssertJ assertions for true, false, and null 2022-01-10 14:15:55 +01:00
Sam Brannen 86387db045 Merge branch '5.3.x' 2022-01-08 17:07:34 +01:00
Sam Brannen 518dc6df65 Polishing 2022-01-08 17:06:25 +01:00
Sam Brannen 59c6b7e445 Fix SpEL withTypedRootObject() test 2022-01-08 17:06:25 +01:00
justlikeliuen 3e75ec73ab Fix SpEL withRootObject test
The test case is intended to be for the method 'withRootObject()', but
actually it's copied from the previous test method that does not use
'withRootObject()'.

This commit fixes the propertyReadWriteWithRootObject() test method in
PropertyAccessTests.

Closes gh-27905
2022-01-08 17:06:25 +01:00
Marten Deinum 941b6af9ac Use Collection factory methods when applicable
This commit replaces the use of Collections.unmodifiableList/Set/Map
with the corresponding 'of(...)' factory methods introduced in Java 9.

Closes gh-27824
2022-01-04 12:01:13 +01:00
Sam Brannen 101d92c166 Merge branch '5.3.x' 2021-12-10 13:54:50 +01:00
Sam Brannen b2e94f611f Convert single null argument to Optional.empty() in SpEL varargs expression
Prior to this commit, if a single null value was passed to a method with
a varargs array of type java.util.Optional, that null value was passed
unmodified. On the contrary, a null passed with additional values to
such a method resulted in the null being converted to Optional.empty().

This commit ensures that a single null value is also converted to
Optional.empty() for such SpEL expressions.

Closes gh-27795
2021-12-10 13:53:28 +01:00
Sam Brannen 62f480adc3 Merge branch '5.3.x' 2021-12-10 13:13:36 +01:00
Sam Brannen ad7cdc5ce9 Fix regression for null varargs in SpEL expressions
A regression was introduced in gh-27582. Specifically, when null is
supplied as the single argument for a varargs parameter in a method or
function in a SpEL expression, ReflectionHelper currently throws a
NullPointerException instead of leaving the null value unchanged.

This commit fixes this regression.

Closes gh-27719
2021-12-10 13:12:44 +01:00
Brian Clozel fab9abd7fe Polish
Closes gh-1581
2021-11-25 19:21:08 +01:00
Tin Pavlinic d178eafc11 Fix SpEL comparison operator for comparable types
Prior to this commit, the SpEL relational operators for comparison
would have the following problem:

* their implementation would claim that incompatible types
  could be compared and later fail during comparison
* not delegate the comparison to the actual `TypeComparator`
  implementation but rely on operator specifics

This commit ensures that the `TypeComparator` implementation is used for
both `canCompare` and `compare` calls in the operators.

See gh-1581
2021-11-25 19:09:52 +01:00
Juergen Hoeller 4750a9430c Early removal of 5.x-deprecated code
Closes gh-27686
2021-11-18 09:18:06 +01:00
Sam Brannen bd55f609a7 Merge branch '5.3.x' 2021-10-22 14:01:57 +02:00
Sam Brannen b728b4640b Add explicit tests for SpEL functions for fix for gh-27582 2021-10-22 13:46:11 +02:00
Sam Brannen 170d6dd5f2 Merge branch '5.3.x' 2021-10-22 13:17:59 +02:00
Sam Brannen bc657eb4d5 Fix SpEL vararg method invocation for strings containing commas
Prior to this commit, if a SpEL expression invoked a method or
registered function that declares a String varargs argument, there were
sometimes issues with converting the input arguments into the varargs
array argument. Specifically, if the expression supplied a single
String argument containing a comma for the varargs (such as "a,b"),
SpEL's ReflectionHelper.convertArguments() method incorrectly converted
that single String to an array via the ConversionService, which
indirectly converted that String using the StringToArrayConverter,
which converts a comma-delimited String to an array. Thus, "a,b"
effectively got converted to a two-dimensional array ["a", "b"] instead
of simply ["a,b"].

This commit fixes this bug by avoiding use of the TypeConverter and
ConversionService for single arguments supplied as varargs when the
single argument's type matches the varargs array component type.

Closes gh-27582
2021-10-22 13:13:13 +02:00
Sam Brannen 9b967775ed Polish Spel's ReflectionHelper.setupArgumentsForVarargsInvocation() 2021-10-22 11:08:45 +02:00
Sam Brannen 9af11ad5ce Fix Javadoc formatting issues 2021-10-22 11:08:45 +02:00
Sam Brannen 4e6ef82d8f Apply "instanceof pattern matching" in spring-expression
This commit also applies additional clean-up tasks such as the following.

- final fields

This commit also makes use of java.lang.String.repeat(int) in OptMultiply.

This has only been applied to `src/main/java`.
2021-10-14 19:46:21 +02:00
Sam Brannen 2567b20949 Upgrade to spring-javaformat 0.0.28 and downgrade to Checkstyle 8.41
In order to be able to use text blocks and other new Java language
features, we are upgrading to a recent version of Checkstyle.

The latest version of spring-javaformat-checkstyle (0.0.28) is built
against Checkstyle 8.32 which does not include support for language
features such as text blocks. Support for text blocks was added in
Checkstyle 8.36.

In addition, there is a binary compatibility issue between
spring-javaformat-checkstyle 0.0.28 and Checkstyle 8.42. Thus we cannot
use Checkstyle 8.42 or higher.

In this commit, we therefore upgrade to spring-javaformat-checkstyle
0.0.28 and downgrade to Checkstyle 8.41.

This change is being applied to `5.3.x` as well as `main` in order to
benefit from the enhanced checking provided in more recent versions of
Checkstyle.

Closes gh-27481
2021-09-28 10:29:31 +02:00
Juergen Hoeller 211f0bbf88 Fix invalid characters in source files
Closes gh-27475
2021-09-27 16:57:54 +02:00
Juergen Hoeller 0dc5d2794f Avoid early ConversionService determination in StandardBeanExpressionResolver
Closes gh-27446
2021-09-21 17:42:50 +02:00
Juergen Hoeller b8b85a6a59 Defensive handling of dimensions nullability 2021-09-14 21:49:23 +02:00
Brian Clozel cecc0849a8 Upgrade to Gradle 7.2
This commit upgrades Gradle to 7.2.
Gradle configuration names are updated accordingly.
This also upgrades Gradle build plugins.

See gh-26870
2021-09-13 09:37:35 +02:00
Syuziko eaf9deedfd Polish tests
See gh-27248
2021-08-07 18:53:47 +02:00
Stephane Nicoll 403e1f2505 Update copyright year of changed file
See gh-27102
2021-07-02 08:11:41 +02:00
diguage f39c6d36c7 Simplify Comparator using method references
See gh-27102
2021-07-02 08:10:22 +02:00
Sam Brannen a2ef6badc4 Use StringBuilder.append(char) where possible
To slightly improve performance, this commit switches to
StringBuilder.append(char) instead of StringBuilder.append(String)
whenever we append a single character to a StringBuilder.

Closes gh-27098
2021-06-25 10:44:28 +02:00
Sam Brannen 7c3a18490b Polish SpEL SelectionAndProjectionTests 2021-04-26 16:23:21 +02:00
Sam Brannen 6c3a0a9026 Polishing 2021-04-22 18:53:31 +02:00
Brandon Fergerson 432c720dd0
Allow spring-expression to be more easily repackaged
This commit allows the spring-expression module to be more easily repackaged
for embedding in third-party JARs -- for example, via the Shadow Gradle plugin.

Closes gh-26779
2021-04-09 17:29:29 +02:00
Rossen Stoyanchev 1e481cd14c Fix checkstyle violation 2021-02-03 12:12:52 +00:00
Sam Brannen 8589804012 Link to known property name constants in SpringProperties 2021-02-02 15:20:41 +01:00
Juergen Hoeller 01fb4dbeba Polishing
See gh-26237
2020-12-08 14:59:10 +01:00
fengyuanwei 07fadae27d Remove duplicate "property" in PropertyCacheKey.toString() 2020-12-08 14:49:33 +01:00
Sam Brannen 7b3f53de50 Polish SpelParserTests 2020-12-04 18:49:05 +01:00
limo520 ef05eb3729
Fix assertions in SpelParserTests.generalExpressions
Closes gh-26211

Co-authored-by: fengyuanwei <fengyuanwei@wondersgroup.com>
2020-12-04 13:59:16 +01:00
Сергей Цыпанов 83996b12cc Simplify AstUtils.getPropertyAccessorsToTry() 2020-11-16 16:11:31 +01:00
Juergen Hoeller 19911af30a Polishing 2020-11-05 19:09:58 +01:00
Juergen Hoeller 6acb091c4e Upgrade SpelCompiler bytecode level to 1.8 and optimize for concurrent access
Closes gh-26033
2020-11-05 17:44:40 +01:00
Juergen Hoeller 4e8d6bea4d Fix test code formatting 2020-11-04 16:52:11 +01:00
Juergen Hoeller 079ca80854 SpEL supports record-style accessor methods as well
Closes gh-26029
2020-11-04 16:51:54 +01:00
Sam Brannen 705cf09ad7 Merge branch '5.2.x' 2020-10-26 15:05:35 +01:00
Sam Brannen 449377908f Fix JUnit 4 to AssertJ migration bugs
The migration from JUnit 4 assertions to AssertJ assertions resulted in
several unnecessary casts from int to long that actually cause
assertions to pass when they should otherwise fail.

This commit fixes all such bugs for the pattern `.isNotEqualTo((long)`.
2020-10-26 14:53:09 +01:00
Juergen Hoeller 621295dbd8 Deprecate StringUtils.isEmpty(Object) and replace remaining usage
Closes gh-25945
2020-10-21 16:09:26 +02:00
Сергей Цыпанов 8a04910bdd Drop explicit zeroing at instantiation of Atomic* objects 2020-10-06 15:45:12 +02:00
Brian Clozel 61d893257e Rewrite "performance" test to JMH benchmarks
This commit rewrites the remaining "fastEnough" performance tests into
proper JMH benchmarks.

See gh-24830
2020-09-25 13:43:38 +02:00
Juergen Hoeller 3fd89c3ac1 Fix merge result
See gh-25706
2020-09-05 13:12:19 +02:00