[jboss-jira] [JBoss JIRA] (JBRULES-3579) scala case class, Option field and mvel : unable to resolve method using strict-mode

david crosson (JIRA) jira-events at lists.jboss.org
Tue Jul 17 11:55:07 EDT 2012


david crosson created JBRULES-3579:
--------------------------------------

             Summary: scala case class, Option field and mvel : unable to resolve method using strict-mode
                 Key: JBRULES-3579
                 URL: https://issues.jboss.org/browse/JBRULES-3579
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: drools-compiler
    Affects Versions: 5.4.0.Final, 5.3.1.Final, 5.3.2.Final
         Environment: scala 2.9.2, java hotspot 1.6.0_33
            Reporter: david crosson
            Assignee: Mark Proctor


case class Address(street:String, town:String, country:String)
case class Home(someone:Someone, address:Option[Address]) 


rule "Who live at London"
  when
    $someone:Someone($name:name)
    Home(someone == $someone, address.isDefined, address.get.town == "London")
  then
    insert(new InformationRequest($someone, $name+" lives in London"))
end

address.get is seen as a java.lang.Object, not an "Address". The reported  error is :


$ sbt run
[info] Loading project definition from /home/dcr/dev-new/scala-drools-dummy-project/project
[info] Set current project to ScalaDroolsDummyProject (in build file:/home/dcr/dev-new/scala-drools-dummy-project/)
[info] Running dummy.Dummy 
Unable to Analyse Expression address.get.town:
[Error: unable to resolve method using strict-mode: java.lang.Object.town()]
[Near : {... address.get.town ....}]
                         ^
[Line: 61, Column: 49] : [Rule name='Who live at London']



Although I've set mvel strict to false :

    System.setProperty("drools.dialect.mvel.strict", "false")



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list