@Override
    protected void maybeUpdateGroupState() {
        ConsumerGroupState previousState = state.get();
        ConsumerGroupState newState = STABLE;
        if (members.isEmpty()) {
            newState = EMPTY;
        } else if (groupEpoch.get() > targetAssignmentEpoch.get()) {
            newState = ASSIGNING;
        } else {
            for (ModernGroupMember member : members.values()) {
                if (!member.isReconciledTo(targetAssignmentEpoch.get())) {
                    newState = RECONCILING;
                    break;
                }
            }
        }

        state.set(newState);
        metrics.onConsumerGroupStateTransition(previousState, newState);
    }
Throws an exception if the received member epoch does not match the expected member epoch.

@param receivedMemberEpoch   The received member epoch or generation id.
@param expectedMemberEpoch   The expected member epoch.
@param useClassicProtocol    The boolean indicating whether the checked member uses the classic protocol.
@throws StaleMemberEpochException    if the member with unmatched member epoch uses the consumer protocol.
@throws IllegalGenerationException   if the member with unmatched generation id uses the classic protocol.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/consumer/ConsumerGroup.java