Source:
<code>protected List<Constraint> build( RuleBuildContext context, PatternDescr patternDescr, Pattern pattern, ConstraintConnectiveDescr descr, MVELDumper.MVELDumperContext mvelCtx ) { List<Constraint> constraints = new ArrayList<Constraint>(); List<BaseDescr> initialDescrs = new ArrayList<BaseDescr>( descr.getDescrs() ); for ( BaseDescr d : initialDescrs ) { boolean isXPath = isXPathDescr(d); if (isXPath && pattern.hasXPath()) { context.addError( new DescrBuildError( context.getParentDescr(), descr, null, "More than a single oopath constraint is not allowed in the same pattern" ) ); return constraints; } Constraint constraint = isXPath ? buildXPathDescr(context, patternDescr, pattern, d, mvelCtx) : buildCcdDescr(context, patternDescr, pattern, d, descr, mvelCtx); if (constraint != null) { <START> Declaration declFromXpath = getDeclarationCorrespondingToXpath( pattern, isXPath, constraint ); <END> if (declFromXpath == null) { constraints.add(constraint); } else { constraint = buildCcdDescr(context, patternDescr, pattern, d.replaceVariable(declFromXpath.getBindingName(), "this"), descr, mvelCtx); if (constraint != null) { pattern.getXpathConstraint().getChunks().getLast().addConstraint( constraint ); } } } } if ( descr.getDescrs().size() > initialDescrs.size() ) { List<BaseDescr> additionalDescrs = new ArrayList<BaseDescr>( descr.getDescrs() ); additionalDescrs.removeAll( initialDescrs ); if ( ! additionalDescrs.isEmpty() ) { List<Constraint> additionalConstraints = new ArrayList<Constraint>(); for ( BaseDescr d : additionalDescrs ) { Constraint constraint = buildCcdDescr(context, patternDescr, pattern, d, descr, mvelCtx); if (constraint != null) { additionalConstraints.add(constraint); } } constraints.addAll(0, additionalConstraints); } } return constraints; }</code><technical_language>updated method name, I missed change variable name declFromXpath declCorrXpath too, and.</technical_language>

Target:
protected List<Constraint> build( RuleBuildContext context, PatternDescr patternDescr, Pattern pattern, ConstraintConnectiveDescr descr, MVELDumper.MVELDumperContext mvelCtx ) { List<Constraint> constraints = new ArrayList<Constraint>(); List<BaseDescr> initialDescrs = new ArrayList<BaseDescr>( descr.getDescrs() ); for ( BaseDescr d : initialDescrs ) { boolean isXPath = isXPathDescr(d); if (isXPath && pattern.hasXPath()) { context.addError( new DescrBuildError( context.getParentDescr(), descr, null, "More than a single oopath constraint is not allowed in the same pattern" ) ); return constraints; } Constraint constraint = isXPath ? buildXPathDescr(context, patternDescr, pattern, d, mvelCtx) : buildCcdDescr(context, patternDescr, pattern, d, descr, mvelCtx); if (constraint != null) { Declaration declCorrXpath = getDeclarationCorrespondingToXpath( pattern, isXPath, constraint ); if (declCorrXpath == null) { constraints.add(constraint); } else { constraint = buildCcdDescr(context, patternDescr, pattern, d.replaceVariable(declCorrXpath.getBindingName(), "this"), descr, mvelCtx); if (constraint != null) { pattern.getXpathConstraint().getChunks().getLast().addConstraint( constraint ); } } } } if ( descr.getDescrs().size() > initialDescrs.size() ) { List<BaseDescr> additionalDescrs = new ArrayList<BaseDescr>( descr.getDescrs() ); additionalDescrs.removeAll( initialDescrs ); if ( ! additionalDescrs.isEmpty() ) { List<Constraint> additionalConstraints = new ArrayList<Constraint>(); for ( BaseDescr d : additionalDescrs ) { Constraint constraint = buildCcdDescr(context, patternDescr, pattern, d, descr, mvelCtx); if (constraint != null) { additionalConstraints.add(constraint); } } constraints.addAll(0, additionalConstraints); } } return constraints; }