private void addPutfield0(CtClass target, String classname, String name, String desc) { add(PUTFIELD); // target is null if it represents THIS. int ci = classname == null ? constPool.addClassInfo(target) : constPool.addClassInfo(classname); addIndex(constPool.addFieldrefInfo(ci, name, desc)); growStack(-1 - Descriptor.dataSize(desc)); }
/** * Returns the generic signature indicated by <code>signature_index</code>. * * @see #toClassSignature(String) * @see #toMethodSignature(String) * @see #toFieldSignature(String) */ public String getSignature() { return getConstPool().getUtf8Info(ByteArray.readU16bit(get(), 0)); }
private void addInvokestatic(int clazz, String name, String desc, boolean isInterface) { add(INVOKESTATIC); int index; if (isInterface) index = constPool.addInterfaceMethodrefInfo(clazz, name, desc); else index = constPool.addMethodrefInfo(clazz, name, desc); addIndex(index); growStack(Descriptor.dataSize(desc)); }
int compile(CtClass type, String name, Bytecode code, CtClass[] parameters, Javac drv) throws CannotCompileException { code.addAload(0); code.addFconst(value); code.addPutfield(Bytecode.THIS, name, Descriptor.of(type)); return 3; // stack size }
int compile(CtClass type, String name, Bytecode code, CtClass[] parameters, Javac drv) throws CannotCompileException { code.addAload(0); code.addLdc2w(value); code.addPutfield(Bytecode.THIS, name, Descriptor.of(type)); return 3; // stack size }
private int getFieldSize(CodeIterator ci, int index) { String desc = constPool.getFieldrefType(ci.u16bitAt(index + 1)); return Descriptor.dataSize(desc); } }
/** * Returns the file name indicated by <code>sourcefile_index</code>. */ public String getFileName() { return getConstPool().getUtf8Info(ByteArray.readU16bit(get(), 0)); }
/** * Returns the encoded modifiers of the field. * * @see Modifier */ public int getModifiers() { return AccessFlag.toModifier(fieldInfo.getAccessFlags()); }
/** * Adds a new entry of <code>exception_table</code>. */ public void addExceptionHandler(int start, int end, int handler, CtClass type) { addExceptionHandler(start, end, handler, constPool.addClassInfo(type)); }
/** * Sets <code>signature_index</code> to the index of the given generic signature, * which is added to a constant pool. * * @param sig new signature. * @since 3.11 */ public void setSignature(String sig) { int index = getConstPool().addUtf8Info(sig); ByteArray.write16bit(index, info, 0); }
/** * Converts to a <code>CodeAttribute</code>. */ public CodeAttribute toCodeAttribute() { return new CodeAttribute(constPool, maxStack, maxLocals, get(), tryblocks); }
public void visit() { int num = ByteArray.readU16bit(info, 0); writer.write16bit(num); super.visit(); }
/** * {@code element_value_paris} */ final int memberValuePair(int pos) throws Exception { int nameIndex = ByteArray.readU16bit(info, pos); return memberValuePair(pos + 2, nameIndex); }
void enumMemberValue(int pos, int typeNameIndex, int constNameIndex) throws Exception { renameType(pos + 1, typeNameIndex); super.enumMemberValue(pos, typeNameIndex, constNameIndex); }
void shift(int where, int gapLength, boolean exclusive) { int p = pos; defaultByte = shiftOffset(p, defaultByte, where, gapLength, exclusive); int num = offsets.length; for (int i = 0; i < num; i++) offsets[i] = shiftOffset(p, offsets[i], where, gapLength, exclusive); super.shift(where, gapLength, exclusive); }
void shiftForSwitch(int where, int gapLength) throws BadBytecode { if (stack != null) stack.shiftForSwitch(where, gapLength); if (stack2 != null) stack2.shiftForSwitch(where, gapLength); } }
private void addPutstatic0(CtClass target, String classname, String fieldName, String desc) { add(PUTSTATIC); // target is null if it represents THIS. int ci = classname == null ? constPool.addClassInfo(target) : constPool.addClassInfo(classname); addIndex(constPool.addFieldrefInfo(ci, fieldName, desc)); growStack(-Descriptor.dataSize(desc)); }
/** * Adds a new entry of <code>exception_table</code>. * * @param type the fully-qualified name of a throwable class. */ public void addExceptionHandler(int start, int end, int handler, String type) { addExceptionHandler(start, end, handler, constPool.addClassInfo(type)); }