@Test
  public void propertyErrorShouldNotCrash() {
    JavaFileObject autoValueClass =
        JavaFileObjects.forSourceLines(
            "test.Test",
            "package test;",
            "import com.google.auto.value.AutoValue;",
            "import java.util.List;",
            "",
            "@AutoValue",
            "public abstract class Test {",
            "  abstract Integer property();",
            "  abstract List<String> listProperty();",
            "",
            "  @AutoValue.Builder",
            "  public interface Builder {",
            "    Builder property(Integer property);",
            "    Builder listProperty(List<String> listProperty);",
            "    Builder listProperty(Integer listPropertyValues);",
            "    Test build();",
            "  }",
            "}");
    // We don't actually expect the extension to be invoked. Previously it was, and that led to a
    // NullPointerException when calling .setters() in the checker.
    ContextChecker checker =
        context -> {
          assertThat(context.builder()).isPresent();
          assertThat(context.builder().get().setters()).isEmpty();
        };
    ContextCheckingExtension extension = new ContextCheckingExtension(checker);
    Compilation compilation =
        javac()
            .withProcessors(new AutoValueProcessor(ImmutableList.of(extension)))
            .compile(autoValueClass);
    assertThat(compilation)
        .hadErrorContaining("Parameter type java.lang.Integer of setter method")
        .inFile(autoValueClass)
        .onLineContaining("Builder listProperty(Integer listPropertyValues)");
  }
Tests that extensions providing their own implemented annotation types or options get picked
up.
value/src/test/java/com/google/auto/value/processor/ExtensionTest.java