aboutsummaryrefslogtreecommitdiff
path: root/value/src/test/java/com/google
diff options
context:
space:
mode:
authorÉamonn McManus <emcmanus@google.com>2020-09-14 17:37:06 -0700
committerGoogle Java Core Libraries <java-core-libraries-team+copybara@google.com>2020-09-14 17:38:00 -0700
commit7eb2d47ad1e1a4b9699bba158a119bf9cf46c909 (patch)
tree086833537547d30ec0c191a8d1278915a1eb3f2e /value/src/test/java/com/google
parentcd3fb8dd39817489d02d90a2a18c41a77e83d970 (diff)
downloadauto-7eb2d47ad1e1a4b9699bba158a119bf9cf46c909.tar.gz
Make `@AutoAnnotation` instances serializable.
RELNOTES=`@AutoAnnotation` instances are now serializable. PiperOrigin-RevId: 331666372
Diffstat (limited to 'value/src/test/java/com/google')
-rw-r--r--value/src/test/java/com/google/auto/value/processor/AutoAnnotationCompilationTest.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/value/src/test/java/com/google/auto/value/processor/AutoAnnotationCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoAnnotationCompilationTest.java
index b8a36eac..f30f519d 100644
--- a/value/src/test/java/com/google/auto/value/processor/AutoAnnotationCompilationTest.java
+++ b/value/src/test/java/com/google/auto/value/processor/AutoAnnotationCompilationTest.java
@@ -74,11 +74,13 @@ public class AutoAnnotationCompilationTest {
"",
"import com.example.annotations.MyAnnotation;",
"import com.example.enums.MyEnum;",
+ "import java.io.Serializable;",
GeneratedImport.importGeneratedAnnotationType(),
"",
"@Generated(\"" + AutoAnnotationProcessor.class.getName() + "\")",
"final class AutoAnnotation_AnnotationFactory_newMyAnnotation",
- " implements MyAnnotation {",
+ " implements MyAnnotation, Serializable {",
+ " private static final long serialVersionUID = 1L;",
" private final MyEnum value;",
" private static final int defaultedValue = 23;",
"",
@@ -157,11 +159,13 @@ public class AutoAnnotationCompilationTest {
JavaFileObject expectedOutput =
JavaFileObjects.forSourceLines(
"AutoAnnotation_AnnotationFactory_newMyAnnotation",
+ "import java.io.Serializable;",
GeneratedImport.importGeneratedAnnotationType(),
"",
"@Generated(\"" + AutoAnnotationProcessor.class.getName() + "\")",
"final class AutoAnnotation_AnnotationFactory_newMyAnnotation",
- " implements MyAnnotation {",
+ " implements MyAnnotation, Serializable {",
+ " private static final long serialVersionUID = 1L;",
" AutoAnnotation_AnnotationFactory_newMyAnnotation() {",
" }",
"",
@@ -237,12 +241,14 @@ public class AutoAnnotationCompilationTest {
"package com.example.factories;",
"",
"import com.example.annotations.MyAnnotation;",
+ "import java.io.Serializable",
"import java.util.Arrays;",
GeneratedImport.importGeneratedAnnotationType(),
"",
"@Generated(\"" + AutoAnnotationProcessor.class.getName() + "\")",
- "final class AutoAnnotation_AnnotationFactory_newMyAnnotation implements MyAnnotation"
- + " {",
+ "final class AutoAnnotation_AnnotationFactory_newMyAnnotation implements MyAnnotation,"
+ + " Serializable {",
+ " private static final long serialVersionUID = 1L;",
" private final int[] value;",
"",
" AutoAnnotation_AnnotationFactory_newMyAnnotation(int[] value) {",
@@ -343,6 +349,7 @@ public class AutoAnnotationCompilationTest {
"",
"import com.example.annotations.MyAnnotation;",
"import com.example.enums.MyEnum;",
+ "import java.io.Serializable;",
"import java.util.Arrays;",
"import java.util.Collection;",
"import java.util.List;",
@@ -350,8 +357,9 @@ public class AutoAnnotationCompilationTest {
GeneratedImport.importGeneratedAnnotationType(),
"",
"@Generated(\"" + AutoAnnotationProcessor.class.getName() + "\")",
- "final class AutoAnnotation_AnnotationFactory_newMyAnnotation implements MyAnnotation"
- + " {",
+ "final class AutoAnnotation_AnnotationFactory_newMyAnnotation implements MyAnnotation,"
+ + " Serializable {",
+ " private static final long serialVersionUID = 1L;",
" private final int[] value;",
" private final MyEnum[] enums;",
"",