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

RH Bugzilla Integration (JIRA) jira-events at lists.jboss.org
Tue Sep 18 11:06:36 EDT 2012


    [ https://issues.jboss.org/browse/JBRULES-3579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12719526#comment-12719526 ] 

RH Bugzilla Integration commented on JBRULES-3579:
--------------------------------------------------

Radovan Synek <rsynek at redhat.com> made a comment on [bug 851443|https://bugzilla.redhat.com/show_bug.cgi?id=851443]

The described problem persists:
address.get.town == "London" throws the same exception, but rewriting this part of the rule as follows, works:
address.get().town == "London"
                
> 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.3.1.Final, 5.3.2.Final, 5.4.0.Final
>         Environment: scala 2.9.2, java hotspot 1.6.0_33
>            Reporter: david crosson
>            Assignee: Mario Fusco
>             Fix For: 5.5.0.Beta1
>
>         Attachments: scala-drools-dummy-project.tar.gz
>
>
> 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
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list