[rules-users] mvel strict-mode not applied in drools 5.3.1.Final

Mark Proctor mproctor at codehaus.org
Wed Apr 4 06:51:35 EDT 2012


On 04/04/2012 11:04, korgen wrote:
> Hi folks,
> In the process of upgrading from Java 1.6 to Java 1.7 (1.7.0_03 to be
> precise) we updated Drools from 5.1.1 to 5.3.1 (as in 5.1.1 language level
> 1.7 is not supported).
>
> However with Drools 5.3.1 the system property "drools.dialect.mvel.strict"
> seems not to be applied all the time. I know this sounds fishy, but this is
> the behaviour:
MVEL strictness is only applied to explicite eval, consequence, return 
values and accumulates.

It's not applied to field constaints. We foudn some points, around 
collections, where type safeness for constraints is not enforced and 
have strengthened that. You can still get type unsafe execution, by 
using the typesfalse(false), for the specific pattern. We don't like to 
encourage lack of type safety, as it creates difficult to maintain 
systems and will not benefit from performance enhancements we do on 
bytecode generation.

Mark
>
> In a (junit based) test we create the knowledgebase by loading multiple drl
> files. Each of them has the dialect 'mvel' set in its beginning.
> In our @BeforeClass of the test we do a:
> System.setProperty("drools.dialect.mvel.strict", "false");
>
> and I also tried using a KnowledgeBuilderConfiguration with the appropriate
> settings.
> But still sometimes the test fails with a "unable to resolve method using
> strict-mode..." message. I say sometime because running the test multiple
> times via maven "mvn -Dtest=ClassicDroolsTest test" sometimes produces
> failure, sometimes produces success.
> It might by noteworthy that the method called in the test expects two
> parameters of type Double, but as it seems Drools is not seeing the
> covariant return type of the class which is actually used (the abstract base
> method has return type Object, the concrete method has return type Double).
>
> I tried to reproduce the issue with a simpler test setup to be able to post
> it here but did not succeed.
>
> I also applied the patch
> https://github.com/droolsjbpm/drools/commit/1c20018abeef8bee86f896ffff7945404cebb18f
> (comming from https://issues.jboss.org/browse/JBRULES-3163) to the Drools
> 5.1.1 sources, compiled them myself and everything works like a charm with
> it. However I cannot use this unofficial work around as I can't (and don't
> want) use a patched version of Drools in my environment.
> Also when I compile&  run my sources with jdk 1.6.0_31 everything is fine.
>
> I'd really appreciate any help on this topic as I couldn't find any hints on
> this behaviour in the release notes from Drools versions>  5.1.1
>
> Thanks
>
> Joerg
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/mvel-strict-mode-not-applied-in-drools-5-3-1-Final-tp3883669p3883669.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list