boolean (@NotNull StringBuilder buffer, PsiField @NotNull [] fields, PsiParameter @NotNull [] parameters) { PsiRecordComponent component = JavaPsiRecordUtil.getComponentForField(fields[0]); if (component == null) return false; PsiClass recordClass = component.getContainingClass(); if (recordClass == null) return false; PsiRecordComponent[] components = recordClass.getRecordComponents(); if (components.length > fields.length) { buffer.append(StreamEx.of(components) .map(JavaPsiRecordUtil::getFieldForComponent) .peek(Objects::requireNonNull) .map(f -> { int index = ArrayUtil.indexOf(fields, f); return index >= 0 ? parameters[index].getName() : PsiTypesUtil.getDefaultValueOfType(f.getType(), true); }) .joining(",", "this(", ")")); appendSemicolon(buffer); return true; } return false; }