[jboss-jira] [JBoss JIRA] (DROOLS-1397) Drools condition cannot retrieve object from Map with Enum key

Mario Fusco (JIRA) issues at jboss.org
Thu Jan 5 04:53:00 EST 2017


    [ https://issues.jboss.org/browse/DROOLS-1397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13343523#comment-13343523 ] 

Mario Fusco commented on DROOLS-1397:
-------------------------------------

I already saw the question on StackOverflow and reproduced the problem locally. Actually the bug is in mvel (that is used internally by drools to parse this sort of expressions) so it needs to be fixed there. While investigating this issue I also noticed the following:

1. The cast in the from expression is not necessary and just adding the parenthesis as it follows is enough to workaround the problem

{code}
$comm: Comm() from ($conv.getComms()).get(Type.AAA)
{code}

2. Having noticed 1. another trivial way to workaround this issue is moving the map declaration inside the former pattern like in

{code}
$conv: Convention( $comms : comms )
$comm: Comm() from $comms.get(Type.AAA)
{code}

Please let me know if both 1. and 2. also works for you.


> Drools condition cannot retrieve object from Map with Enum key
> --------------------------------------------------------------
>
>                 Key: DROOLS-1397
>                 URL: https://issues.jboss.org/browse/DROOLS-1397
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine, decision tables
>    Affects Versions: 6.5.0.Final
>         Environment: JDK 1.7, JUnit test, exact drools version is 6.5.0.Final-redhat-2
>            Reporter: Patrick Mingard
>            Assignee: Mario Fusco
>            Priority: Minor
>
> I'm migrating an application that used drools 5.3 on the newer drools 6.5 version. 
> I'm using a decision table, And one of my condition is accessing a Map which has an enum class as a key. It is not compiling unless I do a strange ArrayList cast.
> Please refer to [this stackoverflow topic|http://stackoverflow.com/questions/41461468/drools-condition-cannot-retrieve-object-from-map-with-enum-key] for details.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list