Assume a POJO is used as a fact and annotated with @Position as follows: public class PositionAnnotatedEvent { @Position(1) private String arg1; @Position(0) private String arg0; // getters and setters } When I add some metadata to this class in DRL, for example: declare org.jboss.qa.brms.bre.regression.POJOAnnotationMergeTest.PositionAnnotatedEvent @role(event) end Then the following rule using positional arguments does not compile, producing an IndexOutOfBoundsException with message 'Error trying to access field at position 0'. The same rule with named arguments compiles: rule 'sample rule' when org.jboss.qa.brms.bre.regression.POJOAnnotationMergeTest.PositionAnnotatedEvent( 'value1', 'value2'; ) then end The relevant stack trace follows: java.lang.IndexOutOfBoundsException: Error trying to access field at position 0 at org.drools.factmodel.ClassDefinition.getField(ClassDefinition.java:162) at org.drools.rule.builder.PatternBuilder.processPositional(PatternBuilder.java:432) at org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:392) at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:310) at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:131) at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:65) at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80) at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2578) at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:970) at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:456) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:643) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:41) I will attach a link to pull request with a test case shortly. Version-Release number of selected component (if applicable): Tested on BRMS version 5.3.1.BRMS-ER3, the same problem occurs in Drools 6.0.0-SNAPSHOT. How reproducible: Will attach a link to pull request shortly.
The reproducer test case can be found in pull request: https://github.com/droolsjbpm/drools/pull/154
Mario Fusco <mario.fusco> updated the status of jira JBRULES-3673 to Resolved
I fixed the issue on the master with this commit: https://github.com/droolsjbpm/drools/commit/63dfb78c42122dcd6c695e5fb8ed845093d2872a I am ready to backport this fix to the 5.3.1 as soon as the ack flags will be set.
Backported to 5.3.1
Verified on 5.3.1.BRMS-ER4
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.