[jboss-jira] [JBoss JIRA] (DROOLS-4374) Compilation error for "from accumulate" init() with executable-model or not

Kris Verlaenen (Jira) issues at jboss.org
Mon Aug 5 06:10:37 EDT 2019


     [ https://issues.jboss.org/browse/DROOLS-4374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kris Verlaenen updated DROOLS-4374:
-----------------------------------
    Sprint: 2019 Week 29-31, 2019 Week 32-34  (was: 2019 Week 29-31)


> Compilation error for "from accumulate" init() with executable-model or not
> ---------------------------------------------------------------------------
>
>                 Key: DROOLS-4374
>                 URL: https://issues.jboss.org/browse/DROOLS-4374
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine, executable model
>    Affects Versions: 7.24.0.Final
>            Reporter: Toshiya Kobayashi
>            Assignee: Luca Molteni
>            Priority: Minor
>              Labels: support
>
> If we miss a semicolon in init() of "from accumulate", 
> for example)
> {noformat}
> import org.drools.modelcompiler.domain.Person;
> rule R when
>   $sum : Integer() from accumulate (
>             Person( age > 18, $age : age ),
>                 init( int sum = 0 ),
>                 action( sum += $age; ),
>                 reverse( sum -= $age; ),
>                 result( sum )
>          )
> then
>   insert($sum);
> end
> {noformat}
> - Not executable-model -> The DRL is compiled and executed successfully
> - Executable-model -> Throws ParseProblemException
> {noformat}
> com.github.javaparser.ParseProblemException: (line 1,col 12) Parse error. Found "}", expected one of  "!=" "%" "%=" "&" "&&" "&=" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||"
> Problem stacktrace : 
>   com.github.javaparser.GeneratedJavaParser.generateParseException(GeneratedJavaParser.java:10567)
>   com.github.javaparser.GeneratedJavaParser.jj_consume_token(GeneratedJavaParser.java:10426)
>   com.github.javaparser.GeneratedJavaParser.BlockStatement(GeneratedJavaParser.java:3847)
>   com.github.javaparser.GeneratedJavaParser.Statements(GeneratedJavaParser.java:1644)
>   com.github.javaparser.GeneratedJavaParser.Block(GeneratedJavaParser.java:3822)
>   com.github.javaparser.GeneratedJavaParser.BlockParseStart(GeneratedJavaParser.java:5687)
>   com.github.javaparser.JavaParser.parse(JavaParser.java:115)
>   com.github.javaparser.JavaParser.parseBlock(JavaParser.java:309)
>   com.github.javaparser.StaticJavaParser.parseBlock(StaticJavaParser.java:240)
>   org.drools.modelcompiler.builder.generator.visitor.accumulate.AccumulateVisitor.visitAccInlineCustomCode(AccumulateVisitor.java:434)
>   ...
> {noformat}
> I'm not very sure how it should be fixed. I filed this because of discrepancy between Executable-model and Not executable-model
> Poosible choices are:
> - Fail even in case of Not executable-model
> - Success in case of Executable-model
> Additonal Note: If we miss a semicolon in action(), a more understandable error message is thrown.
> {noformat}
> [Message [id=1, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=2, column=0
>    text=Rule Compilation error Syntax error, insert ":: IdentifierOrNew" to complete Expression
> Syntax error, insert ";" to complete Statement]]
> {noformat}



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list