jess-users  

JESS: Mysterious behavior when using Java5 enums in Jess

Jan Willem Lokin
Wed, 02 Dec 2009 08:07:07 -0800

In the JessWiki I found some info about how to use Java5 enums in
Jess. It turns out that it works OK with plain Jess facts, as
illustrated by enum2.clp in the attached archive, which produces the
output that I expect.  However, the behavior is mysteriously different
when I use shadow facts instead. In that case I get an error:

Jess reported an error in routine modify
        while executing (modify ?q (bell MyEnum.BIM))
        while executing defrule MAIN::change-to-BIM
        while executing (run).
  Message: Error setting slot value.
  Program text: ( run )  at line 23 in file enum3.clp.

Nested exception is:
Can't convert 'MyEnum.BIM' to required type pkg.MyEnum

The error disappears when I parenthesize the offending 'MyEnum.BIM',
but that still won't produce the expected output.

Any help is appreciated, since I am using Jess in a Java5 application
that makes frequent use of enums.

-+- JW -+-


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
--------------------------------------------------------------------

  • JESS: Mysterious behavior when using Java5 enums in Jess Jan Willem Lokin