You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "yurloc (via GitHub)" <gi...@apache.org> on 2024/04/15 10:59:06 UTC
[I] [new-parser] Annotation with empty parentheses parsed incorrectly [incubator-kie-drools]
yurloc opened a new issue, #5846:
URL: https://github.com/apache/incubator-kie-drools/issues/5846
## Parent issue
- #5678
## Failing tests
- `org.drools.traits.compiler.factmodel.traits.TraitMapCoreTest#testMapCoreAliasing`
## Notes
## Rule code snippet
```
declare HashMap @Traitable() end
```
## Error output
```
### parse : ANTLR4_PARSER_ENABLED = true
java.lang.AssertionError: Annotated type java.util.HashMap - undefined property in @annotation Traitable: org.drools.base.factmodel.traits.Traitable.value();
New declaration of java.util.HashMap can't declare a different set of fields
existing : []
declared : [eta, height, sen]
diff : [++eta, ++height, ++sen]
Unknown annotation property value
Unable to process type HashMap
Unable to resolve ObjectType 'PersonMap' : [Rule name='Log']
Rule Compilation error : [Rule name='Don']
PersonMap cannot be resolved to a type
Rule Compilation error : [Rule name='Log']
$p cannot be resolved to a variable
The method setHeight(double) is undefined for the type Object
The method setEta(int) is undefined for the type Object
at org.drools.traits.compiler.CommonTraitTest.loadKnowledgeBaseFromString(CommonTraitTest.java:49)
at org.drools.traits.compiler.factmodel.traits.TraitMapCoreTest.testMapCoreAliasing(TraitMapCoreTest.java:305)
```
--
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] Annotation with empty parentheses parsed incorrectly [incubator-kie-drools]
Posted by "yurloc (via GitHub)" <gi...@apache.org>.
yurloc commented on issue #5846:
URL: https://github.com/apache/incubator-kie-drools/issues/5846#issuecomment-2056573226
Quick explanation. The current `chunk` rule is too greedy:
```
drlAnnotation : AT name=drlQualifiedName (LPAREN ( drlElementValuePairs | drlElementValue | chunk )? RPAREN)? ;
chunk : .+?;
```
It eats everything until the very last `)` in the input.
The old parser does it the right way:
1. It first uses the expression parsers to treat the annotation as a full Java annotation.
2. Only if that is unsuccessful it uses a _clever_ chunking method that takes left and right delimiters (`(`, `)` in this case) and _supports nesting_. Anyway, the expression parser should work for most cases including this one, so the chunking method should only be needed rarely.
Might be better to do it after #5808.
--
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] Annotation with empty parentheses parsed incorrectly [incubator-kie-drools]
Posted by "yurloc (via GitHub)" <gi...@apache.org>.
yurloc commented on issue #5846:
URL: https://github.com/apache/incubator-kie-drools/issues/5846#issuecomment-2068038072
`/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] Annotation with empty parentheses parsed incorrectly [incubator-kie-drools]
Posted by "yurloc (via GitHub)" <gi...@apache.org>.
yurloc closed issue #5846: [new-parser] Annotation with empty parentheses parsed incorrectly
URL: https://github.com/apache/incubator-kie-drools/issues/5846
--
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