[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1172) In nested accessors "this" keyword is required in front

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Thu Sep 6 15:44:11 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBRULES-1172?page=comments#action_12375772 ] 
            
Edson Tirelli commented on JBRULES-1172:
----------------------------------------

Sergey,

I added the following integration test into the code base, but was not able to reproduce the problem you reported:

https://svn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_NestedAccessors.drl

The code to execute it is in org.drools.integrationtests.MiscTest.java:

    public void testNestedAccessors() throws Exception {
        final PackageBuilder builder = new PackageBuilder();
        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NestedAccessors.drl" ) ) );

        final RuleBase ruleBase = getRuleBase();
        ruleBase.addPackage( builder.getPackage() );

        final WorkingMemory workingMemory = ruleBase.newStatefulSession();

        final List list = new ArrayList();
        workingMemory.setGlobal( "results",
                                 list );

        final Order order1 = new Order( 11, "Bob" );
        final OrderItem item11 = new OrderItem( order1, 1 );
        final OrderItem item12 = new OrderItem( order1, 2 );
        order1.addItem( item11 );
        order1.addItem( item12 );
        
        workingMemory.insert( order1 );
        workingMemory.insert( item11 );
        workingMemory.insert( item12 );
        
        workingMemory.fireAllRules();
        
        assertEquals( 0,
                      list.size() );
        
        final Order order2 = new Order( 12, "Mark" );
        Order.OrderStatus status = new Order.OrderStatus();
        status.setActive( true );
        order2.setStatus( status );
        final OrderItem item21 = new OrderItem( order2, 1 );
        final OrderItem item22 = new OrderItem( order2, 2 );
        order1.addItem( item21 );
        order1.addItem( item22 );
        
        workingMemory.insert( order2 );
        workingMemory.insert( item21 );
        workingMemory.insert( item22 );
        
        workingMemory.fireAllRules();
        
        assertEquals( 2,
                      list.size() );
        assertSame( item21,
                    list.get( 0 ) );
        assertSame( item22,
                    list.get( 1 ) );
    }

I'll close the ticket, but if you still see the problem, can you please re-open the ticket and attach a test case showing the problem?

Thank you


> In nested accessors "this" keyword is required in front
> -------------------------------------------------------
>
>                 Key: JBRULES-1172
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-1172
>             Project: JBoss Rules
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 4.0.1
>         Environment: Wintel XP SP2
>            Reporter: Sergey Manukyan
>         Assigned To: Edson Tirelli
>             Fix For: 4.0.2
>
>
> Nested accessors when used without "this" in front result in compilation error:
> f.e. this FAILS:
> when
>       Supplier(supplierBusinessStatus.businessStatus.statusActive == true)
> this rule works OK  (this in front):
> when
>       Supplier(this.supplierBusinessStatus.businessStatus.statusActive == true)

-- 
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

        



More information about the jboss-jira mailing list