package arez;

import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nonnull;

final class DiagnosticMessage
{
  private final int _code;
  @Nonnull
  private final Guards.Type _type;
  @Nonnull
  private final String _messagePattern;
  private final boolean _needsSave;
  private final Set<StackTraceElement> _originalCallers = new HashSet<>();
  private final Set<StackTraceElement> _callers = new HashSet<>();

  DiagnosticMessage( final int code,
                     @Nonnull final Guards.Type type,
                     @Nonnull final String messagePattern,
                     final boolean needsSave,
                     @Nonnull final Set<StackTraceElement> callers )
  {
    _code = code;
    _type = type;
    _messagePattern = messagePattern;
    _needsSave = needsSave;
    _originalCallers.addAll( callers );
  }

  int getCode()
  {
    return _code;
  }

  @Nonnull
  Guards.Type getType()
  {
    return _type;
  }

  @Nonnull
  String getMessagePattern()
  {
    return _messagePattern;
  }

  boolean needsSave()
  {
    return _needsSave || !Objects.equals( _originalCallers, _callers );
  }

  void recordCaller( @Nonnull final StackTraceElement caller )
  {
    _callers.add( caller );
  }

  Set<StackTraceElement> getOriginalCallers()
  {
    return Collections.unmodifiableSet( _originalCallers );
  }

  Set<StackTraceElement> getCallers()
  {
    return Collections.unmodifiableSet( _callers );
  }
}

@@ -1286,123 +1286,8 @@
  %7D%0A%0A
-  Set%3CStackTraceElement%3E getOriginalCallers()%0A  %7B%0A    return Collections.unmodifiableSet( _originalCallers );%0A  %7D%0A%0A
   Se

Remove unused method