tkobayas commented on code in PR #5921:
URL: 
https://github.com/apache/incubator-kie-drools/pull/5921#discussion_r1596367071


##########
drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java:
##########
@@ -1032,7 +1038,13 @@ private BaseDescr createAndDescr(ParserRuleContext ctx) {
             //  B()  C()
             // So, we need to flatten it so that AndDescr has A(), B() and C() 
as children.
             List<BaseDescr> flattenedDescrs = flattenAndDescr(descrList);
-            flattenedDescrs.forEach(andDescr::addDescr);
+            flattenedDescrs.forEach(descr -> {
+                if (descr instanceof AnnotationDescr annotationDescr) {
+                    andDescr.addAnnotation(annotationDescr);
+                } else {
+                    andDescr.addDescr(descr);
+                }
+            });

Review Comment:
   I know there is a duplication in this part and the above one (`visitLhsOr`). 
But `addDescr` method is not defined in a common parent class of `AndDescr` and 
`OrDescr`, so I cannot refactor them to a reusable clean private method. 
(Changing Descr class hierarchy sounds also too much).



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