Example usage for org.objectweb.asm Opcodes NEW

List of usage examples for org.objectweb.asm Opcodes NEW

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes NEW.

Prototype

int NEW

To view the source code for org.objectweb.asm Opcodes NEW.

Click Source Link

Usage

From source file:uk.ac.cam.cl.dtg.teaching.programmingtest.java.bytecode.InstructionCounterMethodAdapter.java

License:Open Source License

/** Deal with: NEW, ANEWARRAY. */
@Override//  w  w  w .  ja v  a  2s.  co  m
public void visitTypeInsn(int opcode, String type) {
    if (opcode == Opcodes.NEW) {
        // an object allocation consists of a new and a call to the constructor. Here we set a flag
        // which tells us to count the following constructor call (<init>) as an allocation.
        waitForInit = true;
    }
    mv.visitTypeInsn(opcode, type);
}