[jboss-jira] [JBoss JIRA] (DROOLS-3575) executable-model: compilation fails if there are multiple update() for the same object in RHS.
Hiroko Miura (Jira)
issues at jboss.org
Wed Jan 30 02:30:01 EST 2019
Hiroko Miura created DROOLS-3575:
------------------------------------
Summary: executable-model: compilation fails if there are multiple update() for the same object in RHS.
Key: DROOLS-3575
URL: https://issues.jboss.org/browse/DROOLS-3575
Project: Drools
Issue Type: Bug
Components: executable model
Affects Versions: 7.14.0.Final
Environment: - RHDM 7.2.0
Reporter: Hiroko Miura
Assignee: Luca Molteni
Attachments: HelloWorld.zip
compilation fails with the following DRL.
{noformat}
package com.sample;
//generated from Decision Table
import com.sample.Message;
// rule values at C11, header at C6
rule "HelloWorldXLS_11"
when
m:Message(status == Message.HELLO)
then
System.out.println(m.getMsg());
m.setMsg("Goodbye cruel world");update(m);
m.setStatus(Message.GOODBYE);update(m);
end
// rule values at C12, header at C6
rule "HelloWorldXLS_12"
when
m:Message(status == Message.GOODBYE)
then
System.out.println(m.getMsg());
end
{noformat}
Here is an ERROR.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile-1) on project HelloWorld: Compilation failure
[ERROR] /tmp/HelloWorld/target/generated-sources/drools-model-compiler/main/java/com/sample/Rules47274848713b466c9cc49fe299a57c35RuleMethods0.java:[76,40] variable mask_m is already defined in method rule_HelloWorldXLS__11()
and problematic source which is generated.
{noformat}
public static org.drools.model.Rule rule_HelloWorldXLS__11() {
final org.drools.model.Variable<com.sample.Message> var_m = D.declarationOf(com.sample.Message.class,
"m");
final org.drools.model.BitMask mask_m = org.drools.model.BitMask.getPatternMask(com.sample.Message.class,
"msg");
final org.drools.model.BitMask mask_m = org.drools.model.BitMask.getPatternMask(com.sample.Message.class,
"msg",
"status");
org.drools.model.Rule rule = D.rule("com.sample",
"HelloWorldXLS_11").build(D.pattern(var_m).expr("$expr$1$",
(_this) -> _this.getStatus() == Message.HELLO,
D.reactOn("status")),
D.on(var_m).execute((drools, m) -> {
System.out.println(m.getMsg());
m.setMsg("Goodbye cruel world");
drools.update(m,
mask_m);
m.setStatus(Message.GOODBYE);
drools.update(m,
mask_m);
}));
return rule;
}
{noformat}
If first update() (which is just after m.setMsg()) is removed, compilation works.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list