<commit_before>package fitnesse.slim;

import java.lang.reflect.Field;

public class SystemUnderTestMethodExecutor extends MethodExecutor {

  private final SlimExecutionContext context;

  public SystemUnderTestMethodExecutor(SlimExecutionContext context) {
    this.context = context;
  }

  public MethodExecutionResult execute(String instanceName, String methodName, Object[] args) throws Throwable {
    Object instance;
    try {
      instance = context.getInstance(instanceName);
    } catch (SlimError e) {
      return MethodExecutionResult.noInstance(instanceName + "." + methodName);
    }
    Field field = findSystemUnderTest(methodName, instance.getClass(), args);
    if (field != null) {
      Object systemUnderTest = field.get(instance);
      return findAndInvoke(methodName, args, systemUnderTest);
    }
    return MethodExecutionResult.noMethod(methodName, instance.getClass(), args.length);
  }

  private Field findSystemUnderTest(Class<?> k) {
    Field[] fields = k.getDeclaredFields();
    for (Field field : fields) {
      if (isSystemUnderTest(field)) {
          return field;
        }
      }
    return null;
  }

  private Field findSystemUnderTest(String methodName, Class<?> k, Object[] args) {
    Field[] fields = k.getDeclaredFields();
    for (Field field : fields) {
      if (isSystemUnderTest(field)) {
        if (null != findMatchingMethod(methodName, field.getType(), args.length)) {
          return field;
        }
      }
    }
    return null;
  }

  private boolean isSystemUnderTest(Field field) {
    return "systemUnderTest".equals(field.getName())
        || field.getAnnotation(SystemUnderTest.class) != null;
  }
}<commit_msg>Seems to have been replaced by findSystemUnderTest(String methodName, Class<?> k, Object[] args) recently<commit_after>package fitnesse.slim;

import java.lang.reflect.Field;

public class SystemUnderTestMethodExecutor extends MethodExecutor {

  private final SlimExecutionContext context;

  public SystemUnderTestMethodExecutor(SlimExecutionContext context) {
    this.context = context;
  }

  public MethodExecutionResult execute(String instanceName, String methodName, Object[] args) throws Throwable {
    Object instance;
    try {
      instance = context.getInstance(instanceName);
    } catch (SlimError e) {
      return MethodExecutionResult.noInstance(instanceName + "." + methodName);
    }
    Field field = findSystemUnderTest(methodName, instance.getClass(), args);
    if (field != null) {
      Object systemUnderTest = field.get(instance);
      return findAndInvoke(methodName, args, systemUnderTest);
    }
    return MethodExecutionResult.noMethod(methodName, instance.getClass(), args.length);
  }

  private Field findSystemUnderTest(String methodName, Class<?> k, Object[] args) {
    Field[] fields = k.getDeclaredFields();
    for (Field field : fields) {
      if (isSystemUnderTest(field)) {
        if (null != findMatchingMethod(methodName, field.getType(), args.length)) {
          return field;
        }
      }
    }
    return null;
  }

  private boolean isSystemUnderTest(Field field) {
    return "systemUnderTest".equals(field.getName())
        || field.getAnnotation(SystemUnderTest.class) != null;
  }
}
{'fraction_non_alphanumeric': 0.10324574961360124, 'fraction_numerical': 0.0, 'mean_word_length': 3.7588235294117647, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2554896', 'n_tokens_mistral': 878, 'n_tokens_neox': 877, 'n_words': 213}