Rikkola commented on code in PR #7160:
URL: https://github.com/apache/incubator-kie/pull/7160#discussion_r4193224790


##########
drools-model/drools-canonical-model/src/main/java/org/drools/model/impl/ViewPatternBuilder.java:
##########
@@ -185,7 +185,34 @@ public static Condition ruleItem2Condition(RuleItem 
ruleItem) {
 
         if (ruleItem instanceof SequenceViewItem) {
             SequenceViewItem sv = (SequenceViewItem) ruleItem;
-            List<Condition> steps = Arrays.stream(sv.getSteps())
+            org.drools.model.SequenceStep[] rawSteps = 
rewriteXorSteps(sv.getSteps());
+            if (rawSteps.length > 0) {
+                org.drools.model.SequenceStep last = rawSteps[rawSteps.length 
- 1];
+                if (last instanceof ExistentialExprViewItem) {
+                    ExistentialExprViewItem ex = (ExistentialExprViewItem) 
last;
+                    if (ex.getType() == Condition.Type.NOT) {
+                        throw new IllegalArgumentException(
+                            "sequence(): trailing not() or nor() requires a 
following positive step " +
+                            "or a completeWithin(...) deadline. " +
+                            "Trailing absence with completeWithin is planned 
but not yet implemented. " +
+                            "See ADR 0002.");
+                    }
+                }
+                if (last instanceof CombinedExprViewItem) {
+                    CombinedExprViewItem comb = (CombinedExprViewItem) last;
+                    if (comb.getType() == Condition.Type.NOT
+                            || comb.getType() == Condition.Type.NOR
+                            || comb.getType() == Condition.Type.XOR
+                            || comb.getType() == Condition.Type.XNOR) {

Review Comment:
   Fixed



-- 
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]

Reply via email to