[jboss-jira] [JBoss JIRA] Resolved: (JBRULES-2995) Field "class" not recognized in some constructs

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Thu Sep 29 11:18:26 EDT 2011


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

Edson Tirelli resolved JBRULES-2995.
------------------------------------

    Fix Version/s: 5.3.0.Final
                   5.4.0.Beta1
       Resolution: Done


This is fixed now in Drools.

Primitives( classAttr == (java.lang.String.class),
            eval(classAttr.equals( java.lang.String.class ) ),
            classAttr == String.class )


Please note that there is still a corner case where MVEL is failing to accept .class literals with fully qualified class names, but as soon as that is fixed, it will work for Drools as well. 

Pull request on the MVEL side is: https://github.com/mvel/mvel/pull/19

This fix also improves support for free form expressions. Examples of expressions that were failing and now work include:

$p1 : Person( age > 2*10, 10 < age )
$p2 : Person( age > 2*$p1.age )


> Field "class" not recognized in some constructs
> -----------------------------------------------
>
>                 Key: JBRULES-2995
>                 URL: https://issues.jboss.org/browse/JBRULES-2995
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler (expert)
>    Affects Versions: 5.2.0.CR1
>            Reporter: Wolfgang Laun
>            Assignee: Edson Tirelli
>             Fix For: 5.3.0.Final, 5.4.0.Beta1
>
>
> Given this simple type:
> declare Foo
>     clazz : Class
> end
> and this rule:
> rule yyy
> when
>        $f: Foo( $cl: clazz == ( java.lang.String.class ) )
>  ###   $f: Foo( $cl: clazz, eval( $f.getClazz().equals( java.lang.String.class ) ) )
>  ###   $f: Foo( $cl: clazz == java.lang.String.class )
> then
>     System.out.println( "--- got a " + $cl );
> end
> Only the first vyariant is accepted by the DRL parser. Other forms are
> rebuked with, e.g.:
> Unable to Analyse Expression  $f.getClazz().equals( java.lang.String.class ) :
> [Error: Failed to compile: 2 compilation error(s): 
>  - (1,24) unable to resolve method using strict-mode: ex10.Foo.java()
>  - (1,24) unqualified type in strict mode for: java]
> [Near : {... $f.getClazz().equals( java.lang.String.class ) ....}]
>                                    ^
> [Line: 1, Column: 24] : [Rule name='yyy']
> Note the incorrect line number!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list