@Test
  public void source8_masked() throws Exception {
    // It appears that the StandardJavaFileManager hack that removes a package does not work in
    // conjunction with --release. This is probably a bug. What we find is that
    // Elements.getTypeElement returns a value for javax.annotation.Generated even though
    // javax.annotation is being masked. It doesn't seem to go through the StandardJavaFileManager
    // interface to get it. So, we continue using the -source 8 -target 8 options. Those don't
    // actually get the JDK8 API when running post-JDK8, so we end up testing what we want.
    //
    // An alternative would be to delete this test method. JDK8 always has
    // javax.annotation.Generated so it isn't really meaningful to test it without.
    ImmutableList<String> options = ImmutableList.of("-source", "8", "-target", "8");
    String generated = runProcessor(options, "javax.annotation");
    assertThat(generated).doesNotContain(JAVAX_ANNOTATION_GENERATED);
    assertThat(generated).doesNotContain(JAVAX_ANNOTATION_PROCESSING_GENERATED);
  }
Used to produce a {@link StandardJavaFileManager} where a certain package appears to have no
classes. The results are exactly those from the proxied {@code StandardJavaFileManager} except
for the {@link StandardJavaFileManager#list list} method when its {@code packageName} argument
is the given package, in which case the result is an empty list.

<p>We can't use {@link javax.tools.ForwardingJavaFileManager} because at least some JDK
versions require the file manager to be a {@code StandardJavaFileManager} when the {@code
--release} flag is given.
common/src/test/java/com/google/auto/common/GeneratedAnnotationsTest.java