package io.netty.util;

import io.netty.util.AbstractConstant;
import java.util.concurrent.atomic.AtomicLong;

/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractConstant<T extends AbstractConstant<T>> implements Constant<T> {
    private static final AtomicLong uniqueIdGenerator = new AtomicLong();
    private final int id;
    private final String name;
    private final long uniquifier = uniqueIdGenerator.getAndIncrement();

    public AbstractConstant(int i2, String str) {
        this.id = i2;
        this.name = str;
    }

    @Override // java.lang.Comparable
    public final int compareTo(T t2) {
        if (this == t2) {
            return 0;
        }
        int iHashCode = hashCode() - t2.hashCode();
        if (iHashCode != 0) {
            return iHashCode;
        }
        long j2 = this.uniquifier;
        long j3 = t2.uniquifier;
        if (j2 < j3) {
            return -1;
        }
        if (j2 > j3) {
            return 1;
        }
        throw new Error("failed to compare two different constants");
    }

    public final boolean equals(Object obj) {
        return super.equals(obj);
    }

    public final int hashCode() {
        return super.hashCode();
    }

    @Override // io.netty.util.Constant
    public final int id() {
        return this.id;
    }

    @Override // io.netty.util.Constant
    public final String name() {
        return this.name;
    }

    public final String toString() {
        return name();
    }
}
