[
http://jira.jboss.com/jira/browse/JBRULES-1053?page=all ]
Fernando Meyer closed JBRULES-1053.
-----------------------------------
Resolution: Won't Fix
Hi Eric, after some tests I noticed that in java language you can't import the same
class name twice even if the class is defined in different packages, ie try creating a
java file and import both import java.awt.List; import java.util.List; It won't work,
you will get a similar error from javac compiler
So you can try using two package builders as I did in the following example
public void testImportColision () throws Exception {
final PackageBuilder builder = new PackageBuilder();
final PackageBuilder builder2 = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream(
"nested1.drl" ) ) );
builder2.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream(
"nested2.drl" ) ) );
final Package pkg = builder.getPackage();
final Package pkg2 = builder2.getPackage();
final RuleBase ruleBase = getRuleBase();
ruleBase.addPackage( pkg );
ruleBase.addPackage( pkg2 );
final WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.insert( new FirstClass() );
workingMemory.insert( new SecondClass() );
workingMemory.insert( new FirstClass.AlternativeKey() );
workingMemory.insert( new SecondClass.AlternativeKey() );
workingMemory.fireAllRules();
}
Import collision when static inner classes of 2 different classes
have same name
--------------------------------------------------------------------------------
Key: JBRULES-1053
URL:
http://jira.jboss.com/jira/browse/JBRULES-1053
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Drl Parser/Builder
Affects Versions: 4.0.0.GA
Environment: Fedora 7, JSE 1.5.0_12, Eclipse 3.3
Reporter: Eric Miles
Assigned To: Fernando Meyer
Fix For: 4.0.1
Attachments: drools-import-collision-test.tar.gz
I have 2 drl files, each that deals with a particular class (FirstClass and SecondClass).
Both of these class have public static inner classes with the same name (AlternativeKey).
When attempting to compile these 2 DRL files together, I get an import collision error.
I am attaching a test case that is a maven and Eclipse project. There is a junit test
case written to show what happens.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira