[rules-users] Possible bug with isA operator

Mike Melton mike.melton at gmail.com
Wed Dec 28 10:27:35 EST 2011


I am having trouble getting the isA operator to work with POJO facts.
The problem manifests in the IsAEvaluator.evaluate(...) method, line
163 (5.3.0.Final). This line checks whether the objectValue class is
annotated with @Traitable. For a @Traitable fact fully declared in
DRL, this line correctly evaluates to true. For a POJO fact which is
declared @Traitable in DRL, this line evaluates to false. (I tried
adding @Traitable to the POJO fact itself, which results in the line
evaluating true, but the next line which casts to a TraitableBean
fails.)

I have attached a test demonstrating the problem. There are two DRL
files, one which declares a fact entirely, and another which adds
@Traitable to a POJO fact. The declared fact and the POJO fact have
identical structure, and the rules are also otherwise identical.
However, the declared test passes, while the POJO test fails.

Is this a bug, or am I doing something horribly wrong? Thanks.

Mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PojoFact.java
Type: application/octet-stream
Size: 529 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20111228/ffa03f48/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TraitTest.java
Type: application/octet-stream
Size: 3135 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20111228/ffa03f48/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: declared-fact-trait-test.drl
Type: application/octet-stream
Size: 772 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20111228/ffa03f48/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pojo-fact-trait-test.drl
Type: application/octet-stream
Size: 720 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20111228/ffa03f48/attachment-0003.obj 


More information about the rules-users mailing list