]
Matteo Mortari reassigned DROOLS-1215:
--------------------------------------
Assignee: Matteo Mortari (was: Mario Fusco)
import function(s) with collision on declared Pojo field names odd
behavior and no warning
------------------------------------------------------------------------------------------
Key: DROOLS-1215
URL:
https://issues.jboss.org/browse/DROOLS-1215
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 6.4.0.Final
Reporter: Matteo Mortari
Assignee: Matteo Mortari
Attachments: DROOLS-1215.zip
Hello,
not sure (yet) what is causing this odd behavior, but considering the following rule-base
in the attached reproducer, evolved from the usual kie example archetype:
{code}
global java.util.Set controlSet;
rule "will execute per each Measurement having ID color"
no-loop
when
WantToKeep( condition == "color" )
Measurement( id == "color", $colorVal : val )
then
controlSet.add($colorVal);
end
declare WantToKeep
condition : String
end
rule "kickstart"
salience 999
when
eval( true )
then
insert(new WantToKeep( "color" ));
end
{code}
This works as expected until adding the following import statement:
{code}
import function org.jooq.impl.DSL.*;
{code}
and then the test will fail.
I suspect because some "functions"/static method exists on
{{org.jooq.impl.DSL}} with name "condition" which is colliding with the declared
Pojo field name "condition", but I can't understand why this supposed
collision happens as in the LHS I'm looking for the field not a method invocation with
the {{condition()}} form.
I'm willing to investigate more on this later, for the time being I thought worthy at
least to raise this JIRA record for tracking.
I will attach reproducer and workaround in the appropriate sections.
Thank you,
Ciao,
MM