Skip to content

Commit

Permalink
Avoid unnecessary compilation attempts in SpEL's Indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Apr 19, 2024
1 parent 1eed71b commit 80fb8ea
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,11 @@ else if (target instanceof Collection<?> collection) {

@Override
public boolean isCompilable() {
if (this.exitTypeDescriptor == null) {
return false;
}
if (this.indexedType == IndexedType.ARRAY) {
return (this.exitTypeDescriptor != null && this.arrayTypeDescriptor != null);
return (this.arrayTypeDescriptor != null);
}
SpelNodeImpl index = this.children[0];
if (this.indexedType == IndexedType.LIST) {
Expand Down Expand Up @@ -792,10 +795,11 @@ public TypedValue getValue() {
this.evaluationContext, this.targetObject, this.name);
}
updatePropertyReadState(accessor, this.name, targetType);
TypedValue result = accessor.read(this.evaluationContext, this.targetObject, this.name);
if (accessor instanceof CompilablePropertyAccessor compilablePropertyAccessor) {
setExitTypeDescriptor(CodeFlow.toDescriptor(compilablePropertyAccessor.getPropertyType()));
}
return accessor.read(this.evaluationContext, this.targetObject, this.name);
return result;
}
}
}
Expand Down

0 comments on commit 80fb8ea

Please sign in to comment.