protected CtVariableRead buildVarRef(CtTypeReference type, Factory factory) {
    CtTypeReference<Object> typeRef = factory.Core().clone(type);

    CtLocalVariable<Object> localVar = factory.Core().createLocalVariable();
    localVar.setType(typeRef);
    localVar.setSimpleName("var_" + type.getSimpleName() + "_" + System.currentTimeMillis());

    CtVariableReadImpl varRead = new CtVariableReadImpl();
    varRead.setVariable(factory.Code().createLocalVariableReference(localVar));
    return varRead;
  }
 @Override
 public <T> void visitCtLocalVariable(CtLocalVariable<T> localVariable) {
   if (immutableCycle(localVariable.getReference())) {
     // Is immutable, need to be replaced by an assignment
     CtAssignment<T, T> replacement =
         localVariable
             .getFactory()
             .Code()
             .createVariableAssignment(
                 localVariable.getReference(), false, localVariable.getDefaultExpression());
     localVariable.replace(replacement);
   } else defaultAction(localVariable);
 }