Example usage for org.objectweb.asm.commons GeneratorAdapter mark

List of usage examples for org.objectweb.asm.commons GeneratorAdapter mark

Introduction

In this page you can find the example usage for org.objectweb.asm.commons GeneratorAdapter mark.

Prototype

public void mark(final Label label) 

Source Link

Document

Marks the current code position with the given label.

Usage

From source file:co.cask.cdap.internal.io.DatumWriterGenerator.java

License:Apache License

/**
 * Generates the constructor. The constructor generated has signature {@code (Schema, FieldAccessorFactory)}.
 *//*  w  w  w .ja v  a  2  s .  c  o m*/
private void generateConstructor() {
    Method constructor = getMethod(void.class, "<init>", Schema.class, FieldAccessorFactory.class);

    // Constructor(Schema schema, FieldAccessorFactory accessorFactory)
    GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, constructor, null, null, classWriter);

    // super(); // Calling Object constructor
    mg.loadThis();
    mg.invokeConstructor(Type.getType(Object.class), getMethod(void.class, "<init>"));

    // if (!SCHEMA_HASH.equals(schema.getSchemaHash().toString())) { throw IllegalArgumentException }
    mg.getStatic(classType, "SCHEMA_HASH", Type.getType(String.class));
    mg.loadArg(0);
    mg.invokeVirtual(Type.getType(Schema.class), getMethod(SchemaHash.class, "getSchemaHash"));
    mg.invokeVirtual(Type.getType(SchemaHash.class), getMethod(String.class, "toString"));
    mg.invokeVirtual(Type.getType(String.class), getMethod(boolean.class, "equals", Object.class));
    Label hashEquals = mg.newLabel();
    mg.ifZCmp(GeneratorAdapter.NE, hashEquals);
    mg.throwException(Type.getType(IllegalArgumentException.class), "Schema not match.");
    mg.mark(hashEquals);

    // this.schema = schema;
    mg.loadThis();
    mg.loadArg(0);
    mg.putField(classType, "schema", Type.getType(Schema.class));

    // For each record field that needs an accessor, get the accessor and store it in field.
    for (Map.Entry<TypeToken<?>, String> entry : fieldAccessorRequests.entries()) {
        String fieldAccessorName = getFieldAccessorName(entry.getKey(), entry.getValue());

        classWriter.visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL, fieldAccessorName,
                Type.getDescriptor(FieldAccessor.class), null, null);
        // this.fieldAccessorName
        //  = accessorFactory.getFieldAccessor(TypeToken.of(Class.forName("className")), "fieldName");
        mg.loadThis();
        mg.loadArg(1);
        mg.push(entry.getKey().getRawType().getName());
        mg.invokeStatic(Type.getType(Class.class), getMethod(Class.class, "forName", String.class));
        mg.invokeStatic(Type.getType(TypeToken.class), getMethod(TypeToken.class, "of", Class.class));
        mg.push(entry.getValue());
        mg.invokeInterface(Type.getType(FieldAccessorFactory.class),
                getMethod(FieldAccessor.class, "getFieldAccessor", TypeToken.class, String.class));
        mg.putField(classType, fieldAccessorName, Type.getType(FieldAccessor.class));
    }

    mg.returnValue();
    mg.endMethod();
}

From source file:co.cask.cdap.internal.io.DatumWriterGenerator.java

License:Apache License

/**
 * Generates method body for encoding java class. If the class given is an interface,
 * getter method will be used to access the field values, otherwise, it will assumes
 * fields are public.//w ww.jav  a2s .c  o  m
 *
 * @param mg
 * @param schema
 * @param outputType
 * @param value
 * @param encoder
 * @param schemaLocal
 * @param seenRefs
 */
private void encodeRecord(GeneratorAdapter mg, Schema schema, TypeToken<?> outputType, int value, int encoder,
        int schemaLocal, int seenRefs) {

    try {
        Class<?> rawType = outputType.getRawType();

        // Record type might be defined by the user, hence need to preserve class loading of it
        preservedClasses.add(rawType);
        boolean isInterface = rawType.isInterface();

        /*
          Check for circular reference
          if (value != null && !seenRefs.add(value)) {
             throw new IOException(...);
          }
        */
        Label notSeen = mg.newLabel();
        mg.loadArg(value);
        mg.ifNull(notSeen);
        mg.loadArg(seenRefs);
        mg.loadArg(value);
        mg.invokeInterface(Type.getType(Set.class), getMethod(boolean.class, "add", Object.class));
        mg.ifZCmp(GeneratorAdapter.NE, notSeen);
        mg.throwException(Type.getType(IOException.class), "Circular reference not supported.");
        mg.mark(notSeen);

        // Store the list of schema fields.
        mg.loadArg(schemaLocal);
        mg.invokeVirtual(Type.getType(Schema.class), getMethod(List.class, "getFields"));
        int fieldSchemas = mg.newLocal(Type.getType(List.class));
        mg.storeLocal(fieldSchemas);

        // For each field, call the encode method for the field
        List<Schema.Field> fields = schema.getFields();
        for (int i = 0; i < fields.size(); i++) {
            Schema.Field field = fields.get(i);

            TypeToken<?> fieldType;

            // this.encodeFieldMethod(value.fieldName, encoder, fieldSchemas.get(i).getSchema());
            if (isInterface) {
                mg.loadThis();
                mg.loadArg(value);
                Method getter = getGetter(outputType, field.getName());
                fieldType = outputType.resolveType(rawType.getMethod(getter.getName()).getGenericReturnType());
                mg.invokeInterface(Type.getType(rawType), getter);
            } else {
                fieldType = outputType
                        .resolveType(Fields.findField(outputType.getType(), field.getName()).getGenericType());
                fieldAccessorRequests.put(outputType, field.getName());
                mg.loadThis();
                mg.dup();
                mg.getField(classType, getFieldAccessorName(outputType, field.getName()),
                        Type.getType(FieldAccessor.class));
                mg.loadArg(value);
                mg.invokeInterface(Type.getType(FieldAccessor.class), getAccessorMethod(fieldType));
                if (!fieldType.getRawType().isPrimitive()) {
                    doCast(mg, fieldType, field.getSchema());
                }
            }
            mg.loadArg(encoder);
            mg.loadLocal(fieldSchemas);
            mg.push(i);
            mg.invokeInterface(Type.getType(List.class), getMethod(Object.class, "get", int.class));
            mg.checkCast(Type.getType(Schema.Field.class));
            mg.invokeVirtual(Type.getType(Schema.Field.class), getMethod(Schema.class, "getSchema"));
            mg.loadArg(seenRefs);
            mg.invokeVirtual(classType, getEncodeMethod(fieldType, field.getSchema()));
        }
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

From source file:co.cask.cdap.internal.io.DatumWriterGenerator.java

License:Apache License

/**
 * Generates method body for encoding union schema. Union schema is used for representing object references that
 * could be {@code null}./*from www  .j  a v a 2  s.  c o m*/
 * @param mg
 * @param outputType
 * @param schema
 * @param value
 * @param encoder
 * @param schemaLocal
 * @param seenRefs
 */
private void encodeUnion(GeneratorAdapter mg, TypeToken<?> outputType, Schema schema, int value, int encoder,
        int schemaLocal, int seenRefs) {
    Label nullLabel = mg.newLabel();
    Label endLabel = mg.newLabel();
    mg.loadArg(value);

    mg.ifNull(nullLabel);
    // Not null, write out 0 and then encode the value
    encodeInt(mg, 0, encoder);

    mg.loadThis();
    mg.loadArg(value);
    doCast(mg, outputType, schema.getUnionSchema(0));
    mg.loadArg(encoder);
    mg.loadArg(schemaLocal);
    mg.push(0);
    mg.invokeVirtual(Type.getType(Schema.class), getMethod(Schema.class, "getUnionSchema", int.class));
    mg.loadArg(seenRefs);
    mg.invokeVirtual(classType, getEncodeMethod(outputType, schema.getUnionSchema(0)));

    mg.goTo(endLabel);

    mg.mark(nullLabel);
    // Null, write out 1
    encodeInt(mg, 1, encoder);
    mg.mark(endLabel);
}

From source file:co.cask.cdap.internal.io.FieldAccessorGenerator.java

License:Apache License

private void initializeReflectionField(GeneratorAdapter mg, Field field) {
    /*/*w  w w.  j  a  v a2s.c  o  m*/
     Save the reflected Field object for accessing private field.
     try {
       Field field = Fields.findField(classType, "fieldName");
       field.setAccessible(true);
            
       this.field = field;
     } catch (Exception e) {
       throw Throwables.propagate(e);
     }
    */
    Label beginTry = mg.newLabel();
    Label endTry = mg.newLabel();
    Label catchHandle = mg.newLabel();
    mg.visitTryCatchBlock(beginTry, endTry, catchHandle, Type.getInternalName(Exception.class));
    mg.mark(beginTry);

    // Field field = Fields.findField(classType, "fieldName")
    mg.loadArg(0);
    mg.push(field.getName());
    mg.invokeStatic(Type.getType(Fields.class),
            getMethod(Field.class, "findField", java.lang.reflect.Type.class, String.class));
    mg.dup();

    // field.setAccessible(true);
    mg.push(true);
    mg.invokeVirtual(Type.getType(Field.class), getMethod(void.class, "setAccessible", boolean.class));

    // this.field = field;
    // need to swap the this reference and the one in top stack (from dup() ).
    mg.loadThis();
    mg.swap();
    mg.putField(Type.getObjectType(className), "field", Type.getType(Field.class));
    mg.mark(endTry);
    Label endCatch = mg.newLabel();
    mg.goTo(endCatch);
    mg.mark(catchHandle);
    int exception = mg.newLocal(Type.getType(IllegalAccessException.class));
    mg.storeLocal(exception);
    mg.loadLocal(exception);
    mg.invokeStatic(Type.getType(Throwables.class),
            getMethod(RuntimeException.class, "propagate", Throwable.class));
    mg.throwException();
    mg.mark(endCatch);
}

From source file:co.cask.cdap.internal.io.FieldAccessorGenerator.java

License:Apache License

/**
 * Generates the try-catch block that wrap around the given reflection method call.
 * @param method The method to be called within the try-catch block.
 *///w w w. j  av a 2s  .  c o  m
private void invokeReflection(Method method, String signature) {
    GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, method, signature, new Type[0], classWriter);
    /**
     * try {
     *   // Call method
     * } catch (IllegalAccessException e) {
     *   throw Throwables.propagate(e);
     * }
     */
    Label beginTry = mg.newLabel();
    Label endTry = mg.newLabel();
    Label catchHandle = mg.newLabel();
    mg.visitTryCatchBlock(beginTry, endTry, catchHandle, Type.getInternalName(IllegalAccessException.class));
    mg.mark(beginTry);
    mg.loadThis();
    mg.getField(Type.getObjectType(className), "field", Type.getType(Field.class));
    mg.loadArgs();
    mg.invokeVirtual(Type.getType(Field.class), method);
    mg.mark(endTry);
    mg.returnValue();
    mg.mark(catchHandle);
    int exception = mg.newLocal(Type.getType(IllegalAccessException.class));
    mg.storeLocal(exception);
    mg.loadLocal(exception);
    mg.invokeStatic(Type.getType(Throwables.class),
            getMethod(RuntimeException.class, "propagate", Throwable.class));
    mg.throwException();
    mg.endMethod();

}

From source file:co.cask.common.internal.io.DatumWriterGenerator.java

License:Apache License

/**
 * Generates method body for encoding java class. If the class given is an interface,
 * getter method will be used to access the field values, otherwise, it will assumes
 * fields are public.//from  www  .  j av a 2 s  .co  m
 *
 * @param mg
 * @param schema
 * @param outputType
 * @param value
 * @param encoder
 * @param schemaLocal
 * @param seenRefs
 */
private void encodeRecord(GeneratorAdapter mg, Schema schema, TypeToken<?> outputType, int value, int encoder,
        int schemaLocal, int seenRefs) {

    try {
        Class<?> rawType = outputType.getRawType();

        // Record type might be defined by the user, hence need to preserve class loading of it
        preservedClasses.add(rawType);
        boolean isInterface = rawType.isInterface();

        /*
          Check for circular reference
          if (value != null && !seenRefs.add(value)) {
             throw new IOException(...);
          }
        */
        Label notSeen = mg.newLabel();
        mg.loadArg(value);
        mg.ifNull(notSeen);
        mg.loadArg(seenRefs);
        mg.loadArg(value);
        mg.invokeInterface(Type.getType(Set.class), getMethod(boolean.class, "add", Object.class));
        mg.ifZCmp(GeneratorAdapter.NE, notSeen);
        mg.throwException(Type.getType(IOException.class), "Circular reference not supported.");
        mg.mark(notSeen);

        // Store the list of schema fields.
        mg.loadArg(schemaLocal);
        mg.invokeVirtual(Type.getType(Schema.class), getMethod(List.class, "getFields"));
        int fieldSchemas = mg.newLocal(Type.getType(List.class));
        mg.storeLocal(fieldSchemas);

        // For each field, call the encode method for the field
        List<Schema.Field> fields = schema.getFields();
        for (int i = 0; i < fields.size(); i++) {
            Schema.Field field = fields.get(i);

            TypeToken<?> fieldType;

            // this.encodeFieldMethod(value.fieldName, encoder, fieldSchemas.get(i).getSchema());
            if (isInterface) {
                mg.loadThis();
                mg.loadArg(value);
                Method getter = getGetter(outputType, field.getName());
                fieldType = outputType.resolveType(rawType.getMethod(getter.getName()).getGenericReturnType());
                mg.invokeInterface(Type.getType(rawType), getter);
            } else {
                fieldType = outputType
                        .resolveType(Fields.findField(outputType, field.getName()).getGenericType());
                fieldAccessorRequests.put(outputType, field.getName());
                mg.loadThis();
                mg.dup();
                mg.getField(classType, getFieldAccessorName(outputType, field.getName()),
                        Type.getType(FieldAccessor.class));
                mg.loadArg(value);
                mg.invokeInterface(Type.getType(FieldAccessor.class), getAccessorMethod(fieldType));
                if (!fieldType.getRawType().isPrimitive()) {
                    doCast(mg, fieldType, field.getSchema());
                }
            }
            mg.loadArg(encoder);
            mg.loadLocal(fieldSchemas);
            mg.push(i);
            mg.invokeInterface(Type.getType(List.class), getMethod(Object.class, "get", int.class));
            mg.checkCast(Type.getType(Schema.Field.class));
            mg.invokeVirtual(Type.getType(Schema.Field.class), getMethod(Schema.class, "getSchema"));
            mg.loadArg(seenRefs);
            mg.invokeVirtual(classType, getEncodeMethod(fieldType, field.getSchema()));
        }
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

From source file:co.cask.common.internal.io.FieldAccessorGenerator.java

License:Apache License

private void initializeReflectionField(GeneratorAdapter mg, Field field) {
    /*//from w  w w .j av  a2  s  .com
     Save the reflected Field object for accessing private field.
     try {
       Field field = Fields.findField(classType, "fieldName");
       field.setAccessible(true);
            
       this.field = field;
     } catch (Exception e) {
       throw Throwables.propagate(e);
     }
    */
    Label beginTry = mg.newLabel();
    Label endTry = mg.newLabel();
    Label catchHandle = mg.newLabel();
    mg.visitTryCatchBlock(beginTry, endTry, catchHandle, Type.getInternalName(Exception.class));
    mg.mark(beginTry);

    // Field field = findField(classType, "fieldName")
    mg.loadArg(0);
    mg.push(field.getName());
    mg.invokeStatic(Type.getType(Fields.class),
            getMethod(Field.class, "findField", TypeToken.class, String.class));
    mg.dup();

    // field.setAccessible(true);
    mg.push(true);
    mg.invokeVirtual(Type.getType(Field.class), getMethod(void.class, "setAccessible", boolean.class));

    // this.field = field;
    // need to swap the this reference and the one in top stack (from dup() ).
    mg.loadThis();
    mg.swap();
    mg.putField(Type.getObjectType(className), "field", Type.getType(Field.class));
    mg.mark(endTry);
    Label endCatch = mg.newLabel();
    mg.goTo(endCatch);
    mg.mark(catchHandle);
    int exception = mg.newLocal(Type.getType(IllegalAccessException.class));
    mg.storeLocal(exception);
    mg.loadLocal(exception);
    mg.invokeStatic(Type.getType(Throwables.class),
            getMethod(RuntimeException.class, "propagate", Throwable.class));
    mg.throwException();
    mg.mark(endCatch);
}

From source file:co.cask.tigon.internal.io.DatumWriterGenerator.java

License:Apache License

/**
 * Generates method body for encoding java class. If the class given is an interface,
 * getter method will be used to access the field values, otherwise, it will assumes
 * fields are public./*w  w w  .  j  a  v  a  2 s  .  c om*/
 *
 * @param mg
 * @param schema
 * @param outputType
 * @param value
 * @param encoder
 * @param schemaLocal
 * @param seenRefs
 */
private void encodeRecord(GeneratorAdapter mg, Schema schema, TypeToken<?> outputType, int value, int encoder,
        int schemaLocal, int seenRefs) {

    try {
        Class<?> rawType = outputType.getRawType();
        boolean isInterface = rawType.isInterface();

        /*
          Check for circular reference
          if (value != null && !seenRefs.add(value)) {
             throw new IOException(...);
          }
        */
        Label notSeen = mg.newLabel();
        mg.loadArg(value);
        mg.ifNull(notSeen);
        mg.loadArg(seenRefs);
        mg.loadArg(value);
        mg.invokeInterface(Type.getType(Set.class), getMethod(boolean.class, "add", Object.class));
        mg.ifZCmp(GeneratorAdapter.NE, notSeen);
        mg.throwException(Type.getType(IOException.class), "Circular reference not supported.");
        mg.mark(notSeen);

        // Store the list of schema fields.
        mg.loadArg(schemaLocal);
        mg.invokeVirtual(Type.getType(Schema.class), getMethod(List.class, "getFields"));
        int fieldSchemas = mg.newLocal(Type.getType(List.class));
        mg.storeLocal(fieldSchemas);

        // For each field, call the encode method for the field
        List<Schema.Field> fields = schema.getFields();
        for (int i = 0; i < fields.size(); i++) {
            Schema.Field field = fields.get(i);

            TypeToken<?> fieldType;

            // this.encodeFieldMethod(value.fieldName, encoder, fieldSchemas.get(i).getSchema());
            if (isInterface) {
                mg.loadThis();
                mg.loadArg(value);
                Method getter = getGetter(outputType, field.getName());
                fieldType = outputType.resolveType(rawType.getMethod(getter.getName()).getGenericReturnType());
                mg.invokeInterface(Type.getType(rawType), getter);
            } else {
                fieldType = outputType
                        .resolveType(Fields.findField(outputType, field.getName()).getGenericType());
                fieldAccessorRequests.put(outputType, field.getName());
                mg.loadThis();
                mg.dup();
                mg.getField(classType, getFieldAccessorName(outputType, field.getName()),
                        Type.getType(FieldAccessor.class));
                mg.loadArg(value);
                mg.invokeInterface(Type.getType(FieldAccessor.class), getAccessorMethod(fieldType));
                if (!fieldType.getRawType().isPrimitive()) {
                    doCast(mg, fieldType, field.getSchema());
                }
            }
            mg.loadArg(encoder);
            mg.loadLocal(fieldSchemas);
            mg.push(i);
            mg.invokeInterface(Type.getType(List.class), getMethod(Object.class, "get", int.class));
            mg.checkCast(Type.getType(Schema.Field.class));
            mg.invokeVirtual(Type.getType(Schema.Field.class), getMethod(Schema.class, "getSchema"));
            mg.loadArg(seenRefs);
            mg.invokeVirtual(classType, getEncodeMethod(fieldType, field.getSchema()));
        }
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

From source file:com.alibaba.hotswap.processor.constructor.ConstructorVisitor.java

License:Open Source License

@SuppressWarnings({ "unchecked" })
private void addUniformConstructor(ClassMeta classMeta) {
    int access = Opcodes.ACC_PUBLIC + Opcodes.ACC_SYNTHETIC;
    String name = HotswapConstants.INIT;
    String desc = HotswapConstants.UNIFORM_CONSTRUCTOR_DESC;

    MethodVisitor hotswapInit = new ConstructorInvokeModifier(cv.visitMethod(access, name, desc, null, null),
            access, name, desc);/*  w w w.jav  a2s .  com*/
    GeneratorAdapter hotswapInitAdapter = new GeneratorAdapter(hotswapInit, access, name, desc);

    hotswapInitAdapter.visitCode();

    TreeMap<MethodMeta, MethodNode> initMethodMap = new TreeMap<MethodMeta, MethodNode>(
            new ConstructorIndexComparator());

    for (MethodNode node : initNodes.values()) {
        MethodMeta meta = new MethodMeta(node.access, node.name, node.desc, node.signature,
                ((String[]) node.exceptions.toArray(new String[node.exceptions.size()])));
        meta.setIndex(HotswapMethodIndexHolder.getMethodIndex(className, node.name, node.desc));
        classMeta.refreshInitMeta(meta, true);
        initMethodMap.put(meta, node);
    }

    List<MethodMeta> keys = new ArrayList<MethodMeta>(initMethodMap.keySet());
    List<MethodNode> values = new ArrayList<MethodNode>(initMethodMap.values());

    Label defaultLabel = new Label();
    int[] indexes = new int[keys.size()];
    Label[] labels = new Label[keys.size()];

    for (int i = 0; i < keys.size(); i++) {
        indexes[i] = keys.get(i).getIndex();
        labels[i] = new Label();
    }

    for (int i = 0; i < values.size(); i++) {
        MethodNode node = values.get(i);
        for (int j = 0; j < node.tryCatchBlocks.size(); j++) {
            ((TryCatchBlockNode) node.tryCatchBlocks.get(j)).accept(hotswapInitAdapter);
        }
    }

    hotswapInitAdapter.loadArg(1);
    hotswapInitAdapter.visitLookupSwitchInsn(defaultLabel, indexes, labels);

    for (int i = 0; i < keys.size(); i++) {
        MethodMeta methodMeta = keys.get(i);
        hotswapInitAdapter.visitLabel(labels[i]);
        MethodNode node = values.get(i);

        storeArgs(hotswapInitAdapter, hotswapInit, methodMeta);
        MethodVisitor methodVisitor = new ConstructorLVTAdjustModifier(hotswapInit, 3);

        node.instructions.accept(methodVisitor);

        for (int j = 0; j < (node.localVariables == null ? 0 : node.localVariables.size()); j++) {
            ((LocalVariableNode) node.localVariables.get(j)).accept(methodVisitor);
        }
    }
    hotswapInitAdapter.mark(defaultLabel);

    hotswapInitAdapter.push(this.className);
    hotswapInitAdapter.loadArg(1);
    hotswapInitAdapter.invokeStatic(Type.getType(HotswapMethodUtil.class),
            Method.getMethod("Throwable noSuchMethodError(String, int)"));
    hotswapInitAdapter.throwException();
    hotswapInitAdapter.endMethod();
}

From source file:de.enough.polish.postcompile.java5.Java5ClassVisitor.java

License:Open Source License

public void visitEnd() {
    if (this.isEnumClass) {
        if (this.name_values == null) {
            throw new BuildException("This is not an enum class: " + this.classDesc);
        }//www .j ava  2  s  .  c  o  m

        // Generate new <clinit> method.
        int numValues = EnumManager.getInstance().getNumEnumValues(this.classDesc);
        Method m = Method.getMethod("void <clinit> ()");
        MethodVisitor mv = super.visitMethod(ACC_STATIC, "<clinit>", "()V", null, null);
        GeneratorAdapter mg = new GeneratorAdapter(ACC_STATIC, m, mv);
        mg.push(numValues);
        mg.newArray(Type.INT_TYPE);

        if (numValues <= 3) {
            for (int i = 1; i < numValues; i++) {
                mg.dup();
                mg.push(i);
                mg.push(i);
                mg.arrayStore(Type.INT_TYPE);
            }
        } else {
            Label labelInitializeField = new Label();
            Label labelCheck = new Label();
            Label labelDone = new Label();

            mg.push(1);
            mg.storeLocal(0, Type.INT_TYPE);
            mg.goTo(labelCheck);

            mg.mark(labelInitializeField);
            mg.dup();
            mg.loadLocal(0, Type.INT_TYPE);
            mg.dup();
            mg.arrayStore(Type.INT_TYPE);
            mg.iinc(0, 1);

            mg.mark(labelCheck);
            mg.loadLocal(0, Type.INT_TYPE);
            mg.push(numValues);
            mg.ifICmp(GeneratorAdapter.LT, labelInitializeField);

            mg.mark(labelDone);
        }

        mg.putStatic(Type.getType(this.classDesc), this.name_values, Type.getType(int[].class));
        mg.returnValue();
        mg.endMethod();
    }

    // Called super implementation of this method to really close this class.
    super.visitEnd();
}