[jboss-jira] [JBoss JIRA] (DROOLS-626) collectList on objects of type java.lang.Class get returned as null

Mario Fusco (JIRA) issues at jboss.org
Mon Oct 6 13:22:12 EDT 2014


     [ https://issues.jboss.org/browse/DROOLS-626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mario Fusco reassigned DROOLS-626:
----------------------------------

    Assignee: Mario Fusco  (was: Mark Proctor)


> collectList on objects of type java.lang.Class get returned as null
> -------------------------------------------------------------------
>
>                 Key: DROOLS-626
>                 URL: https://issues.jboss.org/browse/DROOLS-626
>             Project: Drools
>          Issue Type: Bug
>    Affects Versions: 6.2.0.Beta1
>         Environment: Snapshot Drools 6.2.0.201410031437 runtime
>            Reporter: David Fell
>            Assignee: Mario Fusco
>
> If collectList in an accumulate is supplied objects of type java.lang.Class, then subsequent examination of the supplied list yields null values rather than the expect Class values.
> Test case below. Swapping the comments to make InitClass have a String field instead of a Class field changes the behaviour of the list from collectList to what one would expect.
> package com.sample
> declare MyClass end
> declare InitClass
> 	clazz: Class @key
> //	clazz: String @key
> end
> rule "init"
> 	when
> 	then
> 		insert( new InitClass( MyClass.class ) );
> //		insert( new InitClass( "some string" ) );
> end
> rule "make init classes"
> 	when
> 		accumulate( InitClass( $clazz; ), $list: collectList( $clazz ) )
> 	then
> 		System.out.printf("%d items in list\n", $list.size());
> 		for(Object obj : $list)
> 			System.out.printf("item is %s\n", obj);
> end
> rule "show init classes"
> 	when
> 		InitClass( $v; )
> 	then
> 		System.out.printf("match %s\n", $v);
> end



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the jboss-jira mailing list