简体   繁体   中英

Compilation error in nested casting inside a rule in drools

I am using the # operator, and while with one casting it works fine, having two in the same rule it does not compile. The sentence is the following

configuration#RuleSetConfiguration.configurationRule[0].configurationRuleAction#FilteringAction.filteringActionType==$mspl1.configuration#RuleSetConfiguration.configurationRule[0].configurationRuleAction#FilteringAction

And it returns the following compilation error:

[ERR 102] Line 62:87 mismatched input '#' in rule "verify_same_filtering_l4_behaviour" [Message [id=1, kieBase=rules, level=ERROR, path=/home/santiago/eclipse-workspace/DroolKieServer/target/classes/com/sample/rules/Rule.drl, line=62, column=0 text=[ERR 102] Line 62:87 mismatched input '#' in rule "verify_same_filtering_l4_behaviour"], Message [id=2, kieBase=rules, level=ERROR, path=/home/santiago/eclipse-workspace/DroolKieServer/target/classes/com/sample/rules/Rule.drl, line=0, column=0 text=Parser returned a null Package]]

I have tried to use brackets but the result is the same. Is there a limitation on the castings that can be done over a rule?

Greetings

I tried to do two castings in the rule. The expected result is to compile fine due to the use of the # operator is correct, but it returns the compilation error

`

[Message [id=1, kieBase=rules, level=ERROR, path=/home/santiago/eclipse-workspace/DroolKieServer/target/classes/com/sample/rules/Rule.drl, line=62, column=0
   text=[ERR 102] Line 62:87 mismatched input '#' in rule "verify_same_filtering_l4_behaviour"], Message [id=2, kieBase=rules, level=ERROR, path=/home/santiago/eclipse-workspace/DroolKieServer/target/classes/com/sample/rules/Rule.drl, line=0, column=0
   text=Parser returned a null Package]]

`

The problem was about using the # operator after a list. Instead of that,the standard java casting have being used and it works fine:

((FilteringAction)((RuleSetConfiguration)configuration).configurationRule[0].configurationRuleAction) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM