discord-jadx/app/src/main/java/org/objectweb/asm/FieldWriter.java

125 lines
5.1 KiB
Java

package org.objectweb.asm;
import org.objectweb.asm.Attribute;
/* loaded from: com.discord-120015.apk:org/objectweb/asm/FieldWriter.SCL.lombok */
final class FieldWriter extends FieldVisitor {
private final SymbolTable symbolTable;
private final int accessFlags;
private final int nameIndex;
private final int descriptorIndex;
private int signatureIndex;
private int constantValueIndex;
private AnnotationWriter lastRuntimeVisibleAnnotation;
private AnnotationWriter lastRuntimeInvisibleAnnotation;
private AnnotationWriter lastRuntimeVisibleTypeAnnotation;
private AnnotationWriter lastRuntimeInvisibleTypeAnnotation;
private Attribute firstAttribute;
FieldWriter(SymbolTable symbolTable, int i, String str, String str2, String str3, Object obj) {
super(Opcodes.ASM9);
this.symbolTable = symbolTable;
this.accessFlags = i;
this.nameIndex = symbolTable.addConstantUtf8(str);
this.descriptorIndex = symbolTable.addConstantUtf8(str2);
if (str3 != null) {
this.signatureIndex = symbolTable.addConstantUtf8(str3);
}
if (obj != null) {
this.constantValueIndex = symbolTable.addConstant(obj).index;
}
}
@Override // org.objectweb.asm.FieldVisitor
public AnnotationVisitor visitAnnotation(String str, boolean z2) {
if (z2) {
AnnotationWriter create = AnnotationWriter.create(this.symbolTable, str, this.lastRuntimeVisibleAnnotation);
this.lastRuntimeVisibleAnnotation = create;
return create;
}
AnnotationWriter create2 = AnnotationWriter.create(this.symbolTable, str, this.lastRuntimeInvisibleAnnotation);
this.lastRuntimeInvisibleAnnotation = create2;
return create2;
}
@Override // org.objectweb.asm.FieldVisitor
public AnnotationVisitor visitTypeAnnotation(int i, TypePath typePath, String str, boolean z2) {
if (z2) {
AnnotationWriter create = AnnotationWriter.create(this.symbolTable, i, typePath, str, this.lastRuntimeVisibleTypeAnnotation);
this.lastRuntimeVisibleTypeAnnotation = create;
return create;
}
AnnotationWriter create2 = AnnotationWriter.create(this.symbolTable, i, typePath, str, this.lastRuntimeInvisibleTypeAnnotation);
this.lastRuntimeInvisibleTypeAnnotation = create2;
return create2;
}
@Override // org.objectweb.asm.FieldVisitor
public void visitAttribute(Attribute attribute) {
attribute.nextAttribute = this.firstAttribute;
this.firstAttribute = attribute;
}
@Override // org.objectweb.asm.FieldVisitor
public void visitEnd() {
}
int computeFieldInfoSize() {
int i = 8;
if (this.constantValueIndex != 0) {
this.symbolTable.addConstantUtf8("ConstantValue");
i = 8 + 8;
}
int computeAttributesSize = i + Attribute.computeAttributesSize(this.symbolTable, this.accessFlags, this.signatureIndex) + AnnotationWriter.computeAnnotationsSize(this.lastRuntimeVisibleAnnotation, this.lastRuntimeInvisibleAnnotation, this.lastRuntimeVisibleTypeAnnotation, this.lastRuntimeInvisibleTypeAnnotation);
if (this.firstAttribute != null) {
computeAttributesSize += this.firstAttribute.computeAttributesSize(this.symbolTable);
}
return computeAttributesSize;
}
void putFieldInfo(ByteVector byteVector) {
boolean z2 = this.symbolTable.getMajorVersion() < 49;
byteVector.putShort(this.accessFlags & ((z2 ? 4096 : 0) ^ (-1))).putShort(this.nameIndex).putShort(this.descriptorIndex);
int i = 0;
if (this.constantValueIndex != 0) {
i = 0 + 1;
}
if ((this.accessFlags & 4096) != 0 && z2) {
i++;
}
if (this.signatureIndex != 0) {
i++;
}
if ((this.accessFlags & 131072) != 0) {
i++;
}
if (this.lastRuntimeVisibleAnnotation != null) {
i++;
}
if (this.lastRuntimeInvisibleAnnotation != null) {
i++;
}
if (this.lastRuntimeVisibleTypeAnnotation != null) {
i++;
}
if (this.lastRuntimeInvisibleTypeAnnotation != null) {
i++;
}
if (this.firstAttribute != null) {
i += this.firstAttribute.getAttributeCount();
}
byteVector.putShort(i);
if (this.constantValueIndex != 0) {
byteVector.putShort(this.symbolTable.addConstantUtf8("ConstantValue")).putInt(2).putShort(this.constantValueIndex);
}
Attribute.putAttributes(this.symbolTable, this.accessFlags, this.signatureIndex, byteVector);
AnnotationWriter.putAnnotations(this.symbolTable, this.lastRuntimeVisibleAnnotation, this.lastRuntimeInvisibleAnnotation, this.lastRuntimeVisibleTypeAnnotation, this.lastRuntimeInvisibleTypeAnnotation, byteVector);
if (this.firstAttribute != null) {
this.firstAttribute.putAttributes(this.symbolTable, byteVector);
}
}
final void collectAttributePrototypes(Attribute.Set set) {
set.addAttributes(this.firstAttribute);
}
}