yurloc commented on code in PR #5824:
URL: 
https://github.com/apache/incubator-kie-drools/pull/5824#discussion_r1551033369


##########
drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java:
##########
@@ -215,7 +215,9 @@ public TypeDeclarationDescr 
visitTypeDeclaration(DRLParser.TypeDeclarationContex
             typeDeclarationDescr.setTrait(true);
         }
         if (ctx.EXTENDS() != null) {
-            typeDeclarationDescr.addSuperType(ctx.superType.getText());
+            for (DRLParser.DrlQualifiedNameContext superType : ctx.superTypes) 
{

Review Comment:
   @gitgabrio In this case it's guaranteed for two reasons:
   1. `ctx.EXTENDS()` is not null, therefore the `extends` keyword is there and 
there has to be at least one qualified name after it as required by the grammar:
       ```
       typeDeclaration : DRL_TRAIT? name=drlQualifiedName (EXTENDS 
superTypes+=drlQualifiedName (COMMA superTypes+=drlQualifiedName)* )? 
drlAnnotation* field* ;
       ```
   2. The `superType` label is a [list 
label](https://github.com/antlr/antlr4/blob/master/doc/parser-rules.md#rule-element-labels)
 and it's initialized to an empty array list when it's declared, so it can 
never be null.



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