[jboss-jira] [JBoss JIRA] (DROOLS-42) Equality comparison between classes of different types compiles but fails at runtime

Mario Fusco (JIRA) jira-events at lists.jboss.org
Mon Feb 18 09:59:56 EST 2013


Mario Fusco created DROOLS-42:
---------------------------------

             Summary: Equality comparison between classes of different types compiles but fails at runtime
                 Key: DROOLS-42
                 URL: https://issues.jboss.org/browse/DROOLS-42
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
            Reporter: Mario Fusco
            Assignee: Mario Fusco


Below is a fully self-contained DRL that compiles correctly but runs into a runtime error when the LHS of rule "match" is evaluated. The "culprit" is the test "this != $c", but one would expect simply a true result from the comparison.

{code}
declare Person
  name: String
end
declare Customer
extends Person
  rating: int
end
declare Employee
extends Person
  wage: int
end

rule initphone
salience 100
when
then
    insert( new Customer( "Joe", 100 ) );
    insert( new Employee( "Paul", 2100 ) );
end

rule match
when
    $c: Customer()
    $e: Employee( this != $c )
then
    System.out.println( "c/e " + $c + " " + $e );
end
{code}

--
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