/** * Begin writing an exception handler block. The handler is not actually persisted until exceptionHandler is called. */ public ExceptionHandler exceptionBlockStart(String exceptionType) { ExceptionHandler handler = new ExceptionHandler(currentOffset, constPool.addClassEntry(exceptionType), exceptionType, currentFrame); return handler; }
public DoubleAnnotationValue(ConstPool constPool, String name, double value) { super(constPool, name); this.value = value; this.valueIndex = constPool.addDoubleEntry(value); }
public FloatAnnotationValue(ConstPool constPool, String name, float value) { super(constPool, name); this.value = value; this.valueIndex = constPool.addFloatEntry(value); }
public short addInterfaceMethodEntry(String className, String methodName, String descriptor) { final NameAndType nameAndType = new NameAndType(methodName, descriptor); final MemberInfo method = new MemberInfo(className, nameAndType); if (interfaceMethodLocations.containsKey(method)) { return interfaceMethodLocations.get(method); } final short nameAndTypeIndex = addNameAndTypeEntry(methodName, descriptor); final short classIndex = addClassEntry(className); final short index = count++; constPoolSize++; entries.put(index, new InterfaceMethodRefEntry(classIndex, nameAndTypeIndex)); interfaceMethodLocations.put(method, index); return index; }
public ShortAnnotationValue(ConstPool constPool, String name, short value) { super(constPool, name); this.value = value; this.valueIndex = constPool.addIntegerEntry(value); }
public void getstatic(String className, String field, String descriptor) { int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.GETSTATIC); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.push(descriptor)); }
private void invokestatic(String className, String methodName, String descriptor, String returnType, String[] parameterTypes) { // TODO: validate stack int method = constPool.addMethodEntry(className, methodName, descriptor); writeByte(Opcode.INVOKESTATIC); writeShort(method); currentOffset += 3; int pop = parameterTypes.length; for (String argument : parameterTypes) { if (argument.equals("D") || argument.equals("J")) { pop++; } } if (returnType.equals("V")) { advanceFrame(currentFrame.pop(pop)); } else { advanceFrame(currentFrame.pop(pop).push(returnType)); } }
public LongAnnotationValue(ConstPool constPool, String name, long value) { super(constPool, name); this.value = value; this.valueIndex = constPool.addLongEntry(value); }
/** * Adds an ldc instruction for a String * <p/> * To load a class literal using ldc use the @{link #loadType(String)} method. */ public void ldc(String value) { int index = constPool.addStringEntry(value); ldcInternal(index); advanceFrame(currentFrame.push("Ljava/lang/String;")); }
private void invokeinterface(String className, String methodName, String descriptor, String returnType, String[] parameterTypes) { // TODO: validate stack int pop = 1 + parameterTypes.length; for (String argument : parameterTypes) { if (argument.equals("D") || argument.equals("J")) { pop++; } } int method = constPool.addInterfaceMethodEntry(className, methodName, descriptor); writeByte(Opcode.INVOKEINTERFACE); writeShort(method); writeByte(pop); writeByte(0); currentOffset += 5; if (returnType.equals("V")) { advanceFrame(currentFrame.pop(pop)); } else { advanceFrame(currentFrame.pop(pop).push(returnType)); } }
public Integer addInterfaceMethodEntry(String className, String methodName, String descriptor) { final NameAndType nameAndType = new NameAndType(methodName, descriptor); final MemberInfo method = new MemberInfo(className, nameAndType); if (interfaceMethodLocations.containsKey(method)) { return interfaceMethodLocations.get(method); } final Integer nameAndTypeIndex = addNameAndTypeEntry(methodName, descriptor); final Integer classIndex = addClassEntry(className); final Integer index = count++; constPoolSize++; entries.put(index, new InterfaceMethodRefEntry(classIndex, nameAndTypeIndex)); interfaceMethodLocations.put(method, index); return index; }
public ShortAnnotationValue(ConstPool constPool, String name, short value) { super(constPool, name); this.value = value; this.valueIndex = constPool.addIntegerEntry(value); }
public void getstatic(String className, String field, String descriptor) { int index = constPool.addFieldEntry(className, field, descriptor); writeByte(Opcode.GETSTATIC); writeShort(index); currentOffset += 3; advanceFrame(currentFrame.push(descriptor)); }
private void invokestatic(String className, String methodName, String descriptor, String returnType, String[] parameterTypes) { // TODO: validate stack int method = constPool.addMethodEntry(className, methodName, descriptor); writeByte(Opcode.INVOKESTATIC); writeShort(method); currentOffset += 3; int pop = parameterTypes.length; for (String argument : parameterTypes) { if (argument.equals("D") || argument.equals("J")) { pop++; } } if (returnType.equals("V")) { advanceFrame(currentFrame.pop(pop)); } else { advanceFrame(currentFrame.pop(pop).push(returnType)); } }
public LongAnnotationValue(ConstPool constPool, String name, long value) { super(constPool, name); this.value = value; this.valueIndex = constPool.addLongEntry(value); }
/** * Adds an ldc instruction for a String * <p/> * To load a class literal using ldc use the @{link #loadType(String)} method. */ public void ldc(String value) { int index = constPool.addStringEntry(value); ldcInternal(index); advanceFrame(currentFrame.push("Ljava/lang/String;")); }
private void invokeinterface(String className, String methodName, String descriptor, String returnType, String[] parameterTypes) { // TODO: validate stack int pop = 1 + parameterTypes.length; for (String argument : parameterTypes) { if (argument.equals("D") || argument.equals("J")) { pop++; } } int method = constPool.addInterfaceMethodEntry(className, methodName, descriptor); writeByte(Opcode.INVOKEINTERFACE); writeShort(method); writeByte(pop); writeByte(0); currentOffset += 5; if (returnType.equals("V")) { advanceFrame(currentFrame.pop(pop)); } else { advanceFrame(currentFrame.pop(pop).push(returnType)); } }
public Integer addFieldEntry(String className, String fieldName, String fieldType) { final NameAndType nameAndType = new NameAndType(fieldName, fieldType); final MemberInfo field = new MemberInfo(className, nameAndType); if (fieldLocations.containsKey(field)) { return fieldLocations.get(field); } final Integer nameAndTypeIndex = addNameAndTypeEntry(fieldName, fieldType); final Integer classIndex = addClassEntry(className); final Integer index = count++; constPoolSize++; entries.put(index, new FieldRefEntry(classIndex, nameAndTypeIndex)); fieldLocations.put(field, index); return index; }
public IntAnnotationValue(ConstPool constPool, String name, int value) { super(constPool, name); this.value = value; this.valueIndex = constPool.addIntegerEntry(value); }
/** * Begin writing an exception handler block. The handler is not actually persisted until exceptionHandler is called. */ public ExceptionHandler exceptionBlockStart(String exceptionType) { return new ExceptionHandler(currentOffset, constPool.addClassEntry(exceptionType), exceptionType, currentFrame); }