All field constraints should start with a field name. Thus it should always be<br>   X( state == X,State.INIT )<br><br>There are some possibilities for using qualified names on the left of a relational operator,<br>but they are (mostly) intended to let you access fields via variables bound to objects.<br>
<br>-W<br><br><br><div class="gmail_quote">On 7 April 2011 09:38, Hezi Stern <span dir="ltr">&lt;<a href="mailto:hezis@delegatecom.com">hezis@delegatecom.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal">Hi All,</p><p class="MsoNormal"> </p><p class="MsoNormal">I believe that I have encountered two potential bugs (Expert), I am using Drools 5.1.1.</p><p class="MsoNormal">
It seems that they are related to namespaces and inner classes in particularly.  </p><p class="MsoNormal"> </p><p class="MsoNormal">I have a class with an internal inner class (enum):</p><p class="MsoNormal"> </p><p class="MsoNormal">
public class X {</p><p class="MsoNormal"> </p><p class="MsoNormal" style="margin-left: 0.5in;">public enum State {</p><p class="MsoNormal" style="margin-left: 0.5in;">                INIT,</p><p class="MsoNormal" style="margin-left: 0.5in; text-indent: 0.5in;">
DONE;</p><p class="MsoNormal" style="margin-left: 0.5in;">}</p><p class="MsoNormal"> </p><p class="MsoNormal">                Private State state;         </p><p class="MsoNormal">}</p><p class="MsoNormal"> </p><p class="MsoNormal">
In the DRL file I would import the class X (e.g. import com.stub.X)</p><p class="MsoNormal">And in the LHS of the rule I could state something like</p><p class="MsoNormal"> </p><p class="MsoNormal">$x:          X(X.State.INIT == state)</p>
<p class="MsoNormal"> </p><p class="MsoNormal">As far as I understand this is a legal syntax, the problem is that I get the following exception: “<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">Exception executing predicate X.State.INIT == state”</span> </p>
<p class="MsoNormal">I found that I can work around this by importing com.stub.X.State and changing the LHS rule to </p><p class="MsoNormal">$x:          X(State.INIT == state)</p><p class="MsoNormal"> </p><p class="MsoNormal">
This brings me to the second issue. If I have an additional class let’s say </p><p class="MsoNormal"> </p><p class="MsoNormal">public class Y {</p><p class="MsoNormal"> </p><p class="MsoNormal" style="margin-left: 0.5in;">
public enum State {</p><p class="MsoNormal" style="margin-left: 0.5in;">                ALIVE,</p><p class="MsoNormal" style="margin-left: 0.5in; text-indent: 0.5in;">TERMINATED;</p><p class="MsoNormal" style="margin-left: 0.5in;">
}</p><p class="MsoNormal"> </p><p class="MsoNormal">                Private State state;         </p><p class="MsoNormal">}</p><p class="MsoNormal"> </p><p class="MsoNormal">In this case importing both classes using the workaround above, hence:</p>
<p class="MsoNormal">import com.stub.X.State</p><p class="MsoNormal">import com.stub.Y.State</p><p class="MsoNormal">result in an import collision with the State class so it is kind of a deadlock situation.</p><p class="MsoNormal">
 </p><p class="MsoNormal">I can always overcome this by changing the names of the inner classes (which is what I am currently doing) but I thought it would be helpful to state this.</p><p class="MsoNormal">Perhaps this is not a bug but rather something I am doing wrong.</p>
<p class="MsoNormal"> </p><font color="#888888"><p class="MsoNormal">Hezi </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p></font></div>
</div><br>_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br></blockquote></div><br>