package i;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Enumeration;

/* JADX INFO: renamed from: i.z, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C0545z implements U {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static C0545z f4386a = new C0545z();

    @Override // i.U
    public void a(C0516I c0516i, Object obj, Object obj2, Type type, int i2) {
        e0 e0Var = c0516i.f4223k;
        if (obj == null) {
            e0Var.N(f0.WriteNullListAsEmpty);
            return;
        }
        int i3 = 0;
        Type type2 = (e0Var.j(f0.WriteClassName) && (type instanceof ParameterizedType)) ? ((ParameterizedType) type).getActualTypeArguments()[0] : null;
        Enumeration enumeration = (Enumeration) obj;
        Z z2 = c0516i.f4229q;
        c0516i.s(z2, obj, obj2, 0);
        try {
            e0Var.append('[');
            while (enumeration.hasMoreElements()) {
                Object objNextElement = enumeration.nextElement();
                int i4 = i3 + 1;
                if (i3 != 0) {
                    e0Var.append(',');
                }
                if (objNextElement == null) {
                    e0Var.K();
                } else {
                    c0516i.m(objNextElement.getClass()).a(c0516i, objNextElement, Integer.valueOf(i3), type2, 0);
                }
                i3 = i4;
            }
            e0Var.append(']');
            c0516i.f4229q = z2;
        } catch (Throwable th) {
            c0516i.f4229q = z2;
            throw th;
        }
    }
}
