Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6596

Negative BigDecimalLiteral in mvel dialect causes ClassCastException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.70.0.Final
    • 7.58.0.Final, 7.59.0.Final
    • executable model
    • None
    • 2021 Week 37-39 (from Sep 13), 2022 Week 17-19 (from Apr 25)
    • 2
    • Hide

      Unzip attached maven project.

      Run mvn clean install

      You should see the following error message

       A type incompatibility occurred while executing org.kie:kie-maven-plugin:7.58.0.Final:generateModel: class com.github.javaparser.ast.visitor.CloneVisitor cannot be cast to class org.drools.mvel.parser.ast.visitor.DrlGenericVisitor
      

      Running mvn clean install -DgenerateModel=NO does not result in that error.

      Show
      Unzip attached maven project. Run mvn clean install You should see the following error message A type incompatibility occurred while executing org.kie:kie-maven-plugin:7.58.0.Final:generateModel: class com.github.javaparser.ast.visitor.CloneVisitor cannot be cast to class org.drools.mvel.parser.ast.visitor.DrlGenericVisitor Running mvn clean install -DgenerateModel=NO does not result in that error.
    • NEW
    • NEW

    Description

      We are in the process of migrating our environment to the executable model. This is one issue that worked previously but won't work when creating the executable model.

      We are currently using drools 7.58.0 but the error also appears in 7.59.0

      Given a negative BigDecimal literal when defined in an *.drl file with mvel dialect

      package org.example;
      dialect "mvel"
      global Helper helper
      
      rule "rule 1"
      when
      then
          helper.method(-4B);
          insert("run");
      end
      

      When building the executable model

      Results in the following exception (stacktrace)

      Exception in thread "main" java.lang.ClassCastException: class com.github.javaparser.ast.visitor.CloneVisitor cannot be cast to class org.drools.mvel.parser.ast.visitor.DrlGenericVisitor (com.github.javaparser.ast.visitor.CloneVisitor and org.drools.mvel.parser.ast.visitor.DrlGenericVisitor are in unnamed module of loader 'app')
      	at org.drools.mvel.parser.ast.expr.BigDecimalLiteralExpr.accept(BigDecimalLiteralExpr.java:65)
      	at com.github.javaparser.ast.visitor.CloneVisitor.cloneNode(CloneVisitor.java:1007)
      	at com.github.javaparser.ast.visitor.CloneVisitor.visit(CloneVisitor.java:621)
      	at com.github.javaparser.ast.visitor.CloneVisitor.visit(CloneVisitor.java:38)
      	at com.github.javaparser.ast.expr.UnaryExpr.accept(UnaryExpr.java:112)
      	at com.github.javaparser.ast.visitor.CloneVisitor.visit(CloneVisitor.java:949)
      [...]
      

      Attachments

        Activity

          People

            rhn-support-tkobayas Toshiya Kobayashi
            cmartensen Christian Martensen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: