[
https://issues.jboss.org/browse/DROOLS-509?page=com.atlassian.jira.plugin...
]
Mario Fusco commented on DROOLS-509:
------------------------------------
I tried to reproduce this problem with the following test case also switching the
MvelConstraint.TEST_JITTING flag to true but it works for me and I couldn't generate
any CCE. Am I missing something?
{code}
public interface I0 {
String getValue();
}
public interface I1 extends I0 { }
public static class X implements I1 {
@Override
public String getValue() {
return "x";
}
}
public static class Y implements I1 {
@Override
public String getValue() {
return "y";
}
}
@Test
public void testMethodResolution() throws Exception {
// DROOLS-509
String drl =
"import " + I1.class.getCanonicalName() + ";\n" +
"rule R when\n" +
" I1 ( value == \"x\" )\n" +
"then\n" +
"end";
KieHelper helper = new KieHelper();
helper.addContent( drl, ResourceType.DRL );
KieSession ksession = helper.build().newKieSession();
ksession.insert(new X());
ksession.fireAllRules();
ksession.insert(new Y());
ksession.fireAllRules();
}
{code}
Constraint method is resolved erroneously when potential ambiguities
exist
--------------------------------------------------------------------------
Key: DROOLS-509
URL:
https://issues.jboss.org/browse/DROOLS-509
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 5.6.0.Final, 6.1.0.Beta4
Reporter: Davide Sottara
Assignee: Mario Fusco
Priority: Critical
Fix For: 6.1.0.CR1
Assume:
Class X implement I1
Interface I1 extends I0
I0 defines the property foo
Write a rule:
I1( foo == .. )
and insert an instance of class X
The condition analyzer will look in classes first, rather than interfaces, assuming that
"foo" is provided by X.
The next time an instance of some class Y implementing I1 is inserted,
a ClassCastException will be thrown since X is expected
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)