aboutsummaryrefslogtreecommitdiff
path: root/value/src/test/java/com/google
diff options
context:
space:
mode:
authorÉamonn McManus <emcmanus@google.com>2021-04-05 08:58:03 -0700
committerGoogle Java Core Libraries <java-libraries-firehose+copybara@google.com>2021-04-05 08:58:36 -0700
commit79d7e9c3d2487227ae1d803465a00ea7f4670b8c (patch)
tree2e9b75c38a1dd12febfdef2f7197175011b02bf8 /value/src/test/java/com/google
parent0076afb3825bd4d3b7ab77310855c2cc4a05813e (diff)
downloadauto-79d7e9c3d2487227ae1d803465a00ea7f4670b8c.tar.gz
Move the AutoBuilder tests for Kotlin data classes to a separate test class.
Unfortunately it appears that JDK versions before 11 have a bug where the compiler won't report parameter names to annotation processors if the parameters are in code that has been compiled separately. This is true even if the code is compiled with `-parameters`. It might not happen always, but it does happen for the Kotlin data classes we are testing against. So we exclude the test that uses them when running with JDK version < 11. Also add a missing `-A` flag that is needed for the `record` compilation test, and only run that test with JDK ≥ 16, where records are no longer a preview feature. RELNOTES=n/a PiperOrigin-RevId: 366807595
Diffstat (limited to 'value/src/test/java/com/google')
-rw-r--r--value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java
index 0dcd275f..296651c8 100644
--- a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java
+++ b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java
@@ -124,8 +124,7 @@ public final class AutoBuilderCompilationTest {
@Test
public void simpleRecord() {
double version = Double.parseDouble(JAVA_SPECIFICATION_VERSION.value());
- assume().that(version).isAtLeast(15.0);
- String release = Integer.toString((int) version);
+ assume().that(version).isAtLeast(16.0);
JavaFileObject javaFileObject =
JavaFileObjects.forSourceLines(
"foo.bar.Baz",
@@ -147,8 +146,8 @@ public final class AutoBuilderCompilationTest {
"}");
Compilation compilation =
javac()
- .withOptions("--release", release, "--enable-preview")
.withProcessors(new AutoBuilderProcessor())
+ .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable")
.compile(javaFileObject);
assertThat(compilation)
.generatedSourceFile("foo.bar.AutoBuilder_Baz_Builder")