/** * Visits the end of the field. This method, which is the last one to be called, is used to inform * the visitor that all the annotations and attributes of the field have been visited. */ public void visitEnd() { if (fv != null) { fv.visitEnd(); } } }
@Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { super.visit(version, access, name, signature, superName, interfaces); this.owner = name; if (noField.contains(name) == false) { // add trace fields super.visitField(ACC_PUBLIC, TraceSQL.PSTMT_PARAM_FIELD, Type.getDescriptor(SqlParameter.class), null, null) .visitEnd(); } }
@Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { super.visit(version, access, name, signature, superName, interfaces); if (exist == false) { super.visitField(ACC_PUBLIC, field, Type.getDescriptor(Object.class), null, null).visitEnd(); } } @Override
@Override public void visitEnd() { if (transformedState.transformationsMade()) { cv.visitField(ACC_PUBLIC + ACC_STATIC, markerAlreadyTransformed, "Z", null, null).visitEnd(); } super.visitEnd(); }
cw.visit(V1_6, ACC_PUBLIC, typeName, null, "java/lang/Object", new String[]{ toInternal(invocationInterfaceDesc)}); cw.visitField(ACC_PRIVATE | ACC_FINAL, "thiz", "Ljava/lang/Object;", null, null).visitEnd(); cw.visitField(ACC_PRIVATE | ACC_FINAL, "args", "[Ljava/lang/Object;", null, null).visitEnd(); cw.visitField(ACC_PRIVATE | ACC_FINAL, "idx", "I", null, null).visitEnd();
public void visitEnd() { fv.visitEnd(); } }
fieldVisitor.visitEnd(); return currentOffset;
/** * Emits the bytecode for all fields of the class */ protected void generateFields() { for (SootField f : sc.getFields()) { if (f.isPhantom()) { continue; } String name = f.getName(); String desc = toTypeDesc(f.getType()); String sig = null; if (f.hasTag("SignatureTag")) { SignatureTag genericSignature = (SignatureTag) f.getTag("SignatureTag"); sig = genericSignature.getSignature(); } Object value = getDefaultValue(f); int access = getModifiers(f.getModifiers(), f); FieldVisitor fv = cv.visitField(access, name, desc, sig, value); if (fv != null) { generateAnnotations(fv, f); generateAttributes(fv, f); fv.visitEnd(); } } }
private void addStaticFields(ClassWriter cw) { if (pluginId != null) { cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC, "configService", "Lorg/glowroot/agent/plugin/api/config/ConfigService;", null, null).visitEnd(); } if (config.isTimerOrGreater()) { cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC, "timerName", "Lorg/glowroot/agent/plugin/api/TimerName;", null, null).visitEnd(); } if (!config.enabledProperty().isEmpty()) { cw.visitField(ACC_PRIVATE + ACC_STATIC + ACC_FINAL, "enabled", "Lorg/glowroot/agent/plugin/api/config/BooleanProperty;", null, null) .visitEnd(); } if (!config.traceEntryEnabledProperty().isEmpty()) { cw.visitField(ACC_PRIVATE + ACC_STATIC + ACC_FINAL, "entryEnabled", "Lorg/glowroot/agent/plugin/api/config/BooleanProperty;", null, null) .visitEnd(); } }
FieldVisitor fv = cw.visitField(ACC_PUBLIC + ACC_FINAL + ACC_STATIC, classMetaFieldName, "L" + classMetaInternalName + ";", null, null); fv.visitEnd(); mv.visitTypeInsn(NEW, classMetaInternalName); mv.visitInsn(DUP); FieldVisitor fv = cw.visitField(ACC_PUBLIC + ACC_FINAL + ACC_STATIC, methodMetaFieldName, "L" + methodMetaInternalName + ";", null, null); fv.visitEnd(); mv.visitTypeInsn(NEW, methodMetaInternalName); mv.visitInsn(DUP);
null); cw.visitField(ACC_PRIVATE + ACC_FINAL, "messageTemplate", "Lorg/glowroot/agent/bytecode/api/MessageTemplate;", null, null).visitEnd(); if (!config.transactionNameTemplate().isEmpty()) { cw.visitField(ACC_PRIVATE + ACC_FINAL, "transactionNameTemplate", "Lorg/glowroot/agent/bytecode/api/MessageTemplate;", null, null).visitEnd(); "Lorg/glowroot/agent/bytecode/api/MessageTemplate;", null, null).visitEnd(); "Lorg/glowroot/agent/bytecode/api/MessageTemplate;", null, null).visitEnd();
/** * Visits the end of the field. This method, which is the last one to be * called, is used to inform the visitor that all the annotations and * attributes of the field have been visited. */ public void visitEnd() { if (fv != null) { fv.visitEnd(); } } }
public void generateCountersField(ClassVisitor cv) { FieldVisitor fv = cv.visitField(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL | Opcodes.ACC_TRANSIENT, COBERTURA_COUNTERS_FIELD_NAME, COBERTURA_COUNTERS_FIELD_TYPE, null, null); fv.visitEnd(); }
@Override public void end(final String name) { ((FieldVisitor) pop()).visitEnd(); } }
/** * Add the instance manager field (__im). */ private void addIMField() { FieldVisitor fv = super.visitField(0, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;", null, null); fv.visitEnd(); }
@Override public void visitEnd() { checkEnd(); end = true; super.visitEnd(); }
private void makeFields(ClassWriter classWriter, Struct struct) { classWriter.visitField(ACC_PRIVATE | ACC_FINAL, $_frozen, "Z", null, null).visitEnd(); for (Member member : struct.getMembers()) { FieldVisitor fieldVisitor = classWriter.visitField(ACC_PRIVATE, member.getName(), "Ljava/lang/Object;", null, null); fieldVisitor.visitEnd(); } }