@SuppressWarnings("unchecked")
    private void setupTraceStateObjectField(ClassTraceInfo info) {
        // Skip adding trace object field if it already exists
        AnnotationNode traceObjectAnnotation = getAnnotation(TRACE_OBJECT_FIELD_TYPE.getDescriptor(), info.classNode.visibleAnnotations);
        if (traceObjectAnnotation != null) {
            TraceObjectFieldAnnotationVisitor visitor = new TraceObjectFieldAnnotationVisitor();
            traceObjectAnnotation.accept(visitor);
            List<FieldNode> fields = getFieldsByDesc(visitor.getFieldDescriptor(), info.classNode.fields);
            for (FieldNode fn : fields) {
                if (fn.name.equals(visitor.getFieldName())) {
                    info.traceStateField = fn;
                    break;
                }
            }
            return;
        }

        // If a logger or trace component has been declared, use it.
        // Preference is given to the Liberty TraceComponent over the
        // WebSphere TraceComponent and either TraceComponent over a
        // Logger reference.  If none are declared, generate as a
        // synthetic.
        if (info.libertyTraceComponentFieldNode != null) {
            info.traceStateField = info.libertyTraceComponentFieldNode;
            info.traceStateFieldAlreadyInitialized = info.libertyTraceComponentFieldAlreadyInitialized;
        } else if (info.websphereTraceComponentFieldNode != null) {
            StringBuilder sb = new StringBuilder();
            sb.append("INFO: Runtime BCI is not supported for com.ibm.ejs.ras.  Build-time BCI will be used for class ");
            sb.append(info.classNode.name.replace('/', '.'));
            sb.append(".  Consider using the com.ibm.websphere.ras package.");
            info.warnings.add(sb.toString());
            info.traceStateField = info.websphereTraceComponentFieldNode;
            info.traceStateFieldAlreadyInitialized = info.websphereTraceComponentFieldAlreadyInitialized;
        } else if (info.loggerFieldNode != null) {
            StringBuilder sb = new StringBuilder();
            sb.append("INFO: Runtime BCI is not supported for JSR47 Logging.  Build-time BCI will be used for class ");
            sb.append(info.classNode.name.replace('/', '.'));
            sb.append(".");
            info.warnings.add(sb.toString());
            info.traceStateField = info.loggerFieldNode;
            info.traceStateFieldAlreadyInitialized = info.loggerFieldAlreadyInitialized;
        } else if (defaultTraceType == TraceType.LIBERTY) {
            // TODO: Check for an outer class and a declared field
            int access = (Opcodes.ACC_PRIVATE | Opcodes.ACC_FINAL | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC);
            info.traceStateField = (FieldNode) info.classNode.visitField(access, "$$$tc$$$", LIBERTY_TRACE_COMPONENT_TYPE.getDescriptor(), null, null);
        }

        // Add the class annotation with the field name and descriptor
        if (info.traceStateField != null) {
            AnnotationVisitor av = info.classNode.visitAnnotation(TRACE_OBJECT_FIELD_TYPE.getDescriptor(), true);
            av.visit("fieldName", info.traceStateField.name);
            av.visit("fieldDesc", info.traceStateField.desc);
            av.visitEnd();
        }
    }
@ SuppressWarnings ( "unchecked" ) private void setupTraceStateObjectField ( ClassTraceInfo info ) { AnnotationNode traceObjectAnnotation = getAnnotation ( TRACE_OBJECT_FIELD_TYPE . getDescriptor ( ) , info . classNode . visibleAnnotations ) ; if ( traceObjectAnnotation != null ) { TraceObjectFieldAnnotationVisitor visitor = new TraceObjectFieldAnnotationVisitor ( ) ; traceObjectAnnotation . accept ( visitor ) ; List < FieldNode > fields = getFieldsByDesc ( visitor . getFieldDescriptor ( ) , info . classNode . fields ) ; for ( FieldNode fn : fields ) { if ( fn . name . equals ( visitor . getFieldName ( ) ) ) { info . traceStateField = fn ; break ; } } return ; } if ( info . libertyTraceComponentFieldNode != null ) { info . traceStateField = info . libertyTraceComponentFieldNode ; info . traceStateFieldAlreadyInitialized = info . libertyTraceComponentFieldAlreadyInitialized ; } else if ( info . websphereTraceComponentFieldNode != null ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "INFO: Runtime BCI is not supported for com.ibm.ejs.ras.  Build-time BCI will be used for class " ) ; sb . append ( info . classNode . name . replace ( '/' , '.' ) ) ; sb . append ( ".  Consider using the com.ibm.websphere.ras package." ) ; info . warnings . add ( sb . toString ( ) ) ; info . traceStateField = info . websphereTraceComponentFieldNode ; info . traceStateFieldAlreadyInitialized = info . websphereTraceComponentFieldAlreadyInitialized ; } else if ( info . loggerFieldNode != null ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "INFO: Runtime BCI is not supported for JSR47 Logging.  Build-time BCI will be used for class " ) ; sb . append ( info . classNode . name . replace ( '/' , '.' ) ) ; sb . append ( "." ) ; info . warnings . add ( sb . toString ( ) ) ; info . traceStateField = info . loggerFieldNode ; info . traceStateFieldAlreadyInitialized = info . loggerFieldAlreadyInitialized ; } else if ( defaultTraceType == TraceType . LIBERTY ) { int access = ( Opcodes . ACC_PRIVATE | Opcodes . ACC_FINAL | Opcodes . ACC_STATIC | Opcodes . ACC_SYNTHETIC ) ; info . traceStateField = ( FieldNode ) info . classNode . visitField ( access , "$$$tc$$$" , LIBERTY_TRACE_COMPONENT_TYPE . getDescriptor ( ) , null , null ) ; } if ( info . traceStateField != null ) { AnnotationVisitor av = info . classNode . visitAnnotation ( TRACE_OBJECT_FIELD_TYPE . getDescriptor ( ) , true ) ; av . visit ( "fieldName" , info . traceStateField . name ) ; av . visit ( "fieldDesc" , info . traceStateField . desc ) ; av . visitEnd ( ) ; } }
Find or create the field that will hold the {@code TraceComponent} or {@code Logger} and create a class level annotation holding the field
name and descriptor.

@param info the collected class information