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


##########
drools-drl/drools-drl-parser/src/main/antlr4/org/drools/drl/parser/antlr4/DRLParser.g4:
##########
@@ -198,6 +198,7 @@ drlIdentifier
     | RECORD
     | VAR
     | THIS
+    | PACKAGE

Review Comment:
   I think the original test failure 
https://github.com/apache/incubator-kie-drools/issues/5818 
`org.kie.declarativetypes.JavaBeansEventRoleTest#testImportBean` is a very 
exceptional case.
   
   ```
           String drl = "package some.other.package;\n" +
                   "import org.drools.compiler.Bean;\n" +
                   "declare Bean\n" +
                   "  @role(event)\n" +
                   "end";
   ```
   
   The test doesn't fail with the old parser, because the package 
`some.other.package` doesn't have anything to compile actually. If a user adds 
a rule to the package, it would fail on the java compilation phase. 
   
   DRL is more or less based on Java syntax, so I think, theoretically, it's 
fine to fail such a java keyword usage (which normally fails with java 
compiler) at the parse phase with the new parser (As written in #5818, 
no-error-report is another issue, though).
   
   C) Keep excluding java keywords from `drlIdentifier`
   
   It's against the policy "100% backward compatible with the old parser", but 
sounds acceptable. WDYT?
   
   (Of course, it's the tip of the iceberg. we may face a situation that we 
will need to choose option A or B in the future)



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