mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-19 04:45:07 -04:00
Fix painless return type cast for list shortcut (#126724)
This fixes an issue where if a Painless getter method return type didn't match a Java getter method return type we add a cast. Currentlythis is adding an extraneous cast. Closes: #70682
This commit is contained in:
parent
9d18d5280a
commit
c1ecafad6a
2 changed files with 7 additions and 2 deletions
5
docs/changelog/126724.yaml
Normal file
5
docs/changelog/126724.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
pr: 126724
|
||||
summary: Fix painless return type cast for list shortcut
|
||||
area: Infra/Scripting
|
||||
type: bug
|
||||
issues: []
|
|
@ -1465,7 +1465,7 @@ public class DefaultIRTreeToASMBytesPhase implements IRTreeVisitor<WriteScope> {
|
|||
PainlessMethod getterPainlessMethod = irDotSubShortcutNode.getDecorationValue(IRDMethod.class);
|
||||
methodWriter.invokeMethodCall(getterPainlessMethod);
|
||||
|
||||
if (getterPainlessMethod.returnType().equals(getterPainlessMethod.javaMethod().getReturnType()) == false) {
|
||||
if (getterPainlessMethod.returnType() != getterPainlessMethod.javaMethod().getReturnType()) {
|
||||
methodWriter.checkCast(MethodWriter.getType(getterPainlessMethod.returnType()));
|
||||
}
|
||||
}
|
||||
|
@ -1478,7 +1478,7 @@ public class DefaultIRTreeToASMBytesPhase implements IRTreeVisitor<WriteScope> {
|
|||
PainlessMethod getterPainlessMethod = irLoadListShortcutNode.getDecorationValue(IRDMethod.class);
|
||||
methodWriter.invokeMethodCall(getterPainlessMethod);
|
||||
|
||||
if (getterPainlessMethod.returnType() == getterPainlessMethod.javaMethod().getReturnType()) {
|
||||
if (getterPainlessMethod.returnType() != getterPainlessMethod.javaMethod().getReturnType()) {
|
||||
methodWriter.checkCast(MethodWriter.getType(getterPainlessMethod.returnType()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue