See <a id="key-val" rel="12438963" href="https://issues.jboss.org/browse/JBRULES-3064">JBRULES-3064</a>, dialect &quot;mvel&quot; flouts generic parameters.<br><br>If you omit &quot;&lt;String,Integer&gt;&quot; after &quot;new HashMap&quot; all is well. Of course, this is another MVEL bug or restriction - who knows.<br>
<br>But don&#39;t try to work around this by <br><br>then<br><span style="color: rgb(183, 0, 0);">   if</span>($u.subjectGradeMap == <span style="color: rgb(183, 0, 0);">null</span>){<br>      $u.subjectGradeMap = <span style="color: rgb(183, 0, 0);">new</span> HashMap<b>/*&lt;String,Integer&gt;*/</b>();<br>
   }<br><br>You&#39;ll just run into another MVEL bug.<br><br>-W<br><br><br><br><div class="gmail_quote">2011/8/28 Neel <span dir="ltr">&lt;<a href="mailto:neeleshdev@yahoo.co.in">neeleshdev@yahoo.co.in</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
Hi,<div>I<span style="font-family: arial,helvetica,clean,sans-serif; border-collapse: collapse; line-height: 15px;">&#39;m using drools-5.3.0.Beta1. </span>I&#39;ve following rule file:</div><div><br></div><div><p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<span style="color: rgb(183, 0, 0);">import</span> java.util.*;</p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><span style="color: rgb(183, 0, 0);"><br>
</span></p><p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;"><span style="color: rgb(183, 0, 0);">declare</span> Student</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">   name : String @key</p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">   subjectGradeMap : HashMap   </p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(183, 0, 0);">end</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 15px;"> </p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(0, 151, 0);"><span style="color: rgb(183, 0, 0);">rule</span><span style="color: rgb(0, 0, 0);"> </span>&quot;Subject grade points&quot;</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(183, 0, 0);">dialect<span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 151, 0);">&quot;mvel&quot;</span></p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(183, 0, 0);">when</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">   $u : Student()</p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(183, 0, 0);">then</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">   <span style="color: rgb(183, 0, 0);">if</span>($u.subjectGradeMap == <span style="color: rgb(183, 0, 0);">null</span>)</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">   {</p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">      $u.subjectGradeMap = <span style="color: rgb(183, 0, 0);">new</span> HashMap&lt;String,Integer&gt;();</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">   }</p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">   $u.subjectGradeMap[<span style="color: rgb(0, 151, 0);">&quot;CompSc&quot;</span>] += 100;</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal;">   System.out.println(<span style="color: rgb(0, 151, 0);">&quot;Marks added&quot;</span>);</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(183, 0, 0);">end</p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(183, 0, 0);"><br></p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(183, 0, 0);"><span style="color: rgb(0, 0, 0); font-family: arial; font-size: 13px;">I get following error while rule compilation:</span></p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(183, 0, 0);"></p><p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">
Unable to Analyse Expression if($u.subjectGradeMap == null);</p>
<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">   {</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">      $u.subjectGradeMap = new HashMap&lt;String,Integer&gt;();</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">   };</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">   $u.subjectGradeMap[&quot;CompSc&quot;] += 100;</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">   System.out.println(&quot;Marks added&quot;);:</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">[Error: was expecting type: java.lang.Object; but found type: &lt;Unknown&gt;]</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">[Near : {... if($u.subjectGradeMap == null) ....}]</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">             ^</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; color: rgb(255, 0, 0);">[Line: 1, Column: 1] : [Rule name=&#39;Subject grade points&#39;]</p>

<p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 15px;"><br></p><p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 15px;">
<span style="font-family: arial; font-size: 13px;">Please let me know if this is correct usage in the above scenario.</span></p><p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 15px;">
<span style="font-family: arial; font-size: 13px;"><br></span></p><p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 15px;">
<span style="font-family: arial; font-size: 13px;">Thanks,</span></p><p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 15px;">
<span style="font-family: arial; font-size: 13px;">Neel</span></p><font color="#888888"><p style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 15px;">
<span style="font-family: arial; font-size: 13px;"><br></span></p></font></div></td></tr></tbody></table><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>