private ExecutableElement javacMethod(ExecutableElement method) {
    if (elementUtils == javacElementUtils) {
      return method;
    }
    TypeElement containingType = MoreElements.asType(method.getEnclosingElement());
    TypeElement javacContainingType = javacType(containingType);
    List<ExecutableElement> candidates = new ArrayList<ExecutableElement>();
    methods:
    for (ExecutableElement javacMethod : methodsIn(javacContainingType.getEnclosedElements())) {
      if (javacMethod.getSimpleName().contentEquals(method.getSimpleName())
          && javacMethod.getParameters().size() == method.getParameters().size()) {
        for (int i = 0; i < method.getParameters().size(); i++) {
          VariableElement parameter = method.getParameters().get(i);
          VariableElement javacParameter = javacMethod.getParameters().get(i);
          if (!erasedToString(parameter.asType()).equals(erasedToString(javacParameter.asType()))) {
            continue methods;
          }
        }
        candidates.add(javacMethod);
      }
    }
    if (candidates.size() == 1) {
      return candidates.get(0);
    } else {
      throw new IllegalStateException(
          "Expected one javac method matching " + method + " but found " + candidates);
    }
  }
An equivalent to {@link CompilationRule} that uses ecj (the Eclipse compiler) instead of javac.
If the parameterized test is not selecting ecj then this rule has no effect.
common/src/test/java/com/google/auto/common/OverridesTest.java