]
Mark Proctor reassigned JBRULES-3061:
-------------------------------------
Assignee: Edson Tirelli (was: Mark Proctor)
Compiler error on 5.2.0.CR1. Worked on 5.0.1
--------------------------------------------
Key: JBRULES-3061
URL:
https://issues.jboss.org/browse/JBRULES-3061
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-compiler
Affects Versions: 5.2.0.CR1
Environment: Java 5. Windows. Drools Master branch
Reporter: Joe White
Assignee: Edson Tirelli
Attachments: 3601-Test.txt
The test below can be added directly to MiscTest in drools-compiler and run to reproduce
the problem. The exception that occurs is pasted below the rule. If there is only one
check in the Person object then the rule will compile, but adding in the part with
"|| status != $inStatus" causes the exception.
######################TEST#################################
@Test
public void testMapVarCompare() {
//
String str = "";
str += "package org.drools\n";
str += "import org.drools.Person\n";
str += "import java.util.Map\n";
str += "import java.util.List\n";
str += "rule rule1 \n";
str += "when\n";
str += " $listOfMaps : List()\n";
str += " Map($inName : this['name'], $inStatus :
this['STATUS']) from $listOfMaps\n";
str += " Person( name != $inName || status != $inStatus)\n";
str += "then\n";
str += "end\n";
try {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newByteArrayResource( str.getBytes() ),
ResourceType.DRL );
if ( kbuilder.hasErrors() ) {
System.out.println(kbuilder.getErrors());
fail( "KnowledgeBuilder should not have errors" );
}
} catch ( Exception e ) {
e.printStackTrace();
fail( "Exception should not be thrown " );
}
}
################################EXCEPTION##################################################
Unable to build expression for 'inline-eval' : [Error: incompatible types in
statement: class java.lang.Object (compared from: class java.lang.String)]
[Near : {... name != $inName || status != $ ....}]
^
[Line: 1, Column: 1]'name != $inName || status != $inStatus'
[Error: incompatible types in statement: class java.lang.Object (compared from: class
java.lang.String)]
[Near : {... name != $inName || status != $ ....}]
^
[Line: 1, Column: 1] : [Rule name='rule1']
[Error: incompatible types in statement: class java.lang.Object (compared from: class
java.lang.String)]
[Near : {... name != $inName || status != $ ....}]
^
[Line: 1, Column: 1]
--
This message is automatically generated by JIRA.
For more information on JIRA, see: