Example usage for org.objectweb.asm ClassWriter newInvokeDynamic

List of usage examples for org.objectweb.asm ClassWriter newInvokeDynamic

Introduction

In this page you can find the example usage for org.objectweb.asm ClassWriter newInvokeDynamic.

Prototype

public int newInvokeDynamic(final String name, final String descriptor, final Handle bootstrapMethodHandle,
        final Object... bootstrapMethodArguments) 

Source Link

Document

Adds an invokedynamic reference to the constant pool of the class being build.

Usage

From source file:com.geeksaga.light.profiler.util.Constant.java

License:Apache License

void write(final ClassWriter cw) {
    switch (type) {
    case 'I':
        cw.newConst(intVal);//from w w w .ja v a 2s  . co m
        break;
    case 'J':
        cw.newConst(longVal);
        break;
    case 'F':
        cw.newConst(floatVal);
        break;
    case 'D':
        cw.newConst(doubleVal);
        break;
    case 'S':
        cw.newConst(strVal1);
        break;
    case 's':
        cw.newUTF8(strVal1);
        break;
    case 'C':
        cw.newClass(strVal1);
        break;
    case 'T':
        cw.newNameType(strVal1, strVal2);
        break;
    case 'G':
        cw.newField(strVal1, strVal2, (String) objVal3);
        break;
    case 'M':
        cw.newMethod(strVal1, strVal2, (String) objVal3, false);
        break;
    case 'N':
        cw.newMethod(strVal1, strVal2, (String) objVal3, true);
        break;
    case 'y':
        cw.newInvokeDynamic(strVal1, strVal2, (Handle) objVal3, objVals);
        break;
    case 't':
        cw.newMethodType(strVal1);
        break;
    default: // 'h' ... 'p': handle
        cw.newHandle(type - 'h' + 1, strVal1, strVal2, (String) objVal3);
    }
}