[
https://issues.redhat.com/browse/DROOLS-6032?page=com.atlassian.jira.plug...
]
Toshiya Kobayashi edited comment on DROOLS-6032 at 2/16/21 4:21 AM:
--------------------------------------------------------------------
Thanks [~lucamolteni] , I took a look at the patch and I agree that it would be easier if
we can remove FLOW first. I think it's okay to change the fact class name
"D" to "X" (or whatever) as a workaround in the meantime so this JIRA
is not urgent.
Btw, the linked PR (
https://github.com/kiegroup/drools/pull/3385) is not a fix of this
issue so please ignore it (just mentioned this JIRA in a commit message)
was (Author: tkobayashi):
Thanks [~lucamolteni] , I took a look at the patch and I agree that it would be easier if
we can remove FLOW first. I think it's okay to change "D" to "X"
(or whatever) as a workaround in the meantime so this JIRA is not urgent.
Btw, the linked PR (
https://github.com/kiegroup/drools/pull/3385) is not a fix of this
issue so please ignore it (just mentioned this JIRA in a commit message)
Class name conflict by class "D" in exec-model
----------------------------------------------
Key: DROOLS-6032
URL:
https://issues.redhat.com/browse/DROOLS-6032
Project: Drools
Issue Type: Bug
Components: executable model
Affects Versions: 7.50.0.Final
Reporter: Toshiya Kobayashi
Assignee: Toshiya Kobayashi
Priority: Major
Attachments: FQN_first_draft,_uses_static_fields.patch
If you use a fact class named "D", you will hit errors during executable-model
code generation.
{code:java}
@Test
public void testClassNameConflict() {
String str =
"import " + D.class.getCanonicalName() + ";" +
"rule R when\n" +
" D(name == \"John\")\n" +
"then\n" +
"end";
KieSession ksession = getKieSession( str );
D fact = new D("John");
ksession.insert( fact );
assertEquals(1, ksession.fireAllRules());
}
public static class D {
private String name;
public D(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
{code}
{noformat}
[ERROR]
CompilerTest.testClassNameConflict:2573->BaseModelTest.getKieSession:111->BaseModelTest.getKieSession:115->BaseModelTest.getKieContainer:119->BaseModelTest.getKieContainer:126->BaseModelTest.createKieBuilder:137->BaseModelTest.createKieBuilder:164
[Message [id=1, level=ERROR,
path=src/main/java/defaultpkg/RulesF625E96E2F948CA04652DBAC4C6DBB79.java, line=5,
column=1
text=a type with the same simple name is already defined by the single-type-import of
org.drools.modelcompiler.dsl.pattern.D], Message [id=2, level=ERROR,
path=src/main/java/defaultpkg/RulesF625E96E2F948CA04652DBAC4C6DBB79.java, line=0,
column=0
text=Java source of
src/main/java/defaultpkg/RulesF625E96E2F948CA04652DBAC4C6DBB79.java in error:
package defaultpkg;
import org.drools.modelcompiler.dsl.pattern.D;
import org.drools.model.Index.ConstraintType;
import org.drools.modelcompiler.CompilerTest.D;
...
{noformat}
--
This message was sent by Atlassian Jira
(v8.13.1#813001)