-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[kie-issues#969]: Negated value in accumulate function ends with Invalid expression error #5762
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @yesamer
There is a System.out.println to remove. And maybe a small refactoring/enforcement
|
||
Results results = createKieBuilder(str).getResults(); | ||
if (testRunType.isExecutableModel()) { | ||
System.out.println(results.getMessages(Message.Level.ERROR).get(0).getText()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @yesamer
Could you please remove this System.out.println ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -406,10 +414,10 @@ private boolean parameterNeedsConvertionToMethodCallExpr(Expression accumulateFu | |||
return accumulateFunctionParameter.isMethodCallExpr() || accumulateFunctionParameter.isArrayAccessExpr() || accumulateFunctionParameter.isFieldAccessExpr(); | |||
} | |||
|
|||
private Optional<NewBinding> binaryExprParameter(PatternDescr basePattern, AccumulateDescr.AccumulateFunctionCallDescr function, MethodCallExpr functionDSL, String bindingId, String accumulateFunctionParameterStr) { | |||
private Optional<NewBinding> binaryOrUnaryExprParameter(PatternDescr basePattern, AccumulateDescr.AccumulateFunctionCallDescr function, MethodCallExpr functionDSL, String bindingId, String accumulateFunctionParameterStr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @yesamer
Would it make sense to rename it as bindingParameter
or similar ?
- if, by chance, we discover that another kind of expression has to be managed here, the method name would become awfull
- usually, the method name express the returned object
- IINW, nothing prevent this method to be invoked by somehting different then a
BinaryExpr
or aUnaryExpr
(if it is implicitily so, I think there should be a check/guard somehow)
WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @yesamer LGTM!
…lid expression error (apache#5762) * Added Unary Expression management * Improved DroolsMvelParserTest * Typo * Exception message updated * Code review * Code review (cherry picked from commit 2ac36ac)
…lid expression error (apache#5762) * Added Unary Expression management * Improved DroolsMvelParserTest * Typo * Exception message updated * Code review * Code review
Closes: apache/incubator-kie-issues#969
This case leads to an
Invalid expression -$p.getAge()
error.That is because the UnaryExpression types are not managed in the
AccumulateVisitor
logic.To fix the issue, I managed that case relying on the existing BinaryExpression logic management, which fits well for the
UnaryExpression
case according to my analysis.Please correct me if I'm wrong @lucamolteni @mariofusco.
In addition, we added a check to ensure that the accumulate function always has no more than one parameter (kudos to @gitgabrio ). I added that check for the executable Model case only
How to replicate CI configuration locally?
Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use build-chain tool to handle cross repository builds and be sure that we always use latest version of the code for each repository.
build-chain tool is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See local execution details to get more information about it.
How to retest this PR or trigger a specific build:
for pull request and downstream checks
for a full downstream build
run_fdb
for Jenkins PR check only
Build Now
button.