You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tkobayas (via GitHub)" <gi...@apache.org> on 2024/05/09 09:33:47 UTC
[I] [new-parser] ctx.lhsPattern().size() == 0 [incubator-kie-drools]
tkobayas opened a new issue, #5915:
URL: https://github.com/apache/incubator-kie-drools/issues/5915
## Parent issue
- #5678
## Failing tests
- `org.drools.mvel.integrationtests.AnnotationsTest#testAnnotationOnLHSAndMerging`
- `org.drools.compiler.integrationtests.drl.DRLTest#testWithInvalidRule2`
- `org.drools.mvel.compiler.lang.DRLIncompleteCodeTest#testIncompleteCode2`
- `org.drools.mvel.compiler.lang.DRLIncompleteCodeTest#testIncompleteCode12`
- `org.drools.mvel.integrationtests.ExtendsTest#testExtendsBasic`
## Rule code snippet
```
rule "test collect with annotation"
when
( and @Annot
String()
Integer() )
then
end
```
Generally, the issue is that DRLVisitorImpl doesn't accept 0 size lhsPattern(). But each test may has its own issue (e.g. AnnotationsTest seems to have an annotation parsing issue)
## Error output
```
line 1:156 no viable alternative at input '( and @'
line 1:200 extraneous input ')' expecting 'then'
17:19:10.863 [main] ERROR o.d.d.parser.antlr4.DRLParserWrapper.parse:77 - Exception while creating PackageDescr
java.lang.IllegalStateException: ctx.lhsPattern().size() == 0 :
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsPatternBind(DRLVisitorImpl.java:545)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsPatternBind(DRLVisitorImpl.java:83)
at org.drools.drl.parser.antlr4.DRLParser$LhsPatternBindContext.accept(DRLParser.java:2660)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1075)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:1062)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:83)
at org.drools.drl.parser.antlr4.DRLParser$LhsUnaryContext.accept(DRLParser.java:2476)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
at org.drools.drl.parser.antlr4.DRLParserBaseVisitor.visitLhsUnarySingle(DRLParserBaseVisitor.java:201)
at org.drools.drl.parser.antlr4.DRLParser$LhsUnarySingleContext.accept(DRLParser.java:2108)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1075)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhs(DRLVisitorImpl.java:532)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitRuledef(DRLVisitorImpl.java:340)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitRuledef(DRLVisitorImpl.java:83)
at org.drools.drl.parser.antlr4.DRLParser$RuledefContext.accept(DRLParser.java:1664)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1075)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDrlStatementdef(DRLVisitorImpl.java:166)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDrlStatementdef(DRLVisitorImpl.java:83)
at org.drools.drl.parser.antlr4.DRLParser$DrlStatementdefContext.accept(DRLParser.java:523)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1075)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:102)
at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:83)
at org.drools.drl.parser.antlr4.DRLParser$CompilationUnitContext.accept(DRLParser.java:435)
at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at org.drools.drl.parser.antlr4.DRLParserHelper.compilationUnitContext2PackageDescr(DRLParserHelper.java:91)
at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:75)
at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:55)
at org.drools.drl.parser.DrlParser.lambda$parse$2(DrlParser.java:191)
at org.drools.drl.parser.DrlParser.compileWithAntlr4Parser(DrlParser.java:204)
at org.drools.drl.parser.DrlParser.parse(DrlParser.java:191)
at org.drools.drl.parser.DrlParser.parse(DrlParser.java:179)
at org.drools.drl.parser.DrlParser.parse(DrlParser.java:168)
at org.drools.compiler.builder.impl.resources.DrlResourceHandler.process(DrlResourceHandler.java:55)
at org.drools.compiler.builder.impl.PackageDescrBuilder.buildResource(PackageDescrBuilder.java:73)
at org.drools.compiler.builder.impl.PackageDescrBuilder.build(PackageDescrBuilder.java:51)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackageDescr(CompositeKnowledgeBuilderImpl.java:173)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:116)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:109)
at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:274)
at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:220)
at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:84)
at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:285)
at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:251)
at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:208)
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:149)
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:134)
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromResources(KieUtil.java:121)
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromDrls(KieUtil.java:107)
at org.drools.compiler.integrationtests.AnnotationsTest.testAnnotationOnLHSAndMerging(AnnotationsTest.java:297)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
17:19:10.863 [main] ERROR o.d.c.k.b.impl.AbstractKieProject.buildKnowledgePackages:280 - Unable to build KieBaseModel:KieBaseModelName
[1,156]: no viable alternative at input '( and @'
[1,200]: extraneous input ')' expecting 'then'
[0,0]:
[0,0]: Parser returned a null Package
```
--
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: commits-unsubscribe@kie.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] [new-parser] ctx.lhsPattern().size() == 0 [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on issue #5915:
URL: https://github.com/apache/incubator-kie-drools/issues/5915#issuecomment-2102303997
`/take`
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] [new-parser] ctx.lhsPattern().size() == 0 [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on issue #5915:
URL: https://github.com/apache/incubator-kie-drools/issues/5915#issuecomment-2104209825
@yurloc I removed the `IllegalStateException: ctx.lhsPattern().size() == 0` by https://github.com/apache/incubator-kie-drools/pull/5922
But `DRLIncompleteCodeTest` has remaining errors/failures. I filed https://github.com/apache/incubator-kie-drools/issues/5924 for that.
Now all "Failing tests" in the first description are solved or associated with other issues.
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] [new-parser] ctx.lhsPattern().size() == 0 [incubator-kie-drools]
Posted by "yurloc (via GitHub)" <gi...@apache.org>.
yurloc commented on issue #5915:
URL: https://github.com/apache/incubator-kie-drools/issues/5915#issuecomment-2102817850
> Generally, the issue is that DRLVisitorImpl doesn't accept 0 size lhsPattern(). But each test may have its own issue (e.g. AnnotationsTest seems to have an annotation parsing issue)
I confirm that.
- `org.drools.mvel.integrationtests.AnnotationsTest#testAnnotationOnLHSAndMerging` (#5918)
- and `org.drools.mvel.integrationtests.ExtendsTest#testExtendsBasic` (#5917)
are not the best examples as they test correct DRL sources and fail due to parser issues. Once we fix the parser grammar, the visitor will be able to traverse the contexts smoothly.
However, the other failing tests are good examples because they test invalid or incomplete DRL sources that do not have a completely parsed LHS. The visitor must be resilient to that and must not throw an exception.
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] [new-parser] ctx.lhsPattern().size() == 0 [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on issue #5915:
URL: https://github.com/apache/incubator-kie-drools/issues/5915#issuecomment-2104034204
Thank you, @yurloc . I'm working on https://github.com/apache/incubator-kie-drools/issues/5918 now
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] [new-parser] ctx.lhsPattern().size() == 0 [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas closed issue #5915: [new-parser] ctx.lhsPattern().size() == 0
URL: https://github.com/apache/incubator-kie-drools/issues/5915
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] [new-parser] ctx.lhsPattern().size() == 0 [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on issue #5915:
URL: https://github.com/apache/incubator-kie-drools/issues/5915#issuecomment-2106928470
Fixed by https://github.com/apache/incubator-kie-drools/pull/5922
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org