Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2244

MVEL raising errors for declared types when there is a package import (import x.y.x.*)

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    Description

      The following DRL:
      ===================================================
      package org.drools.examples.broker

      import org.drools.examples.broker.model.*;

      dialect "mvel"

      declare Statistics
      symbol : String @key()
      average : double
      end

      rule "Setup statistics"
      when
      $c : Company( $s : symbol )
      not( Statistics( symbol == $s ) )
      then
      Statistics s = new Statistics();
      s.symbol = $s;
      insert( s );
      end
      ===================================================

      Generates the error:

      -----------------------------
      BuildError: Unable to build expression for 'consequence': Failed to compile: 1 compilation error(s):

      • (1,10) unqualified type in strict mode for: Statistics ' Statistics s = new Statistics();
        s.symbol = $s;
        insert( s );
        ' broker.drl drools-examples-fusion/src/main/rules line 42 Drools Error
        -----------------------------

      But if we change the import to:
      ===================================================
      import org.drools.examples.broker.model.Company
      import org.drools.examples.broker.model.StockTick
      import org.drools.examples.broker.model.SuddenDropEvent
      ===================================================

      Everything works just fine.

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            etirelli@redhat.com Edson Tirelli
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Resolved:
              Archived:

              PagerDuty