/** * Adds a number or string constant to the constant pool of the class being build. Does nothing if * the constant pool already contains a similar item. <i>This method is intended for {@link * Attribute} sub classes, and is normally not needed by class generators or adapters.</i> * * @param value the value of the constant to be added to the constant pool. This parameter must be * an {@link Integer}, a {@link Float}, a {@link Long}, a {@link Double} or a {@link String}. * @return the index of a new or already existing constant item with the given value. */ public int newConst(final Object value) { return symbolTable.addConstant(value).index; }
/** * Constructs a new {@link FieldWriter}. * * @param symbolTable where the constants used in this FieldWriter must be stored. * @param access the field's access flags (see {@link Opcodes}). * @param name the field's name. * @param descriptor the field's descriptor (see {@link Type}). * @param signature the field's signature. May be {@literal null}. * @param constantValue the field's constant value. May be {@literal null}. */ FieldWriter( final SymbolTable symbolTable, final int access, final String name, final String descriptor, final String signature, final Object constantValue) { super(Opcodes.ASM7); this.symbolTable = symbolTable; this.accessFlags = access; this.nameIndex = symbolTable.addConstantUtf8(name); this.descriptorIndex = symbolTable.addConstantUtf8(descriptor); if (signature != null) { this.signatureIndex = symbolTable.addConstantUtf8(signature); } if (constantValue != null) { this.constantValueIndex = symbolTable.addConstant(constantValue).index; } }
Symbol symbol = symbolTable.addConstant(value); annotation.put12(".s.IFJDCS".charAt(symbol.tag), symbol.index);
addConstant(bootstrapMethodArgument); bootstrapMethodsAttribute.putShort(numBootstrapArguments); for (Object bootstrapMethodArgument : bootstrapMethodArguments) { bootstrapMethodsAttribute.putShort(addConstant(bootstrapMethodArgument).index);
Symbol symbol = symbolTable.addConstant(value); annotation.put12(".s.IFJDCS".charAt(symbol.tag), symbol.index);
/** * Constructs a new {@link FieldWriter}. * * @param symbolTable where the constants used in this FieldWriter must be stored. * @param access the field's access flags (see {@link Opcodes}). * @param name the field's name. * @param descriptor the field's descriptor (see {@link Type}). * @param signature the field's signature. May be {@literal null}. * @param constantValue the field's constant value. May be {@literal null}. */ FieldWriter( final SymbolTable symbolTable, final int access, final String name, final String descriptor, final String signature, final Object constantValue) { super(Opcodes.ASM7); this.symbolTable = symbolTable; this.accessFlags = access; this.nameIndex = symbolTable.addConstantUtf8(name); this.descriptorIndex = symbolTable.addConstantUtf8(descriptor); if (signature != null) { this.signatureIndex = symbolTable.addConstantUtf8(signature); } if (constantValue != null) { this.constantValueIndex = symbolTable.addConstant(constantValue).index; } }
addConstant(bootstrapMethodArgument); bootstrapMethodsAttribute.putShort(numBootstrapArguments); for (Object bootstrapMethodArgument : bootstrapMethodArguments) { bootstrapMethodsAttribute.putShort(addConstant(bootstrapMethodArgument).index);
lastBytecodeOffset = code.length; Symbol constantSymbol = symbolTable.addConstant(value); int constantIndex = constantSymbol.index; char firstDescriptorChar;
/** * Adds a number or string constant to the constant pool of the class being build. Does nothing if * the constant pool already contains a similar item. <i>This method is intended for {@link * Attribute} sub classes, and is normally not needed by class generators or adapters.</i> * * @param value the value of the constant to be added to the constant pool. This parameter must be * an {@link Integer}, a {@link Float}, a {@link Long}, a {@link Double} or a {@link String}. * @return the index of a new or already existing constant item with the given value. */ public int newConst(final Object value) { return symbolTable.addConstant(value).index; }
lastBytecodeOffset = code.length; Symbol constantSymbol = symbolTable.addConstant(value); int constantIndex = constantSymbol.index; char firstDescriptorChar;