Drools
  1. Drools
  2. DROOLS-37

Operators on java.lang.Comparable object doesn't work if JIT is enable

    Details

    • Similar Issues:
      Show 10 results 

      Description

      In my application, i have rules that used org.joda.time.LocalDate to compare date like

       
      rule "toto"
      	when
      		LocalDateForDroolsTestBean(
      			infDate>=supDate
      		)
      	then
      		//Anything
      end
      

      With Drools 5.3, all works fine.

      With Drools 5.5, an exception occured because JIT optimizer automaticaly enabled:

       
      Exception in thread "main" java.lang.NoSuchMethodError: org.joda.time.LocalDate.compareTo(Lorg/joda/time/LocalDate;)I
      	at ConditionEvaluatorf8ba8fa3003345adbf3979e901488f23.evaluate(Unknown Source)
      	at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:200)
      	at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
      	at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
      	at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
      	at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
      	at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
      	at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
      	at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
      	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
      	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
      	at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
      	at org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:304)
      	at fr.jsoula.jboss.drools.bugs.comparable.ComparableBug.main(ComparableBug.java:39)
      

      After search, it seems that the bytecode generated by org.drools.rule.builder.dialect.asm.ClassGenerator can't call the method public int compareTo(Object partial) of org.joda.time.LocalDate. The parameter of the method must be the same class of the current object.

        Activity

        Hide
        Jérémy SOULA
        added a comment -

        I join a test project of this bug

        Show
        Jérémy SOULA
        added a comment - I join a test project of this bug
        Jérémy SOULA
        made changes -
        Field Original Value New Value
        Attachment drools-bugs.zip [ 12360621 ]
        Jérémy SOULA
        made changes -
        Description In my application, i have rules that used org.joda.time.LocalDate to compare date like infDate>=supDate.

        With Drools 5.3, all works fine.

        With Drools 5.5, an exception occured when JIT optimizer is enabled:
        Exception in thread "main" java.lang.NoSuchMethodError: org.joda.time.LocalDate.compareTo(Lorg/joda/time/LocalDate;)I
        at ConditionEvaluatorf8ba8fa3003345adbf3979e901488f23.evaluate(Unknown Source)
        at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:200)
        at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
        at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
        at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
        at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
        at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
        at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
        at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
        at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
        at org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:304)
        at fr.jsoula.jboss.drools.bugs.comparable.ComparableBug.main(ComparableBug.java:39)

        After search, it seems that the bytecode generated by org.drools.rule.builder.dialect.asm.ClassGenerator can't call the method public int compareTo(Object partial) of org.joda.time.LocalDate. The parameter of the method must be the same class of the current object.

        In my application, i have rules that used org.joda.time.LocalDate to compare date like infDate>=supDate.

        With Drools 5.3, all works fine.

        With Drools 5.5, an exception occured because JIT optimizer automaticaly enabled:
        Exception in thread "main" java.lang.NoSuchMethodError: org.joda.time.LocalDate.compareTo(Lorg/joda/time/LocalDate;)I
        at ConditionEvaluatorf8ba8fa3003345adbf3979e901488f23.evaluate(Unknown Source)
        at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:200)
        at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
        at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
        at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
        at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
        at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
        at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
        at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
        at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
        at org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:304)
        at fr.jsoula.jboss.drools.bugs.comparable.ComparableBug.main(ComparableBug.java:39)

        After search, it seems that the bytecode generated by org.drools.rule.builder.dialect.asm.ClassGenerator can't call the method public int compareTo(Object partial) of org.joda.time.LocalDate. The parameter of the method must be the same class of the current object.

        Jérémy SOULA
        made changes -
        Description In my application, i have rules that used org.joda.time.LocalDate to compare date like infDate>=supDate.

        With Drools 5.3, all works fine.

        With Drools 5.5, an exception occured because JIT optimizer automaticaly enabled:
        Exception in thread "main" java.lang.NoSuchMethodError: org.joda.time.LocalDate.compareTo(Lorg/joda/time/LocalDate;)I
        at ConditionEvaluatorf8ba8fa3003345adbf3979e901488f23.evaluate(Unknown Source)
        at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:200)
        at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
        at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
        at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
        at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
        at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
        at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
        at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
        at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
        at org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:304)
        at fr.jsoula.jboss.drools.bugs.comparable.ComparableBug.main(ComparableBug.java:39)

        After search, it seems that the bytecode generated by org.drools.rule.builder.dialect.asm.ClassGenerator can't call the method public int compareTo(Object partial) of org.joda.time.LocalDate. The parameter of the method must be the same class of the current object.

        In my application, i have rules that used org.joda.time.LocalDate to compare date like
        {noformat}
        rule "toto"
        when
        LocalDateForDroolsTestBean(
        infDate>=supDate
        )
        then
        //Anything
        end
        {noformat}
        With Drools 5.3, all works fine.

        With Drools 5.5, an exception occured because JIT optimizer automaticaly enabled:
        {noformat}
        Exception in thread "main" java.lang.NoSuchMethodError: org.joda.time.LocalDate.compareTo(Lorg/joda/time/LocalDate;)I
        at ConditionEvaluatorf8ba8fa3003345adbf3979e901488f23.evaluate(Unknown Source)
        at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:200)
        at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
        at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
        at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
        at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
        at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
        at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
        at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
        at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
        at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
        at org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:304)
        at fr.jsoula.jboss.drools.bugs.comparable.ComparableBug.main(ComparableBug.java:39)
        {noformat}
        After search, it seems that the bytecode generated by org.drools.rule.builder.dialect.asm.ClassGenerator can't call the method public int compareTo(Object partial) of org.joda.time.LocalDate. The parameter of the method must be the same class of the current object.

        Mario Fusco
        made changes -
        Assignee Mark Proctor [ mark.proctor ] Mario Fusco [ mfusco ]
        mariofusco <mario.fusco@gmail.com> committed 05d93592ba53123c2483b146d9aab9cc6e112ae1 (2 files)
        Reviews: none

        [DROOLS-37] fix jitting of comparison contraints (cherry picked from commit 5ea47c020451949cc52708494afdfa50799467a2)

        Mario Fusco
        made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 5.6 [ 12321055 ]
        Fix Version/s 6.0.0.Alpha1 [ 12320865 ]
        Resolution Done [ 1 ]
        Hide
        stevearoonie
        added a comment -

        I just got this error using the 5.5.1 snapshot. Looking at the source for the fix it seems as though it was around parameterized types, however joda LocalDates are not parameterized.

        Show
        stevearoonie
        added a comment - I just got this error using the 5.5.1 snapshot. Looking at the source for the fix it seems as though it was around parameterized types, however joda LocalDates are not parameterized.
        Hide
        Mario Fusco
        added a comment -

        Do you have a reproducer for this issue?

        Show
        Mario Fusco
        added a comment - Do you have a reproducer for this issue?
        Hide
        stevearoonie
        added a comment -

        I've been trying but have yet to reproduce this error in a development environment.

        Show
        stevearoonie
        added a comment - I've been trying but have yet to reproduce this error in a development environment.
        Hide
        stevearoonie
        added a comment -

        Looks like the problem was when using Joda 1.6.2. Joda 2.2 works fine.

        Show
        stevearoonie
        added a comment - Looks like the problem was when using Joda 1.6.2. Joda 2.2 works fine.

          People

          • Assignee:
            Mario Fusco
            Reporter:
            Jérémy SOULA
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: