org.objectweb.asm.FieldVisitor Java Examples

The following examples show how to use org.objectweb.asm.FieldVisitor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamicEntityGenerator.java    From we-cmdb with Apache License 2.0 6 votes vote down vote up
private static void writeField(ClassWriter classWriter, FieldNode field) {
    FieldVisitor fieldVisitor;
    if (field.isJoinNode()) {
        if (EntityRelationship.ManyToOne.equals(field.getEntityRelationship())) {
            fieldVisitor = classWriter.visitField(ACC_PRIVATE, field.getName(), field.getTypeDesc(), null, null);
        } else { // OneToMany or ManyToMany
            fieldVisitor = classWriter.visitField(ACC_PRIVATE, field.getName(), "Ljava/util/Set;", getTypeSiganitureForOneToMany(field.getTypeDesc()), null);
        }
        // ignore join field for json
        AnnotationVisitor annotationVisitor0 = fieldVisitor.visitAnnotation("Lcom/fasterxml/jackson/annotation/JsonIgnore;", true);
        annotationVisitor0.visitEnd();
    } else {
        fieldVisitor = classWriter.visitField(ACC_PRIVATE, field.getName(), typeMap.get(field.getType()), null, null);
    }
    fieldVisitor.visitEnd();
}
 
Example #2
Source File: InterfaceDesugaring.java    From bazel with Apache License 2.0 6 votes vote down vote up
@Override
public FieldVisitor visitField(
    int access, String name, String desc, String signature, Object value) {
  if (legacyJaCoCo
      && isInterface()
      && BitFlags.isSet(access, Opcodes.ACC_FINAL)
      && "$jacocoData".equals(name)) {
    // Move $jacocoData field to companion class and remove final modifier. We'll rewrite field
    // accesses accordingly. Code generated by older JaCoCo versions tried to assign to this
    // final field in methods, and interface fields have to be private, so we move the field
    // to a class, which ends up looking pretty similar to what JaCoCo generates for classes.
    access &= ~Opcodes.ACC_FINAL;
    return companion().visitField(access, name, desc, signature, value);
  } else {
    return super.visitField(access, name, desc, signature, value);
  }
}
 
Example #3
Source File: ClassVisitorDriverFromElement.java    From buck with Apache License 2.0 6 votes vote down vote up
@Override
public Void visitVariable(VariableElement e, ClassVisitor classVisitor) {
  if (e.getModifiers().contains(Modifier.PRIVATE)) {
    return null;
  }

  FieldVisitor fieldVisitor =
      classVisitor.visitField(
          accessFlagsUtils.getAccessFlags(e),
          e.getSimpleName().toString(),
          descriptorFactory.getDescriptor(e),
          signatureFactory.getSignature(e),
          e.getConstantValue());
  visitAnnotations(e, fieldVisitor::visitAnnotation);
  fieldVisitor.visitEnd();

  return null;
}
 
Example #4
Source File: SootClassBuilder.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name,
		String desc, String signature, Object value) {
	soot.Type type = AsmUtil.toJimpleType(desc);
	addDep(type);
	SootField field = new SootField(name, type, access);
	Tag tag;
	if (value instanceof Integer)
		tag = new IntegerConstantValueTag((Integer) value);
	else if (value instanceof Float)
		tag = new FloatConstantValueTag((Float) value);
	else if (value instanceof Long)
		tag = new LongConstantValueTag((Long) value);
	else if (value instanceof Double)
		tag = new DoubleConstantValueTag((Double) value);
	else if (value instanceof String)
		tag = new StringConstantValueTag(value.toString());
	else
		tag = null;
	if (tag != null)
		field.addTag(tag);
	if (signature != null)
		field.addTag(new SignatureTag(signature));
	klass.addField(field);
	return new FieldBuilder(field, this);
}
 
Example #5
Source File: CheckClassAdapter.java    From JByteMod-Beta with GNU General Public License v2.0 6 votes vote down vote up
@Override
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) {
  checkState();
  checkAccess(access, Opcodes.ACC_PUBLIC + Opcodes.ACC_PRIVATE + Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL
      + Opcodes.ACC_VOLATILE + Opcodes.ACC_TRANSIENT + Opcodes.ACC_SYNTHETIC + Opcodes.ACC_ENUM + Opcodes.ACC_DEPRECATED + 0x40000); // ClassWriter.ACC_SYNTHETIC_ATTRIBUTE
  CheckMethodAdapter.checkUnqualifiedName(version, name, "field name");
  CheckMethodAdapter.checkDesc(desc, false);
  if (signature != null) {
    checkFieldSignature(signature);
  }
  if (value != null) {
    CheckMethodAdapter.checkConstant(value);
  }
  FieldVisitor av = super.visitField(access, name, desc, signature, value);
  return new CheckFieldAdapter(av);
}
 
Example #6
Source File: ClassRemapper.java    From Concurnas with MIT License 6 votes vote down vote up
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String descriptor,
    final String signature,
    final Object value) {
  FieldVisitor fieldVisitor =
      super.visitField(
          access,
          remapper.mapFieldName(className, name, descriptor),
          remapper.mapDesc(descriptor),
          remapper.mapSignature(signature, true),
          (value == null) ? null : remapper.mapValue(value));
  return fieldVisitor == null ? null : createFieldRemapper(fieldVisitor);
}
 
Example #7
Source File: ConstantVisitor.java    From AVM with MIT License 6 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
    // The special case we want to handle is a field with the following properties:
    // -static
    // -non-null value
    // -String
    Object filteredValue = value;
    if ((0 != (access & Opcodes.ACC_STATIC))
            && (null != value)
            && postRenameStringDescriptor.equals(descriptor)
    ) {
        // We need to do something special in this case.
        this.staticFieldNamesToConstantValues.put(name, (String)value);
        filteredValue = null;
    }
    return super.visitField(access, name, descriptor, signature, filteredValue);
}
 
Example #8
Source File: InterfaceFieldClassGeneratorTest.java    From AVM with MIT License 6 votes vote down vote up
public static byte[] getNestedInterfaceCalledFIELDSLevelOne() {
    ClassWriter classWriter = new ClassWriter(0);
    FieldVisitor fieldVisitor;

    classWriter.visit(V10, ACC_ABSTRACT | ACC_INTERFACE, "NestedInterfaces$FIELDS", null, "java/lang/Object", null);

    classWriter.visitSource("NestedInterfaces.java", null);

    classWriter.visitInnerClass("NestedInterfaces$FIELDS", "NestedInterfaces", "FIELDS", ACC_STATIC | ACC_ABSTRACT | ACC_INTERFACE);

    classWriter.visitInnerClass("NestedInterfaces$FIELDS$FIELDS", "NestedInterfaces$FIELDS", "FIELDS", ACC_PUBLIC | ACC_STATIC | ACC_ABSTRACT | ACC_INTERFACE);

    {
        fieldVisitor = classWriter.visitField(ACC_PUBLIC | ACC_FINAL | ACC_STATIC, "a", "I", null, Integer.valueOf(101));
        fieldVisitor.visitEnd();
    }
    classWriter.visitEnd();

    return classWriter.toByteArray();
}
 
Example #9
Source File: JvmDeclaredTypeBuilder.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public FieldVisitor visitField(
       final int access,
       final String name,
       final String desc,
       final String signature,
       final Object value)
   {
   	if ((access & ACC_SYNTHETIC) == 0) {
        JvmFieldBuilder fieldBuilder = new JvmFieldBuilder(
        		result,
        		(access & ACC_STATIC) == 0 ? typeParameters : null,
        		proxies,
   				access,
        		name,
        		desc,
        		signature,
        		value);
        return fieldBuilder;
   	}
   	return null;
   }
 
Example #10
Source File: RemappingClassAdapter.java    From JReFrameworker with MIT License 6 votes vote down vote up
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String descriptor,
    final String signature,
    final Object value) {
  FieldVisitor fieldVisitor =
      super.visitField(
          access,
          remapper.mapFieldName(className, name, descriptor),
          remapper.mapDesc(descriptor),
          remapper.mapSignature(signature, true),
          remapper.mapValue(value));
  return fieldVisitor == null ? null : createRemappingFieldAdapter(fieldVisitor);
}
 
Example #11
Source File: IntArrayFieldInitializer.java    From bazel with Apache License 2.0 6 votes vote down vote up
@Override
public boolean writeFieldDefinition(
    ClassWriter cw, boolean isFinal, boolean annotateTransitiveFields) {
  int accessLevel = Opcodes.ACC_STATIC;
  if (visibility != Visibility.PRIVATE) {
    accessLevel |= Opcodes.ACC_PUBLIC;
  }
  if (isFinal) {
    accessLevel |= Opcodes.ACC_FINAL;
  }
  FieldVisitor fv = cw.visitField(accessLevel, fieldName, DESC, null, null);
  if (annotateTransitiveFields
      && dependencyInfo.dependencyType() == DependencyInfo.DependencyType.TRANSITIVE) {
    AnnotationVisitor av =
        fv.visitAnnotation(
            RClassGenerator.PROVENANCE_ANNOTATION_CLASS_DESCRIPTOR, /*visible=*/ true);
    av.visit(RClassGenerator.PROVENANCE_ANNOTATION_LABEL_KEY, dependencyInfo.label());
    av.visitEnd();
  }
  fv.visitEnd();
  return true;
}
 
Example #12
Source File: SerialVersionUIDAdder.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final Object value) {
  // Get the class field information for step 4 of the algorithm. Also determine if the class
  // already has a SVUID.
  if (computeSVUID) {
    if ("serialVersionUID".equals(name)) {
      // Since the class already has SVUID, we won't be computing it.
      computeSVUID = false;
      hasSVUID = true;
    }
    // Collect the non private fields. Only the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED,
    // ACC_STATIC, ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when computing
    // serialVersionUID values.
    if ((access & Opcodes.ACC_PRIVATE) == 0
        || (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0) {
      int mods =
          access
              & (Opcodes.ACC_PUBLIC
                  | Opcodes.ACC_PRIVATE
                  | Opcodes.ACC_PROTECTED
                  | Opcodes.ACC_STATIC
                  | Opcodes.ACC_FINAL
                  | Opcodes.ACC_VOLATILE
                  | Opcodes.ACC_TRANSIENT);
      svuidFields.add(new Item(name, mods, desc));
    }
  }

  return super.visitField(access, name, desc, signature, value);
}
 
Example #13
Source File: StripVerifyingVisitor.java    From bazel with Apache License 2.0 5 votes vote down vote up
@Override public FieldVisitor visitField(
    int access,
    String name,
    String desc,
    String signature,
    Object value) {
  if ((access & Opcodes.ACC_PRIVATE) != 0) {
    errors.add(String.format("Private field %s found in %s", name, className));
  }
  // We need to go deeper.
  return new StripVerifyingFieldVisitor(errors, className, name);
}
 
Example #14
Source File: ClassDependenciesVisitor.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
    if (isConstant(access) && !isPrivate(access)) {
        dependentToAll = true; //non-private const
    }
    return null;
}
 
Example #15
Source File: DynamicClassFactory.java    From caravan with Apache License 2.0 5 votes vote down vote up
private Class<?> createClass(ClassPair classPair) {
  String className = generateClassName(classPair);
  String classStr = className.replaceAll("\\.", "/");

  String keyClassType = Type.getDescriptor(classPair.keyClass);
  String valueClassType = Type.getDescriptor(classPair.valueClass);

  ClassWriter cw = new ClassWriter(0);
  cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, className, null, "java/lang/Object", new String[]{interfaceName});

  AnnotationVisitor anno = cw.visitAnnotation(Type.getDescriptor(JsonPropertyOrder.class), true);
  AnnotationVisitor aa = anno.visitArray("value");
  aa.visit("", "key");
  aa.visit("", "value");
  aa.visitEnd();
  anno.visitEnd();

  FieldVisitor keyField = cw.visitField(ACC_PRIVATE, "key", keyClassType, null, null);
  keyField.visitEnd();

  FieldVisitor valueField = cw.visitField(ACC_PRIVATE, "value", valueClassType, null, null);
  valueField.visitEnd();

  MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
  mv.visitMaxs(2, 1);
  mv.visitVarInsn(ALOAD, 0);
  mv.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(Object.class), "<init>", "()V", false); // call the constructor of super class
  mv.visitInsn(RETURN);
  mv.visitEnd();

  addGetterSetter(classPair, className, classStr, keyClassType, valueClassType, cw);
  addKVPairMethods(classPair, className, classStr, keyClassType, valueClassType, cw);

  cw.visitEnd();

  return defineClass(className, cw.toByteArray());
}
 
Example #16
Source File: ClassHookInjector.java    From Hook-Manager with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name, String desc,
	String signature, Object value)
{
	access =
		access & ~Opcodes.ACC_PRIVATE & ~Opcodes.ACC_PROTECTED
			| Opcodes.ACC_PUBLIC;
	return super.visitField(access, name, desc, signature, value);
}
 
Example #17
Source File: StringConstantCollectorVisitor.java    From AVM with MIT License 5 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
    // If this is a string, we want to pull it out as a constant.
    if ((Opcodes.ACC_STATIC == (access & Opcodes.ACC_STATIC))
            && (value instanceof String)
    ) {
        this.stringConstants.add((String)value);
    }
    return super.visitField(access, name, descriptor, signature, value);
}
 
Example #18
Source File: StringFogClassVisitor.java    From StringFog with Apache License 2.0 5 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
    if (ClassStringField.STRING_DESC.equals(desc) && name != null && !mIgnoreClass) {
        // static final, in this condition, the value is null or not null.
        if ((access & Opcodes.ACC_STATIC) != 0 && (access & Opcodes.ACC_FINAL) != 0) {
            mStaticFinalFields.add(new ClassStringField(name, (String) value));
            value = null;
        }
        // static, in this condition, the value is null.
        if ((access & Opcodes.ACC_STATIC) != 0 && (access & Opcodes.ACC_FINAL) == 0) {
            mStaticFields.add(new ClassStringField(name, (String) value));
            value = null;
        }

        // final, in this condition, the value is null or not null.
        if ((access & Opcodes.ACC_STATIC) == 0 && (access & Opcodes.ACC_FINAL) != 0) {
            mFinalFields.add(new ClassStringField(name, (String) value));
            value = null;
        }

        // normal, in this condition, the value is null.
        if ((access & Opcodes.ACC_STATIC) != 0 && (access & Opcodes.ACC_FINAL) != 0) {
            mFields.add(new ClassStringField(name, (String) value));
            value = null;
        }
    }
    return super.visitField(access, name, desc, signature, value);
}
 
Example #19
Source File: AbstractASMBackend.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Emits the bytecode for all attributes of a field
 * @param fv The FieldVisitor to emit the bytecode to
 * @param f The SootField the bytecode is to be emitted for
 */
protected void generateAttributes(FieldVisitor fv, SootField f) {
    for (Tag t : f.getTags()) {
        if (t instanceof Attribute) {
            org.objectweb.asm.Attribute a = createASMAttribute((Attribute) t);
            fv.visitAttribute(a);
        }
    }
}
 
Example #20
Source File: InstanceVariableCountingVisitor.java    From AVM with MIT License 5 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
    // If this is an instance field, add it to our count.  We don't restrict static fields.
    if (Opcodes.ACC_STATIC != (Opcodes.ACC_STATIC & access)) {
        this.instanceVariableCount += 1;
    }
    return super.visitField(access, name, descriptor, signature, value);
}
 
Example #21
Source File: InterfaceFieldClassGeneratorTest.java    From AVM with MIT License 5 votes vote down vote up
public static byte[] getNestedInterfaceCalledFIELDSLevelTwo() {

        ClassWriter classWriter = new ClassWriter(0);
        FieldVisitor fieldVisitor;
        MethodVisitor methodVisitor;

        classWriter.visit(V10, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "NestedInterfaces$FIELDS$FIELDS", null, "java/lang/Object", null);

        classWriter.visitSource("NestedInterfaces.java", null);

        classWriter.visitInnerClass("NestedInterfaces$FIELDS", "NestedInterfaces", "FIELDS", ACC_STATIC | ACC_ABSTRACT | ACC_INTERFACE);

        classWriter.visitInnerClass("NestedInterfaces$FIELDS$FIELDS", "NestedInterfaces$FIELDS", "FIELDS", ACC_PUBLIC | ACC_STATIC | ACC_ABSTRACT | ACC_INTERFACE);

        {
            fieldVisitor = classWriter.visitField(ACC_PUBLIC | ACC_FINAL | ACC_STATIC, "b", "I", null, null);
            fieldVisitor.visitEnd();
        }
        {
            methodVisitor = classWriter.visitMethod(ACC_STATIC, "<clinit>", "()V", null, null);
            methodVisitor.visitCode();
            Label label0 = new Label();
            methodVisitor.visitLabel(label0);
            methodVisitor.visitLineNumber(7, label0);
            methodVisitor.visitTypeInsn(NEW, "java/lang/Object");
            methodVisitor.visitInsn(DUP);
            methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
            methodVisitor.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "hashCode", "()I", false);
            methodVisitor.visitFieldInsn(PUTSTATIC, "NestedInterfaces$FIELDS$FIELDS", "b", "I");
            methodVisitor.visitInsn(RETURN);
            methodVisitor.visitMaxs(2, 0);
            methodVisitor.visitEnd();
        }
        classWriter.visitEnd();

        return classWriter.toByteArray();
    }
 
Example #22
Source File: ClassNode.java    From JReFrameworker with MIT License 5 votes vote down vote up
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String descriptor,
    final String signature,
    final Object value) {
  FieldNode field = new FieldNode(access, name, descriptor, signature, value);
  fields.add(field);
  return field;
}
 
Example #23
Source File: AsmClassGenerator.java    From groovy with Apache License 2.0 5 votes vote down vote up
private AnnotationVisitor getAnnotationVisitor(final AnnotatedNode targetNode, final AnnotationNode an, final Object visitor) {
    final String annotationDescriptor = BytecodeHelper.getTypeDescription(an.getClassNode());
    if (targetNode instanceof MethodNode) {
        return ((MethodVisitor) visitor).visitAnnotation(annotationDescriptor, an.hasRuntimeRetention());
    } else if (targetNode instanceof FieldNode) {
        return ((FieldVisitor) visitor).visitAnnotation(annotationDescriptor, an.hasRuntimeRetention());
    } else if (targetNode instanceof ClassNode) {
        return ((ClassVisitor) visitor).visitAnnotation(annotationDescriptor, an.hasRuntimeRetention());
    }
    throwException("Cannot create an AnnotationVisitor. Please report Groovy bug");
    return null;
}
 
Example #24
Source File: MemberAttributeExtension.java    From byte-buddy with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new field attribute visitor.
 *
 * @param fieldVisitor           The field visitor to apply changes to.
 * @param fieldDescription       The field to add annotations to.
 * @param fieldAttributeAppender The field attribute appender to apply.
 * @param annotationValueFilter  The annotation value filter to apply.
 */
private FieldAttributeVisitor(FieldVisitor fieldVisitor,
                              FieldDescription fieldDescription,
                              FieldAttributeAppender fieldAttributeAppender,
                              AnnotationValueFilter annotationValueFilter) {
    super(OpenedClassReader.ASM_API, fieldVisitor);
    this.fieldDescription = fieldDescription;
    this.fieldAttributeAppender = fieldAttributeAppender;
    this.annotationValueFilter = annotationValueFilter;
}
 
Example #25
Source File: CompatibleDetectingVisitor.java    From dependency-mediator with Apache License 2.0 5 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature,
                               Object value) {
    final String fieldType = readTypeDescription(desc);

    // add initial field value if any
    if (value != null) {
        final String fieldValueType = getObjectValueType(value);
    }
    processSignature(signature);

    return fieldVisitor;
}
 
Example #26
Source File: ClassAnalyserASM.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public FieldVisitor visitField(int access,
                               String name,
                               String desc,
                               String signature,
                               Object value)
{
  addReferencedType(Type.getType(desc));

  return null;
}
 
Example #27
Source File: TraceClassVisitor.java    From Concurnas with MIT License 5 votes vote down vote up
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String descriptor,
    final String signature,
    final Object value) {
  Printer fieldPrinter = p.visitField(access, name, descriptor, signature, value);
  return new TraceFieldVisitor(
      super.visitField(access, name, descriptor, signature, value), fieldPrinter);
}
 
Example #28
Source File: AnalyzeClassVisitor.java    From vespa with Apache License 2.0 5 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
    Analyze.getClassName(Type.getType(desc)).ifPresent(imports::add);

    AnalyzeSignatureVisitor.analyzeField(signature, this);
    return new AnalyzeFieldVisitor(this);
}
 
Example #29
Source File: ModifyClassVisiter.java    From atlas with Apache License 2.0 5 votes vote down vote up
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
    if (removeFields.contains(name)) {
        return null;
    }
    return super.visitField(access, name, desc, signature, value);
}
 
Example #30
Source File: GenNerdClass.java    From cs652 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] args) throws Exception {
	ClassWriter cw = new ClassWriter(0);
	TraceClassVisitor tracer =
			new TraceClassVisitor(cw, new PrintWriter(System.out));
	ClassVisitor cv = tracer;
	String name = "Nerd";
	String generics = null;
	String superName = "java/lang/Object";
	String[] interfaces = null;
	int access = ACC_PUBLIC + ACC_INTERFACE;
	int version = V1_5;
	cv.visit(version, access, name, generics, superName, interfaces);

	int fieldAccess = ACC_PUBLIC + ACC_FINAL + ACC_STATIC;
	String shortDescriptor = Type.SHORT_TYPE.getDescriptor();
	FieldVisitor hair = cv.visitField(fieldAccess, "hair", shortDescriptor,
									  null, new Integer(0));
	hair.visitEnd();

	MethodVisitor playVideoGame =
		cv.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, "playVideoGame",
					   "()V", null, null);
	// no code to define, just finish it up
	playVideoGame.visitEnd();
	cv.visitEnd(); // prints if using tracer
	byte[] b = cw.toByteArray();
	// can define or write to file:
	// defineClass(name, b, 0, b.length)
	// from findClass() in subclass of ClassLoader

	FileOutputStream fos = new FileOutputStream("Nerd.class");
	fos.write(b);
	fos.close();
}