Commit Graph

483 Commits

Author SHA1 Message Date
Sam Brannen 0fb9de5d0e Merge branch '5.3.x' 2022-07-13 16:36:01 +02:00
Marc Wrobel bd3499671c Fix typos in test code
This commit fixes typos in test class names, test method names, and
test variable names.

Closes gh-28807
2022-07-13 16:24:11 +02:00
Sam Brannen 89f66ccf6a Merge branch '5.3.x'
# Conflicts:
#	spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java
2022-07-13 14:06:53 +02:00
Marc Wrobel 91258271e4 Fix and improve Javadoc in spring-expression
Closes gh-28800
2022-07-13 14:01:41 +02:00
Sam Brannen bc3b3d01ee Polishing 2022-06-01 14:57:16 +02:00
Sam Brannen ee209de9cf Merge branch '5.3.x'
# Conflicts:
#	spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java
#	spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java
#	spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolutionIntegrationTests.java
2022-05-31 14:15:36 +02:00
Sam Brannen 1beb7068f6 Use new AssertJ exception assertions 2022-05-31 14:08:28 +02:00
Sam Brannen da112a7ea8 Remove obsolete SpEL expression grammar file
The antlr-based SpEL expression grammar file (SpringExpressions.g) was
introduced during initial development and prototyping of the Spring
Expression language; however, it was quickly abandoned in favor of a
handcrafted implementation. Consequently, it has become obsolete over
time and has never been actively maintained.

This commit therefore removes the obsolete SpEL expression grammar file.

Closes gh-28425
2022-05-10 12:51:45 +02:00
Sam Brannen f692a15460 Merge branch '5.3.x' 2022-05-03 14:34:21 +02:00
Sam Brannen 4fcfa5b991 Update and simplify ArrayConstructorTests 2022-05-03 14:27:48 +02:00
Juergen Hoeller 7e1782ea22 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-core/src/main/java/org/springframework/core/convert/Property.java
2022-04-08 13:10:34 +02:00
Juergen Hoeller 4143b445d6 Polishing 2022-04-08 13:04:14 +02:00
Stephane Nicoll 890fa1145f Merge branch '5.3.x' 2022-03-27 09:57:47 +02:00
izeye 135506f672 Update copyright year of EvaluationTests
See gh-28238
2022-03-27 09:55:58 +02:00
Brian Clozel 7161940b53 Merge branch '5.3.x' 2022-03-24 13:44:38 +01:00
Sam Brannen 2c3407b0e5 Merge branch '5.3.x' 2022-03-09 11:08:36 +01:00
Sam Brannen 83ac659158 Improve diagnostics in SpEL for large array creation
Attempting to create a large array in a SpEL expression can result in
an OutOfMemoryError. Although the JVM recovers from that, the error
message is not very helpful to the user.

This commit improves the diagnostics in SpEL for large array creation
by throwing a SpelEvaluationException with a meaningful error message
in order to improve diagnostics for the user.

Closes gh-28145
2022-03-09 11:07:45 +01:00
Sam Brannen 27ee9cdcde Merge branch '5.3.x' 2022-02-28 17:18:32 +01:00
Sam Brannen 84de100fc6 Polishing 2022-02-28 17:15:43 +01:00
Sam Brannen beab8ab4e7 Test claims regarding SpEL support for T(Character)
See gh-28112
2022-02-28 17:15:43 +01:00
Sam Brannen ad3095f197 Merge branch '5.3.x' 2022-02-19 17:02:02 +01:00
Sam Brannen 84b4cebb39 Fix (@)since tag in SpelMessage
See gh-28043
2022-02-19 16:54:16 +01:00
Sam Brannen 8c6d59aaaf Polish contribution
See gh-28014
2022-02-19 14:43:26 +01:00
a.yazychyan c5c926726d Use enhanced switch expressions where feasible
Closes gh-28014
2022-02-19 14:34:05 +01:00
Sam Brannen 6c832598c9 Merge branch '5.3.x' 2022-02-18 15:32:58 +01:00
Sam Brannen 94af2ca06b Recover from error during SpEL MIXED mode compilation
Prior to this commit, SpEL was able to recover from an error that
occurred while running a CompiledExpression; however, SpEL was not able
to recover from an error that occurred while compiling the expression
(such as a java.lang.VerifyError). The latter can occur when multiple
threads concurrently change types involved in the expression, such as
the concrete type of a custom variable registered via
EvaluationContext.setVariable(...), which can result in SpEL generating
invalid bytecode.

This commit addresses this issue by catching exceptions thrown while
compiling an expression and updating the `failedAttempts` and
`interpretedCount` counters accordingly. If an exception is caught
while operating in SpelCompilerMode.IMMEDIATE mode, the exception will
be propagated via a SpelEvaluationException with a new
SpelMessage.EXCEPTION_COMPILING_EXPRESSION error category.

Closes gh-28043
2022-02-18 15:31:59 +01:00
Juergen Hoeller 3eb9886724 Merge branch '5.3.x'
# Conflicts:
#	spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java
#	spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java
#	spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java
#	spring-tx/src/main/java/org/springframework/jca/work/SimpleTaskWorkManager.java
#	spring-tx/src/main/java/org/springframework/jca/work/WorkManagerTaskExecutor.java
2022-02-04 23:24:21 +01:00
Juergen Hoeller bc9cd9a687 Find interface method even for late-bound interface declaration in subclass
Closes gh-27995
2022-02-04 23:21:27 +01:00
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