diff --git a/drools-mvel/src/main/java/org/drools/mvel/MVELConstraint.java b/drools-mvel/src/main/java/org/drools/mvel/MVELConstraint.java index b3ef1ad9f38..344276ab9c1 100644 --- a/drools-mvel/src/main/java/org/drools/mvel/MVELConstraint.java +++ b/drools-mvel/src/main/java/org/drools/mvel/MVELConstraint.java @@ -14,25 +14,6 @@ package org.drools.mvel; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.Executor; -import java.util.concurrent.atomic.AtomicInteger; - import org.drools.base.RuleBase; import org.drools.base.RuleBuildContext; import org.drools.base.base.DroolsQuery; @@ -82,6 +63,25 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.Executor; +import java.util.concurrent.atomic.AtomicInteger; + import static org.drools.base.reteoo.PropertySpecificUtil.allSetBitMask; import static org.drools.base.reteoo.PropertySpecificUtil.allSetButTraitBitMask; import static org.drools.base.reteoo.PropertySpecificUtil.getEmptyPropertyReactiveMask; @@ -477,6 +477,11 @@ private BitMask calculateMaskFromExpression(Optional pattern, List simpleExpression.indexOf(originalPropertyName)) { + // A contains expression could be a rewritten memberOf so give a change also to the part of expression + // after the 'contains' keyword to be analyzed before emitting a warning and consider the constraint as class reactive + continue; + } if (isBoundVariableFromDifferentPattern(originalPropertyName, pattern)) { logger.warn("{} is not relevant to this pattern, so it causes class reactivity." + " Consider placing this constraint in the original pattern if possible : {}",