Merge branch '6.1.x'

# Conflicts:
#	spring-core/src/main/java/org/springframework/core/CoroutinesUtils.java
This commit is contained in:
Juergen Hoeller
2024-03-19 10:06:48 +01:00
58 changed files with 322 additions and 253 deletions

View File

@@ -232,7 +232,7 @@ public class ConstructorReference extends SpelNodeImpl {
InlineList initializer = (InlineList) getChild(1);
sb.append("[] ").append(initializer.toStringAST());
}
else {
else if (this.dimensions != null) {
// new int[3], new java.lang.String[3][4], etc.
for (SpelNodeImpl dimension : this.dimensions) {
sb.append('[').append(dimension.toStringAST()).append(']');

View File

@@ -242,7 +242,9 @@ public class Indexer extends SpelNodeImpl {
SpelNodeImpl index = this.children[0];
if (this.indexedType == IndexedType.ARRAY) {
int insn = switch (this.exitTypeDescriptor) {
String exitTypeDescriptor = this.exitTypeDescriptor;
Assert.state(exitTypeDescriptor != null, "Array not compilable without descriptor");
int insn = switch (exitTypeDescriptor) {
case "D" -> {
mv.visitTypeInsn(CHECKCAST, "[D");
yield DALOAD;
@@ -278,8 +280,8 @@ public class Indexer extends SpelNodeImpl {
yield CALOAD;
}
default -> {
mv.visitTypeInsn(CHECKCAST, "["+ this.exitTypeDescriptor +
(CodeFlow.isPrimitiveArray(this.exitTypeDescriptor) ? "" : ";"));
mv.visitTypeInsn(CHECKCAST, "["+ exitTypeDescriptor +
(CodeFlow.isPrimitiveArray(exitTypeDescriptor) ? "" : ";"));
yield AALOAD;
}
};

View File

@@ -55,7 +55,7 @@ class Token {
* @param startPos the exact start position
* @param endPos the index of the last character
*/
Token(TokenKind tokenKind, char[] tokenData, int startPos, int endPos) {
Token(TokenKind tokenKind, @Nullable char[] tokenData, int startPos, int endPos) {
this.kind = tokenKind;
this.data = (tokenData != null ? new String(tokenData) : null);
this.startPos = startPos;

View File

@@ -303,7 +303,8 @@ public abstract class ReflectionHelper {
TypeDescriptor sourceType = TypeDescriptor.forObject(argument);
if (argument == null) {
// Perform the equivalent of GenericConversionService.convertNullSource() for a single argument.
if (targetType.getElementTypeDescriptor().getObjectType() == Optional.class) {
TypeDescriptor elementDesc = targetType.getElementTypeDescriptor();
if (elementDesc != null && elementDesc.getObjectType() == Optional.class) {
arguments[varargsPosition] = Optional.empty();
conversionOccurred = true;
}
@@ -391,7 +392,8 @@ public abstract class ReflectionHelper {
TypeDescriptor sourceType = TypeDescriptor.forObject(argument);
if (argument == null) {
// Perform the equivalent of GenericConversionService.convertNullSource() for a single argument.
if (varArgContentType.getElementTypeDescriptor().getObjectType() == Optional.class) {
TypeDescriptor elementDesc = varArgContentType.getElementTypeDescriptor();
if (elementDesc != null && elementDesc.getObjectType() == Optional.class) {
arguments[varargsPosition] = Optional.empty();
conversionOccurred = true;
}
@@ -416,7 +418,6 @@ public abstract class ReflectionHelper {
}
// Otherwise, convert remaining arguments to the varargs element type.
else {
Assert.state(varArgContentType != null, "No element type");
for (int i = varargsPosition; i < arguments.length; i++) {
Object argument = arguments[i];
arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), varArgContentType);