int (PsiRecordComponent @NotNull [] components, PsiParameter @NotNull [] parameters, PsiStatement @NotNull [] statements) { assert parameters.length == components.length; Set<PsiRecordComponent> unprocessed = ContainerUtil.newHashSet(components); int i = statements.length - 1; while (i >= 0 && !unprocessed.isEmpty()) { PsiAssignmentExpression assignment = ExpressionUtils.getAssignment(statements[i]); if (assignment == null) break; PsiReferenceExpression lValue = ObjectUtils.tryCast( PsiUtil.skipParenthesizedExprDown(assignment.getLExpression()), PsiReferenceExpression.class); if (lValue == null || !ExpressionUtil.isEffectivelyUnqualified(lValue)) break; PsiField field = ObjectUtils.tryCast(lValue.resolve(), PsiField.class); if (field == null) break; PsiRecordComponent component = JavaPsiRecordUtil.getComponentForField(field); if (component == null || !unprocessed.contains(component)) break; PsiParameter parameter = parameters[ArrayUtil.indexOf(components, component)]; if (!parameter.getName().equals(component.getName())) break; PsiReferenceExpression rValue = ObjectUtils.tryCast( PsiUtil.skipParenthesizedExprDown(assignment.getRExpression()), PsiReferenceExpression.class); if (rValue == null || rValue.getQualifierExpression() != null || !parameter.getName().equals(rValue.getReferenceName())) break; unprocessed.remove(component); i--; } return components.length - unprocessed.size(); }