Source:
<code>public void onAssignment(final Assignment assignment, final ConsumerGroupMetadata metadata) { final List<TopicPartition> partitions = new ArrayList<>(assignment.partitions()); partitions.sort(PARTITION_COMPARATOR); <START> <END> final AssignmentInfo info = AssignmentInfo.decode(assignment.userData()); if (info.errCode() != AssignorError.NONE.code()) { assignmentErrorCode.set(info.errCode()); return; } final int receivedAssignmentMetadataVersion = info.version(); final int latestCommonlySupportedVersion = info.latestSupportedVersion(); validateMetadataVersions(receivedAssignmentMetadataVersion, latestCommonlySupportedVersion); if (maybeUpdateSubscriptionVersion(receivedAssignmentMetadataVersion, latestCommonlySupportedVersion)) { assignmentErrorCode.set(AssignorError.VERSION_PROBING.code()); return; } final Map<TaskId, Set<TopicPartition>> activeTasks = new HashMap<>(); final Map<TopicPartition, PartitionInfo> topicToPartitionInfo = new HashMap<>(); final Map<HostInfo, Set<TopicPartition>> partitionsByHost; final Map<TopicPartition, TaskId> partitionsToTaskId = new HashMap<>(); switch (receivedAssignmentMetadataVersion) { case VERSION_ONE: processVersionOneAssignment(logPrefix, info, partitions, activeTasks, partitionsToTaskId); partitionsByHost = Collections.emptyMap(); break; case VERSION_TWO: case VERSION_THREE: case VERSION_FOUR: case VERSION_FIVE: processVersionTwoAssignment(logPrefix, info, partitions, activeTasks, topicToPartitionInfo, partitionsToTaskId); partitionsByHost = info.partitionsByHost(); break; default: throw new IllegalStateException( "This code should never be reached." + " Please file a bug report at <LINK_0>" ); } taskManager.setClusterMetadata(Cluster.empty().withPartitions(topicToPartitionInfo)); taskManager.setPartitionsByHostState(partitionsByHost); taskManager.setPartitionsToTaskId(partitionsToTaskId); taskManager.setAssignmentMetadata(activeTasks, info.standbyTasks()); taskManager.updateSubscriptionsFromAssignment(partitions); }</code><technical_language>I this cleanup</technical_language>

Target:
public void onAssignment(final Assignment assignment, final ConsumerGroupMetadata metadata) { final List<TopicPartition> partitions = new ArrayList<>(assignment.partitions()); partitions.sort(PARTITION_COMPARATOR); final AssignmentInfo info = AssignmentInfo.decode(assignment.userData()); if (info.errCode() != AssignorError.NONE.code()) { setAssignmentErrorCode(info.errCode()); return; } final int receivedAssignmentMetadataVersion = info.version(); final int latestCommonlySupportedVersion = info.commonlySupportedVersion(); validateMetadataVersions(receivedAssignmentMetadataVersion, latestCommonlySupportedVersion); if (maybeUpdateSubscriptionVersion(receivedAssignmentMetadataVersion, latestCommonlySupportedVersion)) { setAssignmentErrorCode(AssignorError.VERSION_PROBING.code()); return; } final Map<TaskId, Set<TopicPartition>> activeTasks = new HashMap<>(); final Map<TopicPartition, PartitionInfo> topicToPartitionInfo = new HashMap<>(); final Map<HostInfo, Set<TopicPartition>> partitionsByHost; final Map<TopicPartition, TaskId> partitionsToTaskId = new HashMap<>(); switch (receivedAssignmentMetadataVersion) { case VERSION_ONE: processVersionOneAssignment(logPrefix, info, partitions, activeTasks, partitionsToTaskId); partitionsByHost = Collections.emptyMap(); break; case VERSION_TWO: case VERSION_THREE: case VERSION_FOUR: case VERSION_FIVE: processVersionTwoAssignment(logPrefix, info, partitions, activeTasks, topicToPartitionInfo, partitionsToTaskId); partitionsByHost = info.partitionsByHost(); break; default: throw new IllegalStateException( "This code should never be reached." + " Please file a bug report at <LINK_0>" ); } taskManager.setClusterMetadata(Cluster.empty().withPartitions(topicToPartitionInfo)); taskManager.setPartitionsByHostState(partitionsByHost); taskManager.setPartitionsToTaskId(partitionsToTaskId); taskManager.setAssignmentMetadata(activeTasks, info.standbyTasks()); taskManager.updateSubscriptionsFromAssignment(partitions); }