private void fixFieldAccessInMethods() {
    List<MethodNode> methods = new LinkedList<MethodNode>();

    for (MethodNode methodNode : (List<MethodNode>) classNode.methods) {
      MethodMetadata methodMetadata =
          classMetadata.getMethodMetadata(methodNode.name, methodNode.desc);

      if (methodMetadata.isTransactional()) {
        methodNode = fixMethod(methodNode);
      }

      methods.add(methodNode);
    }

    classNode.methods = methods;
  }
  private void addInitializationLogicToConstructors() {
    if (!classMetadata.hasManagedFieldsWithFieldGranularity()) {
      return;
    }

    for (MethodNode methodNode : (List<MethodNode>) classNode.methods) {
      MethodMetadata methodMetadata =
          classMetadata.getMethodMetadata(methodNode.name, methodNode.desc);

      if (methodMetadata.isTransactional() && methodMetadata.isConstructor()) {
        int firstAfterSuper = firstIndexAfterSuper(methodNode, classNode.superName);

        if (firstAfterSuper >= 0) {
          InsnList extraInstructions = new InsnList();
          for (FieldNode fieldNode : (List<FieldNode>) classNode.fields) {
            FieldMetadata fieldMetadata = classMetadata.getFieldMetadata(fieldNode.name);

            if (fieldMetadata.hasFieldGranularity()) {
              extraInstructions.add(new VarInsnNode(ALOAD, 0));

              String referenceDesc = findReferenceDesc(fieldMetadata.getDesc());
              String referenceName = Type.getType(referenceDesc).getInternalName();

              extraInstructions.add(new TypeInsnNode(NEW, referenceName));
              extraInstructions.add(new InsnNode(DUP));

              extraInstructions.add(
                  new MethodInsnNode(INVOKESPECIAL, referenceName, "<init>", "()V"));

              extraInstructions.add(
                  new FieldInsnNode(PUTFIELD, classNode.name, fieldNode.name, referenceDesc));
            }

            AbstractInsnNode first = methodNode.instructions.get(firstAfterSuper);
            methodNode.instructions.insert(first, extraInstructions);
          }
        }
      }
    }
  }