From 0436f53b62f3d29cbc95db0d1d4adeee6746beca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 13 Dec 2022 15:39:28 -0800 Subject: [PATCH] Update the compile-testing dependency. 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 --- value/pom.xml | 2 +- .../value/processor/AutoValueCompilationTest.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/value/pom.xml b/value/pom.xml index f4ef93782e..15134e786a 100644 --- a/value/pom.xml +++ b/value/pom.xml @@ -129,7 +129,7 @@ com.google.testing.compile compile-testing - 0.20 + 0.21.0 com.google.truth diff --git a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java index c651769385..ce8a0b3b46 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java @@ -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. @@ -256,6 +261,7 @@ public void testNoWarningsFromGenerics() { @Test public void testNestedParameterizedTypesWithTypeAnnotations() { + assume().that(typeAnnotationsWork).isTrue(); JavaFileObject annotFileObject = JavaFileObjects.forSourceLines( "foo.bar.Annot", @@ -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",