public LogAppendInfo copy(LeaderHwChange newLeaderHwChange) {
        return new LogAppendInfo(firstOffset, lastOffset, lastLeaderEpoch, maxTimestamp, shallowOffsetOfMaxTimestamp, logAppendTime, logStartOffset, recordValidationStats,
                sourceCompression, validBytes, lastOffsetOfFirstBatch, recordErrors, newLeaderHwChange);
    }
Returns a new instance containing all the fields from this instance and updated with the given LeaderHwChange value.

@param newLeaderHwChange new value for LeaderHwChange
@return a new instance with the given LeaderHwChange
storage/src/main/java/org/apache/kafka/storage/internals/log/LogAppendInfo.java