Where does it now fail?<br><br>I&#39;d assume the first part of the test (where only 1 Cheese exists) would still pass, but the second part of the test where 3 Cheeses existing in total to now fail.<br><br>Is my understanding correct?<br>
<br>Cheers,<br><br>Mike<br><br><div class="gmail_quote">On 26 May 2011 05:44, Mark Proctor <span dir="ltr">&lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


  

    
  
  <div text="#000000" bgcolor="#ffffff">
    <a href="https://issues.jboss.org/browse/JBRULES-3051" target="_blank">https://issues.jboss.org/browse/JBRULES-3051</a><br>
    <div>
      <p>Previously ALL collections where cloned when bound:</p>
      <div style="border-width: 1px;">
        <div>
          <pre><span>public</span> <span>Object</span> getNonShadowedValue(InternalWorkingMemory workingMemory,
                                      <span>final</span> <span>Object</span> object) {
        <span>Object</span> result = <span>this</span>.readAccessor.getValue( workingMemory,
                                                    object );
        <span>if</span> ( <span>this</span>.isInternalFact() &amp;&amp; result <span>instanceof</span> Collection ) {
            <span>try</span> {
                Collection newCol = (Collection) result.getClass().newInstance();
                <span>for</span> ( Iterator it = ((Collection) result).iterator(); it.hasNext(); ) {
                    <span>Object</span> element = it.next();
                    newCol.add( element );
                }
                <span>return</span> newCol;
            } <span>catch</span> ( InstantiationException e ) {
                <span>// nothing we can <span>do</span>, so just <span>return</span> the resulting object
</span>            } <span>catch</span> ( IllegalAccessException e ) {
                <span>// TODO Auto-generated <span>catch</span> block
</span>            }
        }
        <span>return</span> result;
    }</pre>
        </div>
      </div>
      <p>This was left over from shadow facts and actually still existed
        today. I have removed the code but now we have a failing test in
        FirstOrderLogicTest.testCollectResultConstraints.</p>
      <div style="border-width: 1px;">
        <div>
          <pre>rule <span>&quot;Collect Test&quot;</span> salience 70
    when
        $cheeseList  : ArrayList(size == 1) from collect( Cheese( ) );
    then
        results.add($cheeseList);
end</pre>
        </div>
      </div>
      <p>The reason why this passed before was the collection was
        cloned, so the accumulate&#39;s evaulations would not impact it. Now
        it is no longer cloned and while the rule does not fire the
        Collection is updated. I think the later is the correct
        behaviour and I&#39;ve updated the test as expected. Everyone
        agreed?<br>
      </p>
    </div>
    <br>
  </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>