Skip to content

Commit

Permalink
Update the compile-testing dependency.
Browse files Browse the repository at this point in the history
Exclude another test on Java 8 that fails because that version doesn't handle
type annotations very well. This failure didn't show up previously because of a
bug in compile-testing.

RELNOTES=n/a
PiperOrigin-RevId: 495144680
  • Loading branch information
eamonnmcmanus authored and Google Java Core Libraries committed Dec 13, 2022
1 parent bbb9a61 commit 0436f53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion value/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<dependency>
<groupId>com.google.testing.compile</groupId>
<artifactId>compile-testing</artifactId>
<version>0.20</version>
<version>0.21.0</version>
</dependency>
<dependency>
<groupId>com.google.truth</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
public class AutoValueCompilationTest {
@Rule public final Expect expect = Expect.create();

// Sadly we can't rely on JDK 8 to handle type annotations correctly.
// Some versions do, some don't. So skip the test unless we are on at least JDK 9.
private boolean typeAnnotationsWork =
Double.parseDouble(JAVA_SPECIFICATION_VERSION.value()) >= 9.0;

@Test
public void simpleSuccess() {
// Positive test case that ensures we generate the expected code for at least one case.
Expand Down Expand Up @@ -256,6 +261,7 @@ public void testNoWarningsFromGenerics() {

@Test
public void testNestedParameterizedTypesWithTypeAnnotations() {
assume().that(typeAnnotationsWork).isTrue();
JavaFileObject annotFileObject =
JavaFileObjects.forSourceLines(
"foo.bar.Annot",
Expand Down Expand Up @@ -1455,10 +1461,7 @@ public void correctBuilder() {

@Test
public void builderWithNullableTypeAnnotation() {
// Sadly we can't rely on JDK 8 to handle type annotations correctly.
// Some versions do, some don't. So skip the test unless we are on at least JDK 9.
double javaVersion = Double.parseDouble(JAVA_SPECIFICATION_VERSION.value());
assume().that(javaVersion).isAtLeast(9.0);
assume().that(typeAnnotationsWork).isTrue();
JavaFileObject javaFileObject =
JavaFileObjects.forSourceLines(
"foo.bar.Baz",
Expand Down

0 comments on commit 0436f53

Please sign in to comment.