InnerClass: Error creating field accessors for TypeDeclaration

132 views
Skip to first unread message

Nico Vanden

unread,
Dec 27, 2014, 9:18:58 AM12/27/14
to drools...@googlegroups.com
Hello,

This code does not compile any more since version 6.2.0.Beta2 (it works with 6.2.0.Beta1).  This occurs when I use an InnerClass.

import org.drools.compiler.test.InnerClassTest;

declare
Hero
    md
: InnerClassTest.Woman
end;

Error creating field accessors for TypeDeclaration 'Hero' for type 'Hero : Man/SuperMan'


This works with beta1 and beta2:
import org.drools.compiler.test.InnerClassTest;
import org.drools.compiler.test.InnerClassTest.Woman;

declare
Hero
    md
: Woman
end;

Here is the unit test:
    @Test
    public void testInnerClass() {

        String drl =
                "import " + InnerClassTest.class.getCanonicalName() + ";\n" +
                "\n\n" +
                "declare Hero\n" +
                "    md: InnerClassTest.Woman\n" +
                "end\n";

        
        KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        knowledgeBuilder.add( new ByteArrayResource( drl.getBytes() ),
                              ResourceType.DRL );

        System.out.println( knowledgeBuilder.getErrors().toString() );
        
        Assert.assertFalse( knowledgeBuilder.hasErrors() );
        KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase();
        kBase.addKnowledgePackages( knowledgeBuilder.getKnowledgePackages() );
        StatefulKnowledgeSession kSession = kBase.newStatefulKnowledgeSession();

        kSession.fireAllRules();
    }

It seems to be a regression.  I'm going to create a ticket in JIRA.

Nicolas-xavier

Nico Vanden

unread,
Dec 27, 2014, 9:48:36 AM12/27/14
to drools...@googlegroups.com
Here is the header of the unit test: 
public class InnerClassTest {

public class Woman {
}

Davide Sottara

unread,
Jan 2, 2015, 9:33:02 AM1/2/15
to drools...@googlegroups.com
The issue should have been fixed today
Thanks for reporting this


--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/9fe370cb-31d3-4730-ab64-4b0ebce67c56%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Nico Vanden

unread,
Jan 4, 2015, 7:25:35 AM1/4/15
to drools...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages