<commit_before>package water;

/**
 * A typed atomic update.
 */
public abstract class TAtomic<T extends Iced> extends Atomic {
  /** Atomically update an old value to a new one.
   * @param old  The old value, it may be null
   * @return The new value; if null if this atomic update no longer needs to be run
   */
  public abstract T atomic(T old);

  @Override public Value atomic(Value val) {
    T old = val == null ? null : (T)val.get();
    T nnn = atomic(old);
    return  nnn == null ? null : new Value(_key,nnn);
  }
}
<commit_msg>Fix possible TAtomic bug Rare race for doing update-in-place TAtomic updates. Do a shallow defensive clone first.<commit_after>package water;

/**
 * A typed atomic update.
 */
public abstract class TAtomic<T extends Iced> extends Atomic {
  /** Atomically update an old value to a new one.
   * @param old  The old value, it may be null.  It is a defensive copy.
   * @return The new value; if null if this atomic update no longer needs to be run
   */
  public abstract T atomic(T old);

  @Override public Value atomic(Value val) {
    T old = val == null ? null : (T)(val.get().clone());
    T nnn = atomic(old);
    return  nnn == null ? null : new Value(_key,nnn);
  }
}

{'fraction_non_alphanumeric': 0.10426929392446634, 'fraction_numerical': 0.0, 'mean_word_length': 3.0906040268456376, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4490943', 'n_tokens_mistral': 377, 'n_tokens_neox': 371, 'n_words': 167}