gitgabrio commented on code in PR #6250:
URL:
https://github.com/apache/incubator-kie-drools/pull/6250#discussion_r1952923644
##########
drools-mvel/src/main/java/org/drools/mvel/ASMConditionEvaluatorJitter.java:
##########
@@ -873,16 +875,20 @@ private void jitAritmeticOperation(Class<?>
operationType, AritmeticOperator ope
try {
switch (operator) {
case ADD:
- invoke(operationType.getMethod("add",
operationType));
+ addMathContext();
Review Comment:
Hi @tkobayas , thanks for the PR.
IIUC:
1. the addMathContext() method has some kind of hidden side effect
2. the `invoke(operationType.getMethod("subtract", operationType,
MathContext.class));` need that side effect, to work.
3. this has to be replicated/duplicated for all the arithmetic operation
WOuld not be better to create a specific `invoke` methoed, to be called for
arithmetic operation, that
1. execute `mv.visitFieldInsn(GETSTATIC, "java/math/MathContext",
"DECIMAL128", "Ljava/math/MathContext;");`
2. execute ` invoke(operationType.getMethod("multiply", operationType,
MathContext.class));` (with name of operation received from parameter:)
e.g. (inside ClassGenerator)
```java
protected final void invokeArithmeticaOperation(Class<?>
operationType, String operation) throws NoSuchMethodException {
mv.visitFieldInsn(GETSTATIC, "java/math/MathContext",
"DECIMAL128", "Ljava/math/MathContext;");
invoke(operationType.getMethod("operation", operationType,
MathContext.class));
}
```
What do you think ? Does this make sense ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]