@ Override public void visitEnd ( ) { if ( isInstrumentableClass ( ) ) { // Add a field to hold the trace state if needed if ( isTraceObjectFieldDefinitionRequired ( ) ) { int access = ( Opcodes . ACC_PRIVATE | Opcodes . ACC_FINAL | Opcodes . ACC_STATIC | Opcodes . ACC_SYNTHETIC ) ; String name = getTraceObjectFieldName ( ) ; String desc = getTraceObjectFieldType ( ) . getDescriptor ( ) ; visitField ( access , name , desc , null , null ) ; } // Add a static initializer to setup trace if needed if ( isStaticInitializerRequired ( ) && ! isStaticInitDefined ( ) ) { staticInitializerGenerated = true ; MethodVisitor mv = visitMethod ( Opcodes . ACC_STATIC , "<clinit>" , "()V" , null , null ) ; Label lineNumberLabel = new Label ( ) ; mv . visitCode ( ) ; mv . visitLabel ( lineNumberLabel ) ; mv . visitLineNumber ( 65535 , lineNumberLabel ) ; mv . visitInsn ( Opcodes . RETURN ) ; mv . visitMaxs ( 1 , 0 ) ; mv . visitEnd ( ) ; } } super . visitEnd ( ) ; }
Visit the end of the class . All of the methods and fieldInfos defined in the class have been visited at this point . If we didn t encounter a trace state field or static initializer we ll add them now .