package o; import com.google.protobuf.CodedOutputStream; import com.google.protobuf.InvalidProtocolBufferException; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import o.AbstractC5573bvc; import o.InterfaceC16581pUl; import o.KUw; import o.KUw.LWm; import o.MTP; import o.Nvr; import o.Rkw; import o.sjx; /* loaded from: classes2.dex */ public abstract class KUw, BuilderType extends LWm> extends AbstractC5573bvc { private static Map> defaultInstanceMap = new ConcurrentHashMap(); protected C0526IsC unknownFields = C0526IsC.d(); protected int memoizedSerializedSize = -1; /* loaded from: classes2.dex */ public static class IeS extends rPP { final InterfaceC16581pUl c; final RVV d; } /* loaded from: classes2.dex */ public enum ojQ { GET_MEMOIZED_IS_INITIALIZED, SET_MEMOIZED_IS_INITIALIZED, BUILD_MESSAGE_INFO, NEW_MUTABLE_INSTANCE, NEW_BUILDER, GET_DEFAULT_INSTANCE, GET_PARSER } protected abstract Object dynamicMethod(ojQ ojq, Object obj, Object obj2); @Override // o.InterfaceC16581pUl public final XgX getParserForType() { return (XgX) dynamicMethod(ojQ.GET_PARSER); } @Override // o.ncT public final MessageType getDefaultInstanceForType() { return (MessageType) dynamicMethod(ojQ.GET_DEFAULT_INSTANCE); } @Override // o.InterfaceC16581pUl public final BuilderType newBuilderForType() { return (BuilderType) dynamicMethod(ojQ.NEW_BUILDER); } public String toString() { String obj = super.toString(); StringBuilder sb = new StringBuilder(); sb.append("# "); sb.append(obj); VWe.c(this, sb, 0); return sb.toString(); } public int hashCode() { if (this.memoizedHashCode != 0) { return this.memoizedHashCode; } this.memoizedHashCode = MvG.a().b(getClass()).b(this); return this.memoizedHashCode; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj != null && getClass() == obj.getClass()) { return MvG.a().b(getClass()).c(this, (KUw) obj); } return false; } protected void makeImmutable() { MvG.a().b(getClass()).e(this); } public final , BuilderType extends LWm> BuilderType createBuilder() { return (BuilderType) dynamicMethod(ojQ.NEW_BUILDER); } public final , BuilderType extends LWm> BuilderType createBuilder(MessageType messagetype) { return (BuilderType) createBuilder().mergeFrom(messagetype); } @Override // o.ncT public final boolean isInitialized() { return isInitialized(this, true); } @Override // o.InterfaceC16581pUl public final BuilderType toBuilder() { BuilderType buildertype = (BuilderType) dynamicMethod(ojQ.NEW_BUILDER); buildertype.mergeFrom(this); return buildertype; } protected Object dynamicMethod(ojQ ojq, Object obj) { return dynamicMethod(ojq, obj, null); } /* JADX INFO: Access modifiers changed from: protected */ public Object dynamicMethod(ojQ ojq) { return dynamicMethod(ojq, null, null); } @Override // o.InterfaceC16581pUl public void writeTo(CodedOutputStream codedOutputStream) throws IOException { oQI oqi; Wnq b = MvG.a().b(getClass()); if (codedOutputStream.d != null) { oqi = codedOutputStream.d; } else { oqi = new oQI(codedOutputStream); } b.a((Wnq) this, (InterfaceC16095lEl) oqi); } @Override // o.InterfaceC16581pUl public int getSerializedSize() { if (this.memoizedSerializedSize == -1) { this.memoizedSerializedSize = MvG.a().b(getClass()).a(this); } return this.memoizedSerializedSize; } /* JADX INFO: Access modifiers changed from: package-private */ public Object buildMessageInfo() throws Exception { return dynamicMethod(ojQ.BUILD_MESSAGE_INFO); } /* JADX INFO: Access modifiers changed from: package-private */ public static > T getDefaultInstance(Class cls) { KUw kUw = defaultInstanceMap.get(cls); if (kUw == null) { try { Class.forName(cls.getName(), true, cls.getClassLoader()); kUw = defaultInstanceMap.get(cls); } catch (ClassNotFoundException e) { throw new IllegalStateException("Class initialization cannot fail.", e); } } if (kUw == null) { kUw = (T) ((KUw) vqr.a(cls)).getDefaultInstanceForType(); if (kUw == null) { throw new IllegalStateException(); } defaultInstanceMap.put(cls, kUw); } return (T) kUw; } public static > void registerDefaultInstance(Class cls, T t) { defaultInstanceMap.put(cls, t); } /* JADX INFO: Access modifiers changed from: protected */ public static Object newMessageInfo(InterfaceC16581pUl interfaceC16581pUl, String str, Object[] objArr) { return new rAJ(interfaceC16581pUl, str, objArr); } /* loaded from: classes2.dex */ public static abstract class LWm, BuilderType extends LWm> extends AbstractC5573bvc.RVV { private final MessageType defaultInstance; public MessageType instance; protected boolean isBuilt = false; public LWm(MessageType messagetype) { this.defaultInstance = messagetype; this.instance = (MessageType) messagetype.dynamicMethod(ojQ.NEW_MUTABLE_INSTANCE); } /* JADX INFO: Access modifiers changed from: protected */ public final void copyOnWrite() { if (this.isBuilt) { copyOnWriteInternal(); this.isBuilt = false; } } protected void copyOnWriteInternal() { MessageType messagetype = (MessageType) this.instance.dynamicMethod(ojQ.NEW_MUTABLE_INSTANCE); mergeFromInstance(messagetype, this.instance); this.instance = messagetype; } @Override // o.ncT public final boolean isInitialized() { return KUw.isInitialized(this.instance, false); } @Override // o.AbstractC5573bvc.RVV /* renamed from: clone, reason: merged with bridge method [inline-methods] */ public BuilderType mo354clone() { BuilderType buildertype = (BuilderType) getDefaultInstanceForType().newBuilderForType(); buildertype.mergeFrom(buildPartial()); return buildertype; } @Override // o.InterfaceC16581pUl.HBt public MessageType buildPartial() { if (this.isBuilt) { return this.instance; } this.instance.makeImmutable(); this.isBuilt = true; return this.instance; } @Override // o.InterfaceC16581pUl.HBt public final MessageType build() { MessageType buildPartial = buildPartial(); if (buildPartial.isInitialized()) { return buildPartial; } throw newUninitializedMessageException(buildPartial); } /* JADX INFO: Access modifiers changed from: protected */ @Override // o.AbstractC5573bvc.RVV public BuilderType internalMergeFrom(MessageType messagetype) { return mergeFrom((LWm) messagetype); } public BuilderType mergeFrom(MessageType messagetype) { copyOnWrite(); mergeFromInstance(this.instance, messagetype); return this; } private void mergeFromInstance(MessageType messagetype, MessageType messagetype2) { MvG.a().b(messagetype.getClass()).a(messagetype, messagetype2); } @Override // o.ncT public MessageType getDefaultInstanceForType() { return this.defaultInstance; } } /* loaded from: classes2.dex */ public static abstract class Sts, BuilderType extends Object> extends KUw implements QEW { protected Rkw extensions = Rkw.c(); /* JADX INFO: Access modifiers changed from: package-private */ public final Rkw c() { if (this.extensions.d) { this.extensions = this.extensions.clone(); } return this.extensions; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class RVV implements Rkw.Sts { final int a; final Nvr.HBt c; private boolean d; final boolean e; @Override // java.lang.Comparable public final /* bridge */ /* synthetic */ int compareTo(Object obj) { int i = ((RVV) obj).a; return 0; } @Override // o.Rkw.Sts public final Nvr.Sts c() { throw null; } /* JADX WARN: Multi-variable type inference failed */ @Override // o.Rkw.Sts public final InterfaceC16581pUl.HBt b(InterfaceC16581pUl.HBt hBt, InterfaceC16581pUl interfaceC16581pUl) { return ((LWm) hBt).mergeFrom((LWm) interfaceC16581pUl); } @Override // o.Rkw.Sts public final boolean d() { return this.e; } @Override // o.Rkw.Sts public final boolean e() { return this.d; } @Override // o.Rkw.Sts public final int b() { return this.a; } @Override // o.Rkw.Sts public final Nvr.HBt a() { return this.c; } } /* JADX INFO: Access modifiers changed from: package-private */ public static Object invokeOrDie(Method method, Object obj, Object... objArr) { try { return method.invoke(obj, objArr); } catch (IllegalAccessException e) { throw new RuntimeException("Couldn't use Java reflection to implement protocol message reflection.", e); } catch (InvocationTargetException e2) { Throwable cause = e2.getCause(); if (cause instanceof RuntimeException) { throw ((RuntimeException) cause); } if (cause instanceof Error) { throw ((Error) cause); } throw new RuntimeException("Unexpected exception thrown by generated accessor method.", cause); } } protected static final > boolean isInitialized(T t, boolean z) { byte byteValue = ((Byte) t.dynamicMethod(ojQ.GET_MEMOIZED_IS_INITIALIZED)).byteValue(); if (byteValue == 1) { return true; } if (byteValue == 0) { return false; } boolean c = MvG.a().b(t.getClass()).c(t); if (z) { t.dynamicMethod(ojQ.SET_MEMOIZED_IS_INITIALIZED, c ? t : null); } return c; } /* JADX INFO: Access modifiers changed from: protected */ public static MTP.Sts emptyIntList() { return Rjv.c(); } public static MTP.RVV emptyProtobufList() { return ulH.b(); } public static MTP.RVV mutableCopy(MTP.RVV rvv) { int size = rvv.size(); return rvv.b(size == 0 ? 10 : size << 1); } /* loaded from: classes2.dex */ public static class HBt> extends psj { private final T b; @Override // o.XgX public final /* synthetic */ Object c(cKE cke, ZjA zjA) throws InvalidProtocolBufferException { return KUw.parsePartialFrom(this.b, cke, zjA); } @Override // o.psj public final /* synthetic */ InterfaceC16581pUl c(byte[] bArr, int i, ZjA zjA) throws InvalidProtocolBufferException { return KUw.parsePartialFrom(this.b, bArr, 0, i, zjA); } public HBt(T t) { this.b = t; } } static > T parsePartialFrom(T t, cKE cke, ZjA zjA) throws InvalidProtocolBufferException { uCO uco; T t2 = (T) t.dynamicMethod(ojQ.NEW_MUTABLE_INSTANCE); try { Wnq b = MvG.a().b(t2.getClass()); if (cke.e != null) { uco = cke.e; } else { uco = new uCO(cke); } b.c(t2, uco, zjA); b.e(t2); return t2; } catch (InvalidProtocolBufferException e) { e = e; if (e.e) { e = new InvalidProtocolBufferException(e); } e.b = t2; throw e; } catch (IOException e2) { if (e2.getCause() instanceof InvalidProtocolBufferException) { throw ((InvalidProtocolBufferException) e2.getCause()); } InvalidProtocolBufferException invalidProtocolBufferException = new InvalidProtocolBufferException(e2); invalidProtocolBufferException.b = t2; throw invalidProtocolBufferException; } catch (RuntimeException e3) { if (e3.getCause() instanceof InvalidProtocolBufferException) { throw ((InvalidProtocolBufferException) e3.getCause()); } throw e3; } } static > T parsePartialFrom(T t, byte[] bArr, int i, int i2, ZjA zjA) throws InvalidProtocolBufferException { T t2 = (T) t.dynamicMethod(ojQ.NEW_MUTABLE_INSTANCE); try { Wnq b = MvG.a().b(t2.getClass()); b.d(t2, bArr, i, i + i2, new sjx.LWm(zjA)); b.e(t2); if (t2.memoizedHashCode == 0) { return t2; } throw new RuntimeException(); } catch (InvalidProtocolBufferException e) { e = e; if (e.e) { e = new InvalidProtocolBufferException(e); } e.b = t2; throw e; } catch (IOException e2) { if (e2.getCause() instanceof InvalidProtocolBufferException) { throw ((InvalidProtocolBufferException) e2.getCause()); } InvalidProtocolBufferException invalidProtocolBufferException = new InvalidProtocolBufferException(e2); invalidProtocolBufferException.b = t2; throw invalidProtocolBufferException; } catch (IndexOutOfBoundsException unused) { InvalidProtocolBufferException g = InvalidProtocolBufferException.g(); g.b = t2; throw g; } } private static > T checkMessageInitialized(T t) throws InvalidProtocolBufferException { if (t == null || t.isInitialized()) { return t; } InvalidProtocolBufferException invalidProtocolBufferException = new InvalidProtocolBufferException(t.newUninitializedMessageException().getMessage()); invalidProtocolBufferException.b = t; throw invalidProtocolBufferException; } public static > T parseFrom(T t, QwV qwV) throws InvalidProtocolBufferException { return (T) checkMessageInitialized(parseFrom(t, qwV, ZjA.e())); } protected static > T parseFrom(T t, QwV qwV, ZjA zjA) throws InvalidProtocolBufferException { return (T) checkMessageInitialized(parsePartialFrom(t, qwV, zjA)); } private static > T parsePartialFrom(T t, QwV qwV, ZjA zjA) throws InvalidProtocolBufferException { cKE f = qwV.f(); T t2 = (T) parsePartialFrom(t, f, zjA); try { f.e(); return t2; } catch (InvalidProtocolBufferException e) { e.b = t2; throw e; } } public static > T parseFrom(T t, byte[] bArr) throws InvalidProtocolBufferException { return (T) checkMessageInitialized(parsePartialFrom(t, bArr, 0, bArr.length, ZjA.e())); } @Override // o.AbstractC5573bvc void setMemoizedSerializedSize(int i) { this.memoizedSerializedSize = i; } @Override // o.AbstractC5573bvc int getMemoizedSerializedSize() { return this.memoizedSerializedSize; } }