|
|
|
@ -76,6 +76,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Does this node represent a null-safe property or field reference? |
|
|
|
* Does this node represent a null-safe property or field reference? |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean isNullSafe() { |
|
|
|
public boolean isNullSafe() { |
|
|
|
return this.nullSafe; |
|
|
|
return this.nullSafe; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -181,7 +182,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl { |
|
|
|
throws EvaluationException { |
|
|
|
throws EvaluationException { |
|
|
|
|
|
|
|
|
|
|
|
Object targetObject = contextObject.getValue(); |
|
|
|
Object targetObject = contextObject.getValue(); |
|
|
|
if (targetObject == null && this.nullSafe) { |
|
|
|
if (targetObject == null && isNullSafe()) { |
|
|
|
return TypedValue.NULL; |
|
|
|
return TypedValue.NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -233,7 +234,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl { |
|
|
|
TypedValue contextObject, EvaluationContext evalContext, String name, @Nullable Object newValue) |
|
|
|
TypedValue contextObject, EvaluationContext evalContext, String name, @Nullable Object newValue) |
|
|
|
throws EvaluationException { |
|
|
|
throws EvaluationException { |
|
|
|
|
|
|
|
|
|
|
|
if (contextObject.getValue() == null && this.nullSafe) { |
|
|
|
if (contextObject.getValue() == null && isNullSafe()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (contextObject.getValue() == null) { |
|
|
|
if (contextObject.getValue() == null) { |
|
|
|
@ -353,7 +354,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Label skipIfNull = null; |
|
|
|
Label skipIfNull = null; |
|
|
|
if (this.nullSafe) { |
|
|
|
if (isNullSafe()) { |
|
|
|
mv.visitInsn(DUP); |
|
|
|
mv.visitInsn(DUP); |
|
|
|
skipIfNull = new Label(); |
|
|
|
skipIfNull = new Label(); |
|
|
|
Label continueLabel = new Label(); |
|
|
|
Label continueLabel = new Label(); |
|
|
|
@ -381,7 +382,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl { |
|
|
|
// If this property or field access would return a primitive - and yet
|
|
|
|
// If this property or field access would return a primitive - and yet
|
|
|
|
// it is also marked null safe - then the exit type descriptor must be
|
|
|
|
// it is also marked null safe - then the exit type descriptor must be
|
|
|
|
// promoted to the box type to allow a null value to be passed on
|
|
|
|
// promoted to the box type to allow a null value to be passed on
|
|
|
|
if (this.nullSafe && CodeFlow.isPrimitive(descriptor)) { |
|
|
|
if (isNullSafe() && CodeFlow.isPrimitive(descriptor)) { |
|
|
|
this.originalPrimitiveExitTypeDescriptor = descriptor; |
|
|
|
this.originalPrimitiveExitTypeDescriptor = descriptor; |
|
|
|
this.exitTypeDescriptor = CodeFlow.toBoxedDescriptor(descriptor); |
|
|
|
this.exitTypeDescriptor = CodeFlow.toBoxedDescriptor(descriptor); |
|
|
|
} |
|
|
|
} |
|
|
|
|