From b82d7d7809f814b8645e64fdaf30367896aa07eb Mon Sep 17 00:00:00 2001 From: Jeff Bahr Date: Thu, 17 Oct 2024 10:48:41 -0700 Subject: [PATCH] Add static builder method to thrift structs Summary: Creates a static builder pattern as an alternative to writing `new Builder()` for concisenss. For example it can be used in the two following ways. ``` MyType.builder().setField(...).build(); // or copy from existing struct MyType.builder(other).setField(...).build() ``` Reviewed By: fanzeyi Differential Revision: D64505414 fbshipit-source-id: 1b87aa89f930e4994263c4c3ee15b8b6eb4bfa63 --- .../compiler/generate/templates/java/Struct.mustache | 12 ++++++++++-- .../out/java/gen-java/test/fixtures/adapter/A.java | 12 ++++++++++-- .../adapter/AdaptTemplatedNestedTestStruct.java | 12 ++++++++++-- .../fixtures/adapter/AdaptTemplatedTestStruct.java | 12 ++++++++++-- .../test/fixtures/adapter/AdaptTestStruct.java | 12 ++++++++++-- .../test/fixtures/adapter/AdaptedStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/adapter/AlsoMoveOnly.java | 12 ++++++++++-- .../gen-java/test/fixtures/adapter/ApplyAdapter.java | 12 ++++++++++-- .../out/java/gen-java/test/fixtures/adapter/B.java | 12 ++++++++++-- .../out/java/gen-java/test/fixtures/adapter/Bar.java | 12 ++++++++++-- .../test/fixtures/adapter/CircularAdaptee.java | 12 ++++++++++-- .../test/fixtures/adapter/CircularStruct.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/adapter/Config.java | 12 ++++++++++-- .../test/fixtures/adapter/CountingStruct.java | 12 ++++++++++-- .../test/fixtures/adapter/DeclaredAfterStruct.java | 12 ++++++++++-- .../test/fixtures/adapter/DirectlyAdapted.java | 12 ++++++++++-- .../test/fixtures/adapter/DirectlyAdaptedStruct.java | 12 ++++++++++-- .../out/java/gen-java/test/fixtures/adapter/Foo.java | 12 ++++++++++-- .../test/fixtures/adapter/HeapAllocated.java | 12 ++++++++++-- .../fixtures/adapter/IndependentDirectlyAdapted.java | 12 ++++++++++-- .../gen-java/test/fixtures/adapter/MoveOnly.java | 12 ++++++++++-- .../gen-java/test/fixtures/adapter/MyAnnotation.java | 12 ++++++++++-- .../gen-java/test/fixtures/adapter/MyStruct.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/adapter/Person.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/adapter/Person2.java | 12 ++++++++++-- .../test/fixtures/adapter/RenamedStruct.java | 12 ++++++++++-- ...enamedStructWithStructAdapterAndFieldAdapter.java | 12 ++++++++++-- .../test/fixtures/adapter/ReorderedStruct.java | 12 ++++++++++-- .../test/fixtures/adapter/SameNamespaceStruct.java | 12 ++++++++++-- .../fixtures/adapter/StructFieldAdaptedStruct.java | 12 ++++++++++-- .../fixtures/adapter/StructWithFieldAdapter.java | 12 ++++++++++-- .../test/fixtures/adapter/TerseAdaptedFields.java | 12 ++++++++++-- .../test/fixtures/adapter/TransitiveAdapted.java | 12 ++++++++++-- .../test/fixtures/basicannotations/MyStruct.java | 12 ++++++++++-- .../basicannotations/MyStructNestedAnnotation.java | 12 ++++++++++-- .../test/fixtures/basicannotations/SecretStruct.java | 12 ++++++++++-- .../test/fixtures/swift/enumstrict/MyStruct.java | 12 ++++++++++-- .../test/fixtures/basic_swift_bean/LegacyStruct.java | 12 ++++++++++-- .../test/fixtures/basic_swift_bean/MyDataItem.java | 12 ++++++++++-- .../test/fixtures/basic_swift_bean/MyStruct1.java | 12 ++++++++++-- .../test/fixtures/basic_swift_bean/MyStruct2.java | 12 ++++++++++-- .../test/fixtures/basic_swift_bean/MyStruct3.java | 12 ++++++++++-- .../gen-java/test/fixtures/basic/Containers.java | 12 ++++++++++-- .../gen-java/test/fixtures/basic/MyDataItem.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/basic/MyStruct.java | 12 ++++++++++-- .../test/fixtures/basic/ReservedKeyword.java | 12 ++++++++++-- .../gen-java/test/fixtures/basic/MyBigStruct.java | 12 ++++++++++-- .../test/fixtures/basic/MyMutableBigStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/basic/MyNomralStruct.java | 12 ++++++++++-- .../fixtures/complex_struct/ComplexNestedStruct.java | 12 ++++++++++-- .../test/fixtures/complex_struct/DefaultStruct.java | 12 ++++++++++-- .../test/fixtures/complex_struct/MyDataItem.java | 12 ++++++++++-- .../test/fixtures/complex_struct/MyStruct.java | 12 ++++++++++-- .../complex_struct/MyStructFloatFieldThrowExp.java | 12 ++++++++++-- .../complex_struct/MyStructMapFloatThrowExp.java | 12 ++++++++++-- .../fixtures/complex_struct/MyStructTypeDef.java | 12 ++++++++++-- .../test/fixtures/complex_struct/SimpleStruct.java | 12 ++++++++++-- .../test/fixtures/complex_struct/TypeRemapped.java | 12 ++++++++++-- .../fixtures/complex_union/NonCopyableStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/complex_union/Val.java | 12 ++++++++++-- .../gen-java/test/fixtures/constants/Internship.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/constants/Range.java | 12 ++++++++++-- .../gen-java/test/fixtures/constants/Struct1.java | 12 ++++++++++-- .../gen-java/test/fixtures/constants/Struct2.java | 12 ++++++++++-- .../gen-java/test/fixtures/constants/Struct3.java | 12 ++++++++++-- .../gen-java/test/fixtures/constants/Struct4.java | 12 ++++++++++-- .../gen-java/test/fixtures/empty_struct/Empty.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/enums/MyStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/enums/SomeStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/includes/MyStruct.java | 12 ++++++++++-- .../test/fixtures/includes/includes/Included.java | 12 ++++++++++-- .../test/fixtures/includes/transitive/Foo.java | 12 ++++++++++-- .../test/fixtures/injectMetadataFields/Fields.java | 12 ++++++++++-- .../FieldsInjectedToEmptyStruct.java | 12 ++++++++++-- .../injectMetadataFields/FieldsInjectedToStruct.java | 12 ++++++++++-- .../FieldsInjectedWithIncludedStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/int_limits/Limits.java | 12 ++++++++++-- .../data-type/test/fixtures/basic/MyDataItem.java | 12 ++++++++++-- .../data-type/test/fixtures/basic/MyStruct.java | 12 ++++++++++-- .../test/fixtures/annotation/BinaryMapping.java | 12 ++++++++++-- .../gen-java/test/fixtures/annotation/MyMapping.java | 12 ++++++++++-- .../test/fixtures/annotation/MyMutableStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/annotation/MyStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/annotation/NoEffect.java | 12 ++++++++++-- .../test/fixtures/lazy_constants/Internship.java | 12 ++++++++++-- .../gen-java/test/fixtures/lazy_constants/Range.java | 12 ++++++++++-- .../dev/test/namespace_from_package/module/Foo.java | 12 ++++++++++-- .../Foo.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/optionals/Color.java | 12 ++++++++++-- .../gen-java/test/fixtures/optionals/Person.java | 12 ++++++++++-- .../gen-java/test/fixtures/optionals/Vehicle.java | 12 ++++++++++-- .../gen-java/test/fixtures/module0/Struct.java | 12 ++++++++++-- .../gen-java/test/fixtures/module1/Struct.java | 12 ++++++++++-- .../gen-java/test/fixtures/module2/BigStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/module2/Struct.java | 12 ++++++++++-- .../fixtures/refs/AdaptedStructWithInternBox.java | 12 ++++++++++-- .../refs/AdaptedStructWithTerseInternBox.java | 12 ++++++++++-- .../out/java/gen-java/test/fixtures/refs/Empty.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/refs/MyField.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/refs/MyStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/refs/RecursiveStruct.java | 12 ++++++++++-- .../gen-java/test/fixtures/refs/StructWithBox.java | 12 ++++++++++-- .../test/fixtures/refs/StructWithContainers.java | 12 ++++++++++-- .../test/fixtures/refs/StructWithInternBox.java | 12 ++++++++++-- .../gen-java/test/fixtures/refs/StructWithRef.java | 12 ++++++++++-- .../StructWithRefAndAnnotCppNoexceptMoveCtor.java | 12 ++++++++++-- .../test/fixtures/refs/StructWithRefTypeShared.java | 12 ++++++++++-- .../fixtures/refs/StructWithRefTypeSharedConst.java | 12 ++++++++++-- .../test/fixtures/refs/StructWithRefTypeUnique.java | 12 ++++++++++-- .../test/fixtures/refs/StructWithSharedConst.java | 12 ++++++++++-- .../test/fixtures/refs/StructWithString.java | 12 ++++++++++-- .../test/fixtures/refs/StructWithTerseInternBox.java | 12 ++++++++++-- .../gen-java/test/fixtures/refs/StructWithUnion.java | 12 ++++++++++-- .../out/java/gen-java/test/fixtures/req_opt/Foo.java | 12 ++++++++++-- .../out/java/gen-java/test/fixtures/adapter/Foo.java | 12 ++++++++++-- .../java/gen-java/test/fixtures/adapter/Foo2.java | 12 ++++++++++-- .../out/java/gen-java/test/fixtures/shapes/A.java | 12 ++++++++++-- .../out/java/gen-java/test/fixtures/shapes/B.java | 12 ++++++++++-- .../fixtures/sink/CompatibleWithKeywordSink.java | 12 ++++++++++-- .../gen-java/test/fixtures/sink/FinalResponse.java | 12 ++++++++++-- .../gen-java/test/fixtures/sink/InitialResponse.java | 12 ++++++++++-- .../gen-java/test/fixtures/sink/SinkPayload.java | 12 ++++++++++-- .../thrift/test/terse_write/AdaptedFields.java | 12 ++++++++++-- .../test/terse_write/FieldLevelTerseStruct.java | 12 ++++++++++-- .../facebook/thrift/test/terse_write/MyStruct.java | 12 ++++++++++-- .../test/terse_write/MyStructWithCustomDefault.java | 12 ++++++++++-- .../test/terse_write/StructLevelTerseStruct.java | 12 ++++++++++-- .../terse_write/TerseStructWithCustomDefault.java | 12 ++++++++++-- .../thrift/test/terse_write/WrappedFields.java | 12 ++++++++++-- 129 files changed, 1290 insertions(+), 258 deletions(-) diff --git a/thrift/compiler/generate/templates/java/Struct.mustache b/thrift/compiler/generate/templates/java/Struct.mustache index af9ef0ce568..fb44eb46bff 100644 --- a/thrift/compiler/generate/templates/java/Struct.mustache +++ b/thrift/compiler/generate/templates/java/Struct.mustache @@ -41,11 +41,19 @@ import static com.google.common.base.MoreObjects.ToStringHelper; public final class {{struct:javaCapitalName}} implements com.facebook.thrift.payload.ThriftSerializable { {{> struct/ThriftConstructor}} + public static Builder builder() { + return new Builder(); + } + + public static Builder builder({{struct:javaCapitalName}} other) { + return new Builder(other); + } + {{> struct/StructBuilder}} {{> struct/AdapterDefinition}} - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("{{struct:name}}"); {{#struct:fields}}{{! diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/A.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/A.java index a8e450ca846..920ea673b27 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/A.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/A.java @@ -29,6 +29,14 @@ public A( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(A other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public A build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("A"); static { diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTemplatedNestedTestStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTemplatedNestedTestStruct.java index 06f3fe7d5aa..220ade8e149 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTemplatedNestedTestStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTemplatedNestedTestStruct.java @@ -34,6 +34,14 @@ protected AdaptTemplatedNestedTestStruct() { this.adaptedStruct = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(AdaptTemplatedNestedTestStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.adapter.AdaptTemplatedTestStruct adaptedStruct = null; @@ -59,8 +67,8 @@ public AdaptTemplatedNestedTestStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("AdaptTemplatedNestedTestStruct"); private final test.fixtures.adapter.AdaptTemplatedTestStruct adaptedStruct; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTemplatedTestStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTemplatedTestStruct.java index 556c269a7f0..66e1e3c86dc 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTemplatedTestStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTemplatedTestStruct.java @@ -103,6 +103,14 @@ protected AdaptTemplatedTestStruct() { this.doubleTypedefBool = false; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(AdaptTemplatedTestStruct other) { + return new Builder(other); + } + public static class Builder { private boolean adaptedBool = false; private byte adaptedByte = 0; @@ -365,8 +373,8 @@ public AdaptTemplatedTestStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("AdaptTemplatedTestStruct"); private final boolean adaptedBool; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTestStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTestStruct.java index 13c79a2daec..cbf9806d27e 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTestStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptTestStruct.java @@ -61,6 +61,14 @@ protected AdaptTestStruct() { this.binaryData = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(AdaptTestStruct other) { + return new Builder(other); + } + public static class Builder { private long delay = 0L; private byte[] custom = null; @@ -185,8 +193,8 @@ public AdaptTestStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("AdaptTestStruct"); private final long delay; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptedStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptedStruct.java index c1e45eec7ef..d8637191ea9 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptedStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AdaptedStruct.java @@ -34,6 +34,14 @@ protected AdaptedStruct() { this.data = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(AdaptedStruct other) { + return new Builder(other); + } + public static class Builder { private long data = 0L; @@ -59,8 +67,8 @@ public AdaptedStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("AdaptedStruct"); private final long data; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AlsoMoveOnly.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AlsoMoveOnly.java index e3e35816a27..f54aaa94cdd 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AlsoMoveOnly.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/AlsoMoveOnly.java @@ -34,6 +34,14 @@ protected AlsoMoveOnly() { this.ptr = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(AlsoMoveOnly other) { + return new Builder(other); + } + public static class Builder { private long ptr = 0L; @@ -59,8 +67,8 @@ public AlsoMoveOnly build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("AlsoMoveOnly"); private final long ptr; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/ApplyAdapter.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/ApplyAdapter.java index 63ddf1f5ae9..e8c14b68ae8 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/ApplyAdapter.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/ApplyAdapter.java @@ -29,6 +29,14 @@ public ApplyAdapter( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ApplyAdapter other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public ApplyAdapter build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("ApplyAdapter"); static { diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/B.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/B.java index 9057838500c..a4e367767df 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/B.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/B.java @@ -34,6 +34,14 @@ protected B() { this.a = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(B other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.adapter.A a = null; @@ -59,8 +67,8 @@ public B build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("B"); private final test.fixtures.adapter.A a; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Bar.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Bar.java index 5284bcb0f91..75ebab3b498 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Bar.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Bar.java @@ -52,6 +52,14 @@ protected Bar() { this.adaptedStructField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Bar other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.adapter.Foo structField = null; private test.fixtures.adapter.Foo optionalStructField = null; @@ -143,8 +151,8 @@ public Bar build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Bar"); private final test.fixtures.adapter.Foo structField; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CircularAdaptee.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CircularAdaptee.java index 6bdda3abcd9..4ab393899ed 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CircularAdaptee.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CircularAdaptee.java @@ -34,6 +34,14 @@ protected CircularAdaptee() { this.field = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(CircularAdaptee other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.adapter.CircularStruct field = null; @@ -59,8 +67,8 @@ public CircularAdaptee build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("CircularAdaptee"); private final test.fixtures.adapter.CircularStruct field; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CircularStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CircularStruct.java index fca0e4e9c3e..8e775527904 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CircularStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CircularStruct.java @@ -34,6 +34,14 @@ protected CircularStruct() { this.field = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(CircularStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.adapter.CircularAdaptee field = null; @@ -59,8 +67,8 @@ public CircularStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("CircularStruct"); private final test.fixtures.adapter.CircularAdaptee field; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Config.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Config.java index 40d9a51dad8..06b0d59d6e0 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Config.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Config.java @@ -34,6 +34,14 @@ protected Config() { this.path = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Config other) { + return new Builder(other); + } + public static class Builder { private String path = null; @@ -59,8 +67,8 @@ public Config build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Config"); private final String path; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CountingStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CountingStruct.java index 5ed5ae9f071..ff400760f8e 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CountingStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/CountingStruct.java @@ -40,6 +40,14 @@ protected CountingStruct() { this.regularString = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(CountingStruct other) { + return new Builder(other); + } + public static class Builder { private Long regularInt = null; private Long countingInt = null; @@ -87,8 +95,8 @@ public CountingStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("CountingStruct"); private final Long regularInt; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DeclaredAfterStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DeclaredAfterStruct.java index 5e61c158b98..e685d9e2320 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DeclaredAfterStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DeclaredAfterStruct.java @@ -29,6 +29,14 @@ public DeclaredAfterStruct( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(DeclaredAfterStruct other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public DeclaredAfterStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("DeclaredAfterStruct"); static { diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DirectlyAdapted.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DirectlyAdapted.java index c4a2ed85cb3..4c89fa0f6e3 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DirectlyAdapted.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DirectlyAdapted.java @@ -34,6 +34,14 @@ protected DirectlyAdapted() { this.field = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(DirectlyAdapted other) { + return new Builder(other); + } + public static class Builder { private int field = 0; @@ -59,8 +67,8 @@ public DirectlyAdapted build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("DirectlyAdapted"); private final int field; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DirectlyAdaptedStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DirectlyAdaptedStruct.java index 77a33b13b3d..9370698bf9e 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DirectlyAdaptedStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/DirectlyAdaptedStruct.java @@ -34,6 +34,14 @@ protected DirectlyAdaptedStruct() { this.data = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(DirectlyAdaptedStruct other) { + return new Builder(other); + } + public static class Builder { private long data = 0L; @@ -59,8 +67,8 @@ public DirectlyAdaptedStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("DirectlyAdaptedStruct"); private final long data; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Foo.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Foo.java index 2c41c1ce546..f8ba16dd03c 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Foo.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Foo.java @@ -64,6 +64,14 @@ protected Foo() { this.doubleAdaptedField = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Foo other) { + return new Builder(other); + } + public static class Builder { private int intField = 0; private Integer optionalIntField = null; @@ -199,8 +207,8 @@ public Foo build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Foo"); private final int intField; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/HeapAllocated.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/HeapAllocated.java index 2797c856614..eb6ad5e1710 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/HeapAllocated.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/HeapAllocated.java @@ -29,6 +29,14 @@ public HeapAllocated( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(HeapAllocated other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public HeapAllocated build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("HeapAllocated"); static { diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/IndependentDirectlyAdapted.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/IndependentDirectlyAdapted.java index b2201335c70..a12fe4c0503 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/IndependentDirectlyAdapted.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/IndependentDirectlyAdapted.java @@ -34,6 +34,14 @@ protected IndependentDirectlyAdapted() { this.field = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(IndependentDirectlyAdapted other) { + return new Builder(other); + } + public static class Builder { private int field = 0; @@ -59,8 +67,8 @@ public IndependentDirectlyAdapted build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("IndependentDirectlyAdapted"); private final int field; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MoveOnly.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MoveOnly.java index 65f3a2dc0ef..8f3f0b856aa 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MoveOnly.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MoveOnly.java @@ -34,6 +34,14 @@ protected MoveOnly() { this.ptr = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MoveOnly other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.adapter.HeapAllocated ptr = null; @@ -59,8 +67,8 @@ public MoveOnly build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MoveOnly"); private final test.fixtures.adapter.HeapAllocated ptr; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MyAnnotation.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MyAnnotation.java index 5269ea8ce05..2aa293c08ba 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MyAnnotation.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MyAnnotation.java @@ -37,6 +37,14 @@ protected MyAnnotation() { this.color = test.fixtures.adapter.Color.RED; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyAnnotation other) { + return new Builder(other); + } + public static class Builder { private String signature = null; private test.fixtures.adapter.Color color = test.fixtures.adapter.Color.RED; @@ -73,8 +81,8 @@ public MyAnnotation build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyAnnotation"); private final String signature; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MyStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MyStruct.java index 26443cbf189..3ef34aa4e0e 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MyStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/MyStruct.java @@ -37,6 +37,14 @@ protected MyStruct() { this.setString = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private int field = 0; private Set setString = null; @@ -73,8 +81,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final int field; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Person.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Person.java index 26fcd3416e4..31fce6b5e32 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Person.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Person.java @@ -34,6 +34,14 @@ protected Person() { this.name = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Person other) { + return new Builder(other); + } + public static class Builder { private String name = null; @@ -59,8 +67,8 @@ public Person build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Person"); private final String name; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Person2.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Person2.java index 52625d731da..cb4fecc42fd 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Person2.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/Person2.java @@ -34,6 +34,14 @@ protected Person2() { this.name = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Person2 other) { + return new Builder(other); + } + public static class Builder { private String name = null; @@ -59,8 +67,8 @@ public Person2 build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Person2"); private final String name; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/RenamedStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/RenamedStruct.java index ac73b06ec05..bfb8a57747d 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/RenamedStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/RenamedStruct.java @@ -34,6 +34,14 @@ protected RenamedStruct() { this.data = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(RenamedStruct other) { + return new Builder(other); + } + public static class Builder { private long data = 0L; @@ -59,8 +67,8 @@ public RenamedStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("RenamedStruct"); private final long data; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/RenamedStructWithStructAdapterAndFieldAdapter.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/RenamedStructWithStructAdapterAndFieldAdapter.java index 8e0218996f9..dbb1be3bd9d 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/RenamedStructWithStructAdapterAndFieldAdapter.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/RenamedStructWithStructAdapterAndFieldAdapter.java @@ -34,6 +34,14 @@ protected RenamedStructWithStructAdapterAndFieldAdapter() { this.field = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(RenamedStructWithStructAdapterAndFieldAdapter other) { + return new Builder(other); + } + public static class Builder { private int field = 0; @@ -59,8 +67,8 @@ public RenamedStructWithStructAdapterAndFieldAdapter build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("RenamedStructWithStructAdapterAndFieldAdapter"); private final int field; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/ReorderedStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/ReorderedStruct.java index c10e9a95b4e..517162e2637 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/ReorderedStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/ReorderedStruct.java @@ -34,6 +34,14 @@ protected ReorderedStruct() { this.reorderedDependentAdapted = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ReorderedStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.adapter.DeclaredAfterStruct reorderedDependentAdapted = null; @@ -59,8 +67,8 @@ public ReorderedStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("ReorderedStruct"); private final test.fixtures.adapter.DeclaredAfterStruct reorderedDependentAdapted; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/SameNamespaceStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/SameNamespaceStruct.java index fd718da9397..9232c0dace5 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/SameNamespaceStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/SameNamespaceStruct.java @@ -34,6 +34,14 @@ protected SameNamespaceStruct() { this.data = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(SameNamespaceStruct other) { + return new Builder(other); + } + public static class Builder { private long data = 0L; @@ -59,8 +67,8 @@ public SameNamespaceStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("SameNamespaceStruct"); private final long data; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/StructFieldAdaptedStruct.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/StructFieldAdaptedStruct.java index 2e6cb870406..6d3ae414251 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/StructFieldAdaptedStruct.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/StructFieldAdaptedStruct.java @@ -43,6 +43,14 @@ protected StructFieldAdaptedStruct() { this.typedefOfAdapted = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructFieldAdaptedStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.adapter.AdaptedStruct adaptedStruct = null; private test.fixtures.adapter.AdaptedStruct adaptedTypedef = null; @@ -101,8 +109,8 @@ public StructFieldAdaptedStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructFieldAdaptedStruct"); private final test.fixtures.adapter.AdaptedStruct adaptedStruct; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/StructWithFieldAdapter.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/StructWithFieldAdapter.java index af5aefa8ec9..9f09a1a4fd2 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/StructWithFieldAdapter.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/StructWithFieldAdapter.java @@ -43,6 +43,14 @@ protected StructWithFieldAdapter() { this.optBoxedField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithFieldAdapter other) { + return new Builder(other); + } + public static class Builder { private int field = 0; private int sharedField = 0; @@ -101,8 +109,8 @@ public StructWithFieldAdapter build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithFieldAdapter"); private final int field; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/TerseAdaptedFields.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/TerseAdaptedFields.java index 25755600023..07d3a8362f1 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/TerseAdaptedFields.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/TerseAdaptedFields.java @@ -40,6 +40,14 @@ protected TerseAdaptedFields() { this.setField = com.facebook.thrift.util.IntrinsicDefaults.defaultSet(); } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(TerseAdaptedFields other) { + return new Builder(other); + } + public static class Builder { private int intField = 0; private String stringField = com.facebook.thrift.util.IntrinsicDefaults.defaultString(); @@ -87,8 +95,8 @@ public TerseAdaptedFields build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("TerseAdaptedFields"); private final int intField; diff --git a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/TransitiveAdapted.java b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/TransitiveAdapted.java index 7b5141cccd7..1e2005ec104 100644 --- a/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/TransitiveAdapted.java +++ b/thrift/compiler/test/fixtures/adapter/out/java/gen-java/test/fixtures/adapter/TransitiveAdapted.java @@ -29,6 +29,14 @@ public TransitiveAdapted( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(TransitiveAdapted other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public TransitiveAdapted build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("TransitiveAdapted"); static { diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/MyStruct.java b/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/MyStruct.java index 609d9177a64..26431913889 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/MyStruct.java +++ b/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/MyStruct.java @@ -58,6 +58,14 @@ protected MyStruct() { this.myUnion = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private long major = 0L; private String _abstract = null; @@ -171,8 +179,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final long major; diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/MyStructNestedAnnotation.java b/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/MyStructNestedAnnotation.java index 27734a9e523..cd1ce81ec9c 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/MyStructNestedAnnotation.java +++ b/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/MyStructNestedAnnotation.java @@ -34,6 +34,14 @@ protected MyStructNestedAnnotation() { this.name = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStructNestedAnnotation other) { + return new Builder(other); + } + public static class Builder { private String name = null; @@ -59,8 +67,8 @@ public MyStructNestedAnnotation build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStructNestedAnnotation"); private final String name; diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/SecretStruct.java b/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/SecretStruct.java index 477a1921cd8..ee264185b3c 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/SecretStruct.java +++ b/thrift/compiler/test/fixtures/basic-annotations/out/java/gen-java/test/fixtures/basicannotations/SecretStruct.java @@ -37,6 +37,14 @@ protected SecretStruct() { this.password = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(SecretStruct other) { + return new Builder(other); + } + public static class Builder { private long id = 0L; private String password = null; @@ -74,8 +82,8 @@ public SecretStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("SecretStruct"); private final long id; diff --git a/thrift/compiler/test/fixtures/basic-enum/out/java/gen-java/test/fixtures/swift/enumstrict/MyStruct.java b/thrift/compiler/test/fixtures/basic-enum/out/java/gen-java/test/fixtures/swift/enumstrict/MyStruct.java index 0499d8f133b..bd7db720556 100644 --- a/thrift/compiler/test/fixtures/basic-enum/out/java/gen-java/test/fixtures/swift/enumstrict/MyStruct.java +++ b/thrift/compiler/test/fixtures/basic-enum/out/java/gen-java/test/fixtures/swift/enumstrict/MyStruct.java @@ -37,6 +37,14 @@ protected MyStruct() { this.myBigEnum = test.fixtures.swift.enumstrict.MyBigEnum.ONE; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.swift.enumstrict.MyEnum myEnum = test.fixtures.swift.enumstrict.MyEnum.fromInteger(0); private test.fixtures.swift.enumstrict.MyBigEnum myBigEnum = test.fixtures.swift.enumstrict.MyBigEnum.ONE; @@ -73,8 +81,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final test.fixtures.swift.enumstrict.MyEnum myEnum; diff --git a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/LegacyStruct.java b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/LegacyStruct.java index 351c2a03824..7e6400f33c2 100644 --- a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/LegacyStruct.java +++ b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/LegacyStruct.java @@ -28,6 +28,14 @@ public LegacyStruct() { this.bad = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(LegacyStruct other) { + return new Builder(other); + } + public static class Builder { private int normal = 0; private int bad = 0; @@ -62,8 +70,8 @@ public LegacyStruct build() { return result; } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("LegacyStruct"); private int normal; diff --git a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyDataItem.java b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyDataItem.java index 5f83a98703a..07123c099b3 100644 --- a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyDataItem.java +++ b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyDataItem.java @@ -28,6 +28,14 @@ public MyDataItem() { this.field2 = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyDataItem other) { + return new Builder(other); + } + public static class Builder { private int field1 = 0; private int field2 = 0; @@ -62,8 +70,8 @@ public MyDataItem build() { return result; } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyDataItem"); private int field1; diff --git a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct1.java b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct1.java index f3478752927..54553133f4f 100644 --- a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct1.java +++ b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct1.java @@ -43,6 +43,14 @@ protected MyStruct1() { this.major = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct1 other) { + return new Builder(other); + } + public static class Builder { private long myIntField = 0L; private String myStringField = null; @@ -101,8 +109,8 @@ public MyStruct1 build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct1"); private final long myIntField; diff --git a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct2.java b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct2.java index 8e54a23aca4..e27df2bec53 100644 --- a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct2.java +++ b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct2.java @@ -28,6 +28,14 @@ public MyStruct2() { this.myString = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct2 other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.basic_swift_bean.MyStruct1 myStruct1 = null; private String myString = null; @@ -62,8 +70,8 @@ public MyStruct2 build() { return result; } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct2"); private test.fixtures.basic_swift_bean.MyStruct1 myStruct1; diff --git a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct3.java b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct3.java index 0708e5fed36..cf7ff38cf3c 100644 --- a/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct3.java +++ b/thrift/compiler/test/fixtures/basic-swift-bean/out/java/gen-java/test/fixtures/basic_swift_bean/MyStruct3.java @@ -56,6 +56,14 @@ public MyStruct3() { .build()); } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct3 other) { + return new Builder(other); + } + public static class Builder { private short myInt16 = (short)42; private int myInt32 = 422; @@ -218,8 +226,8 @@ public MyStruct3 build() { return result; } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct3"); private short myInt16; diff --git a/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/Containers.java b/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/Containers.java index 98eb44f3b6e..35c5899a2ac 100644 --- a/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/Containers.java +++ b/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/Containers.java @@ -40,6 +40,14 @@ protected Containers() { this.stringToI64Map = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Containers other) { + return new Builder(other); + } + public static class Builder { private List i32List = null; private Set stringSet = null; @@ -87,8 +95,8 @@ public Containers build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Containers"); private final List i32List; diff --git a/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/MyDataItem.java b/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/MyDataItem.java index 17d9451f051..e3f8423371a 100644 --- a/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/MyDataItem.java +++ b/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/MyDataItem.java @@ -29,6 +29,14 @@ public MyDataItem( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyDataItem other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public MyDataItem build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyDataItem"); static { diff --git a/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/MyStruct.java b/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/MyStruct.java index ad6bdf787a6..230c2b65b0f 100644 --- a/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/MyStruct.java +++ b/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/MyStruct.java @@ -58,6 +58,14 @@ protected MyStruct() { this.noHackCodegenField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private long myIntField = 0L; private String myStringField = null; @@ -171,8 +179,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final long myIntField; diff --git a/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/ReservedKeyword.java b/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/ReservedKeyword.java index e520cc6732f..6c597ce2331 100644 --- a/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/ReservedKeyword.java +++ b/thrift/compiler/test/fixtures/basic/out/java/gen-java/test/fixtures/basic/ReservedKeyword.java @@ -34,6 +34,14 @@ protected ReservedKeyword() { this.reservedField = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ReservedKeyword other) { + return new Builder(other); + } + public static class Builder { private int reservedField = 0; @@ -59,8 +67,8 @@ public ReservedKeyword build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("ReservedKeyword"); private final int reservedField; diff --git a/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyBigStruct.java b/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyBigStruct.java index adb2fec9e64..ffa545addb4 100644 --- a/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyBigStruct.java +++ b/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyBigStruct.java @@ -283,6 +283,14 @@ protected MyBigStruct() { this.msg257 = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyBigStruct other) { + return new Builder(other); + } + public static class Builder { private String msg1 = null; private String msg2 = null; @@ -3122,8 +3130,8 @@ public MyBigStruct build() { return result; } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyBigStruct"); private String msg1; diff --git a/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyMutableBigStruct.java b/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyMutableBigStruct.java index 7a1787139b0..7751ea68450 100644 --- a/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyMutableBigStruct.java +++ b/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyMutableBigStruct.java @@ -283,6 +283,14 @@ public MyMutableBigStruct() { this.msg257 = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyMutableBigStruct other) { + return new Builder(other); + } + public static class Builder { private String msg1 = null; private String msg2 = null; @@ -3122,8 +3130,8 @@ public MyMutableBigStruct build() { return result; } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyMutableBigStruct"); private String msg1; diff --git a/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyNomralStruct.java b/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyNomralStruct.java index a4d5d9fde1d..2586c4ee9c0 100644 --- a/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyNomralStruct.java +++ b/thrift/compiler/test/fixtures/big-struct/out/java/gen-java/test/fixtures/basic/MyNomralStruct.java @@ -121,6 +121,14 @@ protected MyNomralStruct() { this.myDoubleField30 = 0.; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyNomralStruct other) { + return new Builder(other); + } + public static class Builder { private String msg1 = null; private String msg2 = null; @@ -465,8 +473,8 @@ public MyNomralStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyNomralStruct"); private final String msg1; diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/ComplexNestedStruct.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/ComplexNestedStruct.java index bdf092d6865..95cff142609 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/ComplexNestedStruct.java +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/ComplexNestedStruct.java @@ -85,6 +85,14 @@ protected ComplexNestedStruct() { this.mapKeyListValSet = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ComplexNestedStruct other) { + return new Builder(other); + } + public static class Builder { private Set> setOfSetOfInt = null; private List>>> listofListOfListOfListOfEnum = null; @@ -297,8 +305,8 @@ public ComplexNestedStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("ComplexNestedStruct"); private final Set> setOfSetOfInt; diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/DefaultStruct.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/DefaultStruct.java index be9ceda60b0..74b1a1e070d 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/DefaultStruct.java +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/DefaultStruct.java @@ -145,6 +145,14 @@ protected DefaultStruct() { .build(); } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(DefaultStruct other) { + return new Builder(other); + } + public static class Builder { private long myLongDFset = 10L; private long myLongDF = 0L; @@ -449,8 +457,8 @@ public DefaultStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("defaultStruct"); private final long myLongDFset; diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyDataItem.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyDataItem.java index eb5bbc1f107..201efb12ec4 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyDataItem.java +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyDataItem.java @@ -29,6 +29,14 @@ public MyDataItem( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyDataItem other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public MyDataItem build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyDataItem"); static { diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStruct.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStruct.java index 74e70f527c2..bd645e9da8f 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStruct.java +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStruct.java @@ -115,6 +115,14 @@ protected MyStruct() { this.mListList = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private long myIntField = 0L; private String myStringField = null; @@ -437,8 +445,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final long myIntField; diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructFloatFieldThrowExp.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructFloatFieldThrowExp.java index 258a5c6633c..0fcbb1f2183 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructFloatFieldThrowExp.java +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructFloatFieldThrowExp.java @@ -43,6 +43,14 @@ protected MyStructFloatFieldThrowExp() { this.myFloatField = 0.f; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStructFloatFieldThrowExp other) { + return new Builder(other); + } + public static class Builder { private long myLongField = 0L; private byte myByteField = 0; @@ -101,8 +109,8 @@ public MyStructFloatFieldThrowExp build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStructFloatFieldThrowExp"); private final long myLongField; diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructMapFloatThrowExp.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructMapFloatThrowExp.java index a35491af88f..45b689f62f0 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructMapFloatThrowExp.java +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructMapFloatThrowExp.java @@ -37,6 +37,14 @@ protected MyStructMapFloatThrowExp() { this.mapListOfFloats = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStructMapFloatThrowExp other) { + return new Builder(other); + } + public static class Builder { private long myLongField = 0L; private Map>> mapListOfFloats = null; @@ -73,8 +81,8 @@ public MyStructMapFloatThrowExp build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStructMapFloatThrowExp"); private final long myLongField; diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructTypeDef.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructTypeDef.java index 19621bb6484..27474ce0314 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructTypeDef.java +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/MyStructTypeDef.java @@ -58,6 +58,14 @@ protected MyStructTypeDef() { this.myMapListOfTypeDef = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStructTypeDef other) { + return new Builder(other); + } + public static class Builder { private long myLongField = 0L; private long myLongTypeDef = 0L; @@ -171,8 +179,8 @@ public MyStructTypeDef build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStructTypeDef"); private final long myLongField; diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/SimpleStruct.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/SimpleStruct.java index 617b24f4929..4ace764252f 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/SimpleStruct.java +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/SimpleStruct.java @@ -37,6 +37,14 @@ protected SimpleStruct() { this.name = "Batman"; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(SimpleStruct other) { + return new Builder(other); + } + public static class Builder { private long age = 60L; private String name = "Batman"; @@ -73,8 +81,8 @@ public SimpleStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("SimpleStruct"); private final long age; diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/TypeRemapped.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/TypeRemapped.java index e6c175149de..341a010e857 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/TypeRemapped.java +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/TypeRemapped.java @@ -43,6 +43,14 @@ protected TypeRemapped() { this.binaryTestBuffer = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(TypeRemapped other) { + return new Builder(other); + } + public static class Builder { private it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap lsMap = null; private it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap ioMap = null; @@ -101,8 +109,8 @@ public TypeRemapped build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("TypeRemapped"); private final it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap lsMap; diff --git a/thrift/compiler/test/fixtures/complex-union/out/java/gen-java/test/fixtures/complex_union/NonCopyableStruct.java b/thrift/compiler/test/fixtures/complex-union/out/java/gen-java/test/fixtures/complex_union/NonCopyableStruct.java index 3f65b91bd76..ff975c5f83a 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/java/gen-java/test/fixtures/complex_union/NonCopyableStruct.java +++ b/thrift/compiler/test/fixtures/complex-union/out/java/gen-java/test/fixtures/complex_union/NonCopyableStruct.java @@ -34,6 +34,14 @@ protected NonCopyableStruct() { this.num = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(NonCopyableStruct other) { + return new Builder(other); + } + public static class Builder { private long num = 0L; @@ -59,8 +67,8 @@ public NonCopyableStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("NonCopyableStruct"); private final long num; diff --git a/thrift/compiler/test/fixtures/complex-union/out/java/gen-java/test/fixtures/complex_union/Val.java b/thrift/compiler/test/fixtures/complex-union/out/java/gen-java/test/fixtures/complex_union/Val.java index ea816f03c7d..ec312236b32 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/java/gen-java/test/fixtures/complex_union/Val.java +++ b/thrift/compiler/test/fixtures/complex-union/out/java/gen-java/test/fixtures/complex_union/Val.java @@ -40,6 +40,14 @@ protected Val() { this.typedefValue = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Val other) { + return new Builder(other); + } + public static class Builder { private String strVal = null; private int intVal = 0; @@ -87,8 +95,8 @@ public Val build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Val"); private final String strVal; diff --git a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Internship.java b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Internship.java index 8a4f28a8af0..2d8479db1e4 100644 --- a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Internship.java +++ b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Internship.java @@ -46,6 +46,14 @@ protected Internship() { this.school = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Internship other) { + return new Builder(other); + } + public static class Builder { private int weeks = 0; private String title = null; @@ -115,8 +123,8 @@ public Internship build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Internship"); private final int weeks; diff --git a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Range.java b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Range.java index 1944096af54..5c87b114ff2 100644 --- a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Range.java +++ b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Range.java @@ -37,6 +37,14 @@ protected Range() { this.max = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Range other) { + return new Builder(other); + } + public static class Builder { private int min = 0; private int max = 0; @@ -73,8 +81,8 @@ public Range build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Range"); private final int min; diff --git a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct1.java b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct1.java index 6d008266d54..c145b24db93 100644 --- a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct1.java +++ b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct1.java @@ -37,6 +37,14 @@ protected Struct1() { this.b = ""; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Struct1 other) { + return new Builder(other); + } + public static class Builder { private int a = 1234567; private String b = ""; @@ -73,8 +81,8 @@ public Struct1 build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("struct1"); private final int a; diff --git a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct2.java b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct2.java index ebc20550905..5fa9e097ed9 100644 --- a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct2.java +++ b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct2.java @@ -43,6 +43,14 @@ protected Struct2() { this.d = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Struct2 other) { + return new Builder(other); + } + public static class Builder { private int a = 0; private String b = null; @@ -101,8 +109,8 @@ public Struct2 build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("struct2"); private final int a; diff --git a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct3.java b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct3.java index 75bac4b91a3..eb9b061a8bf 100644 --- a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct3.java +++ b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct3.java @@ -40,6 +40,14 @@ protected Struct3() { this.c = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Struct3 other) { + return new Builder(other); + } + public static class Builder { private String a = null; private int b = 0; @@ -87,8 +95,8 @@ public Struct3 build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("struct3"); private final String a; diff --git a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct4.java b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct4.java index 8443a653da0..ce7c31ce992 100644 --- a/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct4.java +++ b/thrift/compiler/test/fixtures/constants/out/java/gen-java/test/fixtures/constants/Struct4.java @@ -40,6 +40,14 @@ protected Struct4() { this.c = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Struct4 other) { + return new Builder(other); + } + public static class Builder { private int a = 0; private Double b = null; @@ -87,8 +95,8 @@ public Struct4 build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("struct4"); private final int a; diff --git a/thrift/compiler/test/fixtures/empty-struct/out/java/gen-java/test/fixtures/empty_struct/Empty.java b/thrift/compiler/test/fixtures/empty-struct/out/java/gen-java/test/fixtures/empty_struct/Empty.java index 747c9cee8b8..28fbd0f2bed 100644 --- a/thrift/compiler/test/fixtures/empty-struct/out/java/gen-java/test/fixtures/empty_struct/Empty.java +++ b/thrift/compiler/test/fixtures/empty-struct/out/java/gen-java/test/fixtures/empty_struct/Empty.java @@ -29,6 +29,14 @@ public Empty( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Empty other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public Empty build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Empty"); static { diff --git a/thrift/compiler/test/fixtures/enums/out/java/gen-java/test/fixtures/enums/MyStruct.java b/thrift/compiler/test/fixtures/enums/out/java/gen-java/test/fixtures/enums/MyStruct.java index 069d4c9479e..f17569da338 100644 --- a/thrift/compiler/test/fixtures/enums/out/java/gen-java/test/fixtures/enums/MyStruct.java +++ b/thrift/compiler/test/fixtures/enums/out/java/gen-java/test/fixtures/enums/MyStruct.java @@ -43,6 +43,14 @@ protected MyStruct() { this.me1T2 = test.fixtures.enums.MyEnum1.ME1_1; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.enums.MyEnum2 me23 = test.fixtures.enums.MyEnum2.fromInteger(3); private test.fixtures.enums.MyEnum3 me3N3 = test.fixtures.enums.MyEnum3.fromInteger(-3); @@ -101,8 +109,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final test.fixtures.enums.MyEnum2 me23; diff --git a/thrift/compiler/test/fixtures/enums/out/java/gen-java/test/fixtures/enums/SomeStruct.java b/thrift/compiler/test/fixtures/enums/out/java/gen-java/test/fixtures/enums/SomeStruct.java index 3f03ca91e0e..10bf21c5f94 100644 --- a/thrift/compiler/test/fixtures/enums/out/java/gen-java/test/fixtures/enums/SomeStruct.java +++ b/thrift/compiler/test/fixtures/enums/out/java/gen-java/test/fixtures/enums/SomeStruct.java @@ -44,6 +44,14 @@ protected SomeStruct() { .build(); } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(SomeStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.enums.Metasyntactic reasonable = test.fixtures.enums.Metasyntactic.FOO; private test.fixtures.enums.Metasyntactic fine = test.fixtures.enums.Metasyntactic.BAR; @@ -103,8 +111,8 @@ public SomeStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("SomeStruct"); private final test.fixtures.enums.Metasyntactic reasonable; diff --git a/thrift/compiler/test/fixtures/includes/out/java/gen-java/test/fixtures/includes/MyStruct.java b/thrift/compiler/test/fixtures/includes/out/java/gen-java/test/fixtures/includes/MyStruct.java index a30a5eab54a..4f29ee49d9e 100644 --- a/thrift/compiler/test/fixtures/includes/out/java/gen-java/test/fixtures/includes/MyStruct.java +++ b/thrift/compiler/test/fixtures/includes/out/java/gen-java/test/fixtures/includes/MyStruct.java @@ -40,6 +40,14 @@ protected MyStruct() { this.myIncludedInt = 42L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.includes.includes.Included myIncludedField = test.fixtures.includes.includes.Constants.EXAMPLE_INCLUDED; private test.fixtures.includes.includes.Included myOtherIncludedField = null; @@ -87,8 +95,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final test.fixtures.includes.includes.Included myIncludedField; diff --git a/thrift/compiler/test/fixtures/includes/out/java_includes/gen-java/test/fixtures/includes/includes/Included.java b/thrift/compiler/test/fixtures/includes/out/java_includes/gen-java/test/fixtures/includes/includes/Included.java index 6c05fac73e5..45b080ce9f0 100644 --- a/thrift/compiler/test/fixtures/includes/out/java_includes/gen-java/test/fixtures/includes/includes/Included.java +++ b/thrift/compiler/test/fixtures/includes/out/java_includes/gen-java/test/fixtures/includes/includes/Included.java @@ -37,6 +37,14 @@ protected Included() { this.myTransitiveField = test.fixtures.includes.transitive.Constants.EXAMPLE_FOO; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Included other) { + return new Builder(other); + } + public static class Builder { private long myIntField = 0L; private test.fixtures.includes.transitive.Foo myTransitiveField = test.fixtures.includes.transitive.Constants.EXAMPLE_FOO; @@ -73,8 +81,8 @@ public Included build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Included"); private final long myIntField; diff --git a/thrift/compiler/test/fixtures/includes/out/java_transitive/gen-java/test/fixtures/includes/transitive/Foo.java b/thrift/compiler/test/fixtures/includes/out/java_transitive/gen-java/test/fixtures/includes/transitive/Foo.java index 79c22779208..bfc4ca38dd7 100644 --- a/thrift/compiler/test/fixtures/includes/out/java_transitive/gen-java/test/fixtures/includes/transitive/Foo.java +++ b/thrift/compiler/test/fixtures/includes/out/java_transitive/gen-java/test/fixtures/includes/transitive/Foo.java @@ -34,6 +34,14 @@ protected Foo() { this.a = 2L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Foo other) { + return new Builder(other); + } + public static class Builder { private long a = 2L; @@ -59,8 +67,8 @@ public Foo build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Foo"); private final long a; diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/Fields.java b/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/Fields.java index 2ca60b07ce2..9566e93e379 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/Fields.java +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/Fields.java @@ -34,6 +34,14 @@ protected Fields() { this.injectedField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Fields other) { + return new Builder(other); + } + public static class Builder { private String injectedField = null; @@ -59,8 +67,8 @@ public Fields build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Fields"); private final String injectedField; diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedToEmptyStruct.java b/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedToEmptyStruct.java index b90e729cdce..2b052940546 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedToEmptyStruct.java +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedToEmptyStruct.java @@ -34,6 +34,14 @@ protected FieldsInjectedToEmptyStruct() { this.injectedField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(FieldsInjectedToEmptyStruct other) { + return new Builder(other); + } + public static class Builder { private String injectedField = null; @@ -59,8 +67,8 @@ public FieldsInjectedToEmptyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("FieldsInjectedToEmptyStruct"); private final String injectedField; diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedToStruct.java b/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedToStruct.java index 15477ca7653..b2adf09d011 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedToStruct.java +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedToStruct.java @@ -37,6 +37,14 @@ protected FieldsInjectedToStruct() { this.injectedField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(FieldsInjectedToStruct other) { + return new Builder(other); + } + public static class Builder { private String stringField = null; private String injectedField = null; @@ -73,8 +81,8 @@ public FieldsInjectedToStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("FieldsInjectedToStruct"); private final String stringField; diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedWithIncludedStruct.java b/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedWithIncludedStruct.java index c12a908bbf7..8b4d65ce7d0 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedWithIncludedStruct.java +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/java/gen-java/test/fixtures/injectMetadataFields/FieldsInjectedWithIncludedStruct.java @@ -43,6 +43,14 @@ protected FieldsInjectedWithIncludedStruct() { this.injectedUnstructuredAnnotationField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(FieldsInjectedWithIncludedStruct other) { + return new Builder(other); + } + public static class Builder { private String stringField = null; private String injectedField = null; @@ -101,8 +109,8 @@ public FieldsInjectedWithIncludedStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("FieldsInjectedWithIncludedStruct"); private final String stringField; diff --git a/thrift/compiler/test/fixtures/int_limits/out/java/gen-java/test/fixtures/int_limits/Limits.java b/thrift/compiler/test/fixtures/int_limits/out/java/gen-java/test/fixtures/int_limits/Limits.java index ae6a733a497..ccff8f69ad1 100644 --- a/thrift/compiler/test/fixtures/int_limits/out/java/gen-java/test/fixtures/int_limits/Limits.java +++ b/thrift/compiler/test/fixtures/int_limits/out/java/gen-java/test/fixtures/int_limits/Limits.java @@ -55,6 +55,14 @@ protected Limits() { this.minByteField = (byte)-128; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Limits other) { + return new Builder(other); + } + public static class Builder { private long maxI64Field = 9223372036854775807L; private long minI64Field = -9223372036854775808L; @@ -157,8 +165,8 @@ public Limits build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Limits"); private final long maxI64Field; diff --git a/thrift/compiler/test/fixtures/java-options/out/java/gen-java/data-type/test/fixtures/basic/MyDataItem.java b/thrift/compiler/test/fixtures/java-options/out/java/gen-java/data-type/test/fixtures/basic/MyDataItem.java index 17d9451f051..e3f8423371a 100644 --- a/thrift/compiler/test/fixtures/java-options/out/java/gen-java/data-type/test/fixtures/basic/MyDataItem.java +++ b/thrift/compiler/test/fixtures/java-options/out/java/gen-java/data-type/test/fixtures/basic/MyDataItem.java @@ -29,6 +29,14 @@ public MyDataItem( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyDataItem other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public MyDataItem build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyDataItem"); static { diff --git a/thrift/compiler/test/fixtures/java-options/out/java/gen-java/data-type/test/fixtures/basic/MyStruct.java b/thrift/compiler/test/fixtures/java-options/out/java/gen-java/data-type/test/fixtures/basic/MyStruct.java index ad6bdf787a6..230c2b65b0f 100644 --- a/thrift/compiler/test/fixtures/java-options/out/java/gen-java/data-type/test/fixtures/basic/MyStruct.java +++ b/thrift/compiler/test/fixtures/java-options/out/java/gen-java/data-type/test/fixtures/basic/MyStruct.java @@ -58,6 +58,14 @@ protected MyStruct() { this.noHackCodegenField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private long myIntField = 0L; private String myStringField = null; @@ -171,8 +179,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final long myIntField; diff --git a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/BinaryMapping.java b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/BinaryMapping.java index 6e449bdd8ad..daf0fd74f45 100644 --- a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/BinaryMapping.java +++ b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/BinaryMapping.java @@ -37,6 +37,14 @@ protected BinaryMapping() { this.regularBinary = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(BinaryMapping other) { + return new Builder(other); + } + public static class Builder { private Map binaryMap = null; private Map regularBinary = null; @@ -73,8 +81,8 @@ public BinaryMapping build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("BinaryMapping"); private final Map binaryMap; diff --git a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyMapping.java b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyMapping.java index 9831e0ae207..97520f3e28e 100644 --- a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyMapping.java +++ b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyMapping.java @@ -43,6 +43,14 @@ protected MyMapping() { this.regularBinary = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyMapping other) { + return new Builder(other); + } + public static class Builder { private com.foo.FastLongStringMap lsMap = null; private com.foo.FastIntObjectMap ioMap = null; @@ -101,8 +109,8 @@ public MyMapping build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyMapping"); private final com.foo.FastLongStringMap lsMap; diff --git a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyMutableStruct.java b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyMutableStruct.java index c8d8088aee8..74c4f270137 100644 --- a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyMutableStruct.java +++ b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyMutableStruct.java @@ -28,6 +28,14 @@ public MyMutableStruct() { this.stringField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyMutableStruct other) { + return new Builder(other); + } + public static class Builder { private long intField = 0L; private String stringField = null; @@ -62,8 +70,8 @@ public MyMutableStruct build() { return result; } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyMutableStruct"); private long intField; diff --git a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyStruct.java b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyStruct.java index 669e0ac8fd4..7537393bf1f 100644 --- a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyStruct.java +++ b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/MyStruct.java @@ -49,6 +49,14 @@ protected MyStruct() { this.password = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private long intField = 0L; private String stringField = null; @@ -130,8 +138,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final long intField; diff --git a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/NoEffect.java b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/NoEffect.java index b7ac89a5b53..937c45c5dfc 100644 --- a/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/NoEffect.java +++ b/thrift/compiler/test/fixtures/java-swift-annotation/out/java/gen-java/test/fixtures/annotation/NoEffect.java @@ -37,6 +37,14 @@ protected NoEffect() { this.aCamelI32 = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(NoEffect other) { + return new Builder(other); + } + public static class Builder { private String anSnakeString = null; private int aCamelI32 = 0; @@ -73,8 +81,8 @@ public NoEffect build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("No_effect"); private final String anSnakeString; diff --git a/thrift/compiler/test/fixtures/lazy_constants/out/java/gen-java/test/fixtures/lazy_constants/Internship.java b/thrift/compiler/test/fixtures/lazy_constants/out/java/gen-java/test/fixtures/lazy_constants/Internship.java index a4f498ad1f1..4ed046e4ebd 100644 --- a/thrift/compiler/test/fixtures/lazy_constants/out/java/gen-java/test/fixtures/lazy_constants/Internship.java +++ b/thrift/compiler/test/fixtures/lazy_constants/out/java/gen-java/test/fixtures/lazy_constants/Internship.java @@ -40,6 +40,14 @@ protected Internship() { this.employer = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Internship other) { + return new Builder(other); + } + public static class Builder { private int weeks = 0; private String title = null; @@ -87,8 +95,8 @@ public Internship build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Internship"); private final int weeks; diff --git a/thrift/compiler/test/fixtures/lazy_constants/out/java/gen-java/test/fixtures/lazy_constants/Range.java b/thrift/compiler/test/fixtures/lazy_constants/out/java/gen-java/test/fixtures/lazy_constants/Range.java index 9e6c94cb01a..521b7c5b28b 100644 --- a/thrift/compiler/test/fixtures/lazy_constants/out/java/gen-java/test/fixtures/lazy_constants/Range.java +++ b/thrift/compiler/test/fixtures/lazy_constants/out/java/gen-java/test/fixtures/lazy_constants/Range.java @@ -37,6 +37,14 @@ protected Range() { this.max = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Range other) { + return new Builder(other); + } + public static class Builder { private int min = 0; private int max = 0; @@ -73,8 +81,8 @@ public Range build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Range"); private final int min; diff --git a/thrift/compiler/test/fixtures/namespace_from_package/out/java/gen-java/dev/test/namespace_from_package/module/Foo.java b/thrift/compiler/test/fixtures/namespace_from_package/out/java/gen-java/dev/test/namespace_from_package/module/Foo.java index 1f16c5788ad..67eec9936ce 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package/out/java/gen-java/dev/test/namespace_from_package/module/Foo.java +++ b/thrift/compiler/test/fixtures/namespace_from_package/out/java/gen-java/dev/test/namespace_from_package/module/Foo.java @@ -34,6 +34,14 @@ protected Foo() { this.myInt = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Foo other) { + return new Builder(other); + } + public static class Builder { private long myInt = 0L; @@ -59,8 +67,8 @@ public Foo build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Foo"); private final long myInt; diff --git a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/java/gen-java/dev/test/namespace_from_package_without_module_name/Foo.java b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/java/gen-java/dev/test/namespace_from_package_without_module_name/Foo.java index e931555f110..ed0e272ef86 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/java/gen-java/dev/test/namespace_from_package_without_module_name/Foo.java +++ b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/java/gen-java/dev/test/namespace_from_package_without_module_name/Foo.java @@ -34,6 +34,14 @@ protected Foo() { this.myInt = 0L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Foo other) { + return new Builder(other); + } + public static class Builder { private long myInt = 0L; @@ -59,8 +67,8 @@ public Foo build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Foo"); private final long myInt; diff --git a/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Color.java b/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Color.java index c34b4fd113f..74044fbff5b 100644 --- a/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Color.java +++ b/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Color.java @@ -43,6 +43,14 @@ protected Color() { this.alpha = 0.; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Color other) { + return new Builder(other); + } + public static class Builder { private double red = 0.; private double green = 0.; @@ -101,8 +109,8 @@ public Color build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Color"); private final double red; diff --git a/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Person.java b/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Person.java index 4b0057e78f0..69a4d31d212 100644 --- a/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Person.java +++ b/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Person.java @@ -61,6 +61,14 @@ protected Person() { this.vehicles = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Person other) { + return new Builder(other); + } + public static class Builder { private long id = 0L; private String name = null; @@ -185,8 +193,8 @@ public Person build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Person"); private final long id; diff --git a/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Vehicle.java b/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Vehicle.java index f68c829dfc3..16c463a2163 100644 --- a/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Vehicle.java +++ b/thrift/compiler/test/fixtures/optionals/out/java/gen-java/test/fixtures/optionals/Vehicle.java @@ -46,6 +46,14 @@ protected Vehicle() { this.hasAC = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Vehicle other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.optionals.Color color = null; private String licensePlate = null; @@ -115,8 +123,8 @@ public Vehicle build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Vehicle"); private final test.fixtures.optionals.Color color; diff --git a/thrift/compiler/test/fixtures/qualified/out/java_module0/gen-java/test/fixtures/module0/Struct.java b/thrift/compiler/test/fixtures/qualified/out/java_module0/gen-java/test/fixtures/module0/Struct.java index 77865137abf..1d9c88bf204 100644 --- a/thrift/compiler/test/fixtures/qualified/out/java_module0/gen-java/test/fixtures/module0/Struct.java +++ b/thrift/compiler/test/fixtures/qualified/out/java_module0/gen-java/test/fixtures/module0/Struct.java @@ -37,6 +37,14 @@ protected Struct() { this.second = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Struct other) { + return new Builder(other); + } + public static class Builder { private int first = 0; private String second = null; @@ -73,8 +81,8 @@ public Struct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Struct"); private final int first; diff --git a/thrift/compiler/test/fixtures/qualified/out/java_module1/gen-java/test/fixtures/module1/Struct.java b/thrift/compiler/test/fixtures/qualified/out/java_module1/gen-java/test/fixtures/module1/Struct.java index 1fbffafdbdc..4c4b1745d1e 100644 --- a/thrift/compiler/test/fixtures/qualified/out/java_module1/gen-java/test/fixtures/module1/Struct.java +++ b/thrift/compiler/test/fixtures/qualified/out/java_module1/gen-java/test/fixtures/module1/Struct.java @@ -37,6 +37,14 @@ protected Struct() { this.second = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Struct other) { + return new Builder(other); + } + public static class Builder { private int first = 0; private String second = null; @@ -73,8 +81,8 @@ public Struct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Struct"); private final int first; diff --git a/thrift/compiler/test/fixtures/qualified/out/java_module2/gen-java/test/fixtures/module2/BigStruct.java b/thrift/compiler/test/fixtures/qualified/out/java_module2/gen-java/test/fixtures/module2/BigStruct.java index a75d1943c17..37fe52f552a 100644 --- a/thrift/compiler/test/fixtures/qualified/out/java_module2/gen-java/test/fixtures/module2/BigStruct.java +++ b/thrift/compiler/test/fixtures/qualified/out/java_module2/gen-java/test/fixtures/module2/BigStruct.java @@ -37,6 +37,14 @@ protected BigStruct() { this.id = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(BigStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.module2.Struct s = null; private int id = 0; @@ -73,8 +81,8 @@ public BigStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("BigStruct"); private final test.fixtures.module2.Struct s; diff --git a/thrift/compiler/test/fixtures/qualified/out/java_module2/gen-java/test/fixtures/module2/Struct.java b/thrift/compiler/test/fixtures/qualified/out/java_module2/gen-java/test/fixtures/module2/Struct.java index ed7e0dd23ad..486a334e75d 100644 --- a/thrift/compiler/test/fixtures/qualified/out/java_module2/gen-java/test/fixtures/module2/Struct.java +++ b/thrift/compiler/test/fixtures/qualified/out/java_module2/gen-java/test/fixtures/module2/Struct.java @@ -37,6 +37,14 @@ protected Struct() { this.second = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Struct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.module0.Struct first = null; private test.fixtures.module1.Struct second = null; @@ -73,8 +81,8 @@ public Struct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Struct"); private final test.fixtures.module0.Struct first; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/AdaptedStructWithInternBox.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/AdaptedStructWithInternBox.java index 8cee994a728..806ec86e15f 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/AdaptedStructWithInternBox.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/AdaptedStructWithInternBox.java @@ -37,6 +37,14 @@ protected AdaptedStructWithInternBox() { this.field2 = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(AdaptedStructWithInternBox other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.Empty field1 = null; private test.fixtures.refs.MyField field2 = null; @@ -73,8 +81,8 @@ public AdaptedStructWithInternBox build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("AdaptedStructWithInternBox"); private final test.fixtures.refs.Empty field1; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/AdaptedStructWithTerseInternBox.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/AdaptedStructWithTerseInternBox.java index 1c00b218419..abf88689c25 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/AdaptedStructWithTerseInternBox.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/AdaptedStructWithTerseInternBox.java @@ -37,6 +37,14 @@ protected AdaptedStructWithTerseInternBox() { this.field2 = test.fixtures.refs.MyField.defaultInstance(); } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(AdaptedStructWithTerseInternBox other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.Empty field1 = test.fixtures.refs.Empty.defaultInstance(); private test.fixtures.refs.MyField field2 = test.fixtures.refs.MyField.defaultInstance(); @@ -73,8 +81,8 @@ public AdaptedStructWithTerseInternBox build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("AdaptedStructWithTerseInternBox"); private final test.fixtures.refs.Empty field1; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/Empty.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/Empty.java index 139ec115ea1..e93eddb1c04 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/Empty.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/Empty.java @@ -29,6 +29,14 @@ public Empty( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Empty other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public Empty build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Empty"); static { diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/MyField.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/MyField.java index af44fd888da..9cc06482787 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/MyField.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/MyField.java @@ -58,6 +58,14 @@ protected MyField() { this.reqStrValue = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyField other) { + return new Builder(other); + } + public static class Builder { private Long optValue = null; private long value = 0L; @@ -171,8 +179,8 @@ public MyField build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyField"); private final Long optValue; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/MyStruct.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/MyStruct.java index 34255069e65..d3c2daaadf1 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/MyStruct.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/MyStruct.java @@ -40,6 +40,14 @@ protected MyStruct() { this.reqRef = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.MyField optRef = null; private test.fixtures.refs.MyField ref = null; @@ -87,8 +95,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); private final test.fixtures.refs.MyField optRef; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/RecursiveStruct.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/RecursiveStruct.java index b1b12d46cea..8c5d02ea015 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/RecursiveStruct.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/RecursiveStruct.java @@ -34,6 +34,14 @@ protected RecursiveStruct() { this.mes = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(RecursiveStruct other) { + return new Builder(other); + } + public static class Builder { private List mes = null; @@ -59,8 +67,8 @@ public RecursiveStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("RecursiveStruct"); private final List mes; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithBox.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithBox.java index a0c45c62c4d..e36b893b694 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithBox.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithBox.java @@ -40,6 +40,14 @@ protected StructWithBox() { this.c = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithBox other) { + return new Builder(other); + } + public static class Builder { private String a = null; private List b = null; @@ -87,8 +95,8 @@ public StructWithBox build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithBox"); private final String a; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithContainers.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithContainers.java index 95fd638fab5..1380b131a2b 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithContainers.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithContainers.java @@ -49,6 +49,14 @@ protected StructWithContainers() { this.listRefSharedConst = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithContainers other) { + return new Builder(other); + } + public static class Builder { private List listRef = null; private Set setRef = null; @@ -129,8 +137,8 @@ public StructWithContainers build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithContainers"); private final List listRef; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithInternBox.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithInternBox.java index dcadfcd8b0f..b009f789527 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithInternBox.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithInternBox.java @@ -37,6 +37,14 @@ protected StructWithInternBox() { this.field2 = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithInternBox other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.Empty field1 = null; private test.fixtures.refs.MyField field2 = null; @@ -73,8 +81,8 @@ public StructWithInternBox build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithInternBox"); private final test.fixtures.refs.Empty field1; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRef.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRef.java index 918dc7f8ca0..c8c67b744ec 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRef.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRef.java @@ -40,6 +40,14 @@ protected StructWithRef() { this.reqField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithRef other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.Empty defField = null; private test.fixtures.refs.Empty optField = null; @@ -87,8 +95,8 @@ public StructWithRef build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithRef"); private final test.fixtures.refs.Empty defField; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefAndAnnotCppNoexceptMoveCtor.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefAndAnnotCppNoexceptMoveCtor.java index 90d5c7a8f21..e5cc1c639bf 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefAndAnnotCppNoexceptMoveCtor.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefAndAnnotCppNoexceptMoveCtor.java @@ -34,6 +34,14 @@ protected StructWithRefAndAnnotCppNoexceptMoveCtor() { this.defField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithRefAndAnnotCppNoexceptMoveCtor other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.Empty defField = null; @@ -59,8 +67,8 @@ public StructWithRefAndAnnotCppNoexceptMoveCtor build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithRefAndAnnotCppNoexceptMoveCtor"); private final test.fixtures.refs.Empty defField; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeShared.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeShared.java index 36afce2f2fc..854f1d0a27f 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeShared.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeShared.java @@ -40,6 +40,14 @@ protected StructWithRefTypeShared() { this.reqField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithRefTypeShared other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.Empty defField = null; private test.fixtures.refs.Empty optField = null; @@ -87,8 +95,8 @@ public StructWithRefTypeShared build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithRefTypeShared"); private final test.fixtures.refs.Empty defField; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeSharedConst.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeSharedConst.java index d2575456aa5..54476b9a6ff 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeSharedConst.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeSharedConst.java @@ -40,6 +40,14 @@ protected StructWithRefTypeSharedConst() { this.reqField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithRefTypeSharedConst other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.Empty defField = null; private test.fixtures.refs.Empty optField = null; @@ -87,8 +95,8 @@ public StructWithRefTypeSharedConst build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithRefTypeSharedConst"); private final test.fixtures.refs.Empty defField; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeUnique.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeUnique.java index e723ae53175..d4b18e8f7fc 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeUnique.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithRefTypeUnique.java @@ -40,6 +40,14 @@ protected StructWithRefTypeUnique() { this.reqField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithRefTypeUnique other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.Empty defField = null; private test.fixtures.refs.Empty optField = null; @@ -87,8 +95,8 @@ public StructWithRefTypeUnique build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithRefTypeUnique"); private final test.fixtures.refs.Empty defField; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithSharedConst.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithSharedConst.java index d1c85af3159..0077fcc2973 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithSharedConst.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithSharedConst.java @@ -40,6 +40,14 @@ protected StructWithSharedConst() { this.reqSharedConst = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithSharedConst other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.MyField optSharedConst = null; private test.fixtures.refs.MyField sharedConst = null; @@ -87,8 +95,8 @@ public StructWithSharedConst build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithSharedConst"); private final test.fixtures.refs.MyField optSharedConst; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithString.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithString.java index ca4e437c33d..9099a0d107c 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithString.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithString.java @@ -46,6 +46,14 @@ protected StructWithString() { this.sharedStringRef = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithString other) { + return new Builder(other); + } + public static class Builder { private String defUniqueStringRef = "..."; private String defSharedStringRef = "..."; @@ -115,8 +123,8 @@ public StructWithString build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithString"); private final String defUniqueStringRef; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithTerseInternBox.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithTerseInternBox.java index 198de9dd5a6..dee59d35f00 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithTerseInternBox.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithTerseInternBox.java @@ -37,6 +37,14 @@ protected StructWithTerseInternBox() { this.field2 = test.fixtures.refs.MyField.defaultInstance(); } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithTerseInternBox other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.Empty field1 = test.fixtures.refs.Empty.defaultInstance(); private test.fixtures.refs.MyField field2 = test.fixtures.refs.MyField.defaultInstance(); @@ -73,8 +81,8 @@ public StructWithTerseInternBox build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithTerseInternBox"); private final test.fixtures.refs.Empty field1; diff --git a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithUnion.java b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithUnion.java index a1df4444970..f1c779a6a96 100644 --- a/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithUnion.java +++ b/thrift/compiler/test/fixtures/refs/out/java/gen-java/test/fixtures/refs/StructWithUnion.java @@ -40,6 +40,14 @@ protected StructWithUnion() { this.f = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructWithUnion other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.refs.MyUnion u = null; private double aDouble = 0.; @@ -87,8 +95,8 @@ public StructWithUnion build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructWithUnion"); private final test.fixtures.refs.MyUnion u; diff --git a/thrift/compiler/test/fixtures/req-opt/out/java/gen-java/test/fixtures/req_opt/Foo.java b/thrift/compiler/test/fixtures/req-opt/out/java/gen-java/test/fixtures/req_opt/Foo.java index c018c7dc79d..70dc86e4833 100644 --- a/thrift/compiler/test/fixtures/req-opt/out/java/gen-java/test/fixtures/req_opt/Foo.java +++ b/thrift/compiler/test/fixtures/req-opt/out/java/gen-java/test/fixtures/req_opt/Foo.java @@ -43,6 +43,14 @@ protected Foo() { this.myNumbers = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Foo other) { + return new Builder(other); + } + public static class Builder { private int myInteger = 0; private String myString = null; @@ -101,8 +109,8 @@ public Foo build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Foo"); private final int myInteger; diff --git a/thrift/compiler/test/fixtures/serialization_field_order/out/java/gen-java/test/fixtures/adapter/Foo.java b/thrift/compiler/test/fixtures/serialization_field_order/out/java/gen-java/test/fixtures/adapter/Foo.java index 66af9547e32..4ba0c241e6e 100644 --- a/thrift/compiler/test/fixtures/serialization_field_order/out/java/gen-java/test/fixtures/adapter/Foo.java +++ b/thrift/compiler/test/fixtures/serialization_field_order/out/java/gen-java/test/fixtures/adapter/Foo.java @@ -40,6 +40,14 @@ protected Foo() { this.field3 = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Foo other) { + return new Builder(other); + } + public static class Builder { private int field1 = 0; private int field2 = 0; @@ -87,8 +95,8 @@ public Foo build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Foo"); private final int field1; diff --git a/thrift/compiler/test/fixtures/serialization_field_order/out/java/gen-java/test/fixtures/adapter/Foo2.java b/thrift/compiler/test/fixtures/serialization_field_order/out/java/gen-java/test/fixtures/adapter/Foo2.java index 9072a8119fe..db12c1bd4ed 100644 --- a/thrift/compiler/test/fixtures/serialization_field_order/out/java/gen-java/test/fixtures/adapter/Foo2.java +++ b/thrift/compiler/test/fixtures/serialization_field_order/out/java/gen-java/test/fixtures/adapter/Foo2.java @@ -40,6 +40,14 @@ protected Foo2() { this.field3 = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Foo2 other) { + return new Builder(other); + } + public static class Builder { private int field1 = 0; private int field2 = 0; @@ -87,8 +95,8 @@ public Foo2 build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("Foo2"); private final int field1; diff --git a/thrift/compiler/test/fixtures/shapes/out/java/gen-java/test/fixtures/shapes/A.java b/thrift/compiler/test/fixtures/shapes/out/java/gen-java/test/fixtures/shapes/A.java index 29a86729b00..154c3e1fa51 100644 --- a/thrift/compiler/test/fixtures/shapes/out/java/gen-java/test/fixtures/shapes/A.java +++ b/thrift/compiler/test/fixtures/shapes/out/java/gen-java/test/fixtures/shapes/A.java @@ -34,6 +34,14 @@ protected A() { this.a = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(A other) { + return new Builder(other); + } + public static class Builder { private String a = null; @@ -59,8 +67,8 @@ public A build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("A"); private final String a; diff --git a/thrift/compiler/test/fixtures/shapes/out/java/gen-java/test/fixtures/shapes/B.java b/thrift/compiler/test/fixtures/shapes/out/java/gen-java/test/fixtures/shapes/B.java index 2a19c0596e8..e482df122d6 100644 --- a/thrift/compiler/test/fixtures/shapes/out/java/gen-java/test/fixtures/shapes/B.java +++ b/thrift/compiler/test/fixtures/shapes/out/java/gen-java/test/fixtures/shapes/B.java @@ -160,6 +160,14 @@ protected B() { .build(); } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(B other) { + return new Builder(other); + } + public static class Builder { private test.fixtures.shapes.A justAnA = null; private Set setOfI32 = null; @@ -591,8 +599,8 @@ public B build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("B"); private final test.fixtures.shapes.A justAnA; diff --git a/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/CompatibleWithKeywordSink.java b/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/CompatibleWithKeywordSink.java index 182f18ec75f..75ea64ed51d 100644 --- a/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/CompatibleWithKeywordSink.java +++ b/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/CompatibleWithKeywordSink.java @@ -34,6 +34,14 @@ protected CompatibleWithKeywordSink() { this.sink = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(CompatibleWithKeywordSink other) { + return new Builder(other); + } + public static class Builder { private String sink = null; @@ -59,8 +67,8 @@ public CompatibleWithKeywordSink build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("CompatibleWithKeywordSink"); private final String sink; diff --git a/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/FinalResponse.java b/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/FinalResponse.java index 9b9ac2d347e..27038173993 100644 --- a/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/FinalResponse.java +++ b/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/FinalResponse.java @@ -34,6 +34,14 @@ protected FinalResponse() { this.content = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(FinalResponse other) { + return new Builder(other); + } + public static class Builder { private String content = null; @@ -59,8 +67,8 @@ public FinalResponse build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("FinalResponse"); private final String content; diff --git a/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/InitialResponse.java b/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/InitialResponse.java index fe7a8f9410f..a68fa03f78b 100644 --- a/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/InitialResponse.java +++ b/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/InitialResponse.java @@ -34,6 +34,14 @@ protected InitialResponse() { this.content = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(InitialResponse other) { + return new Builder(other); + } + public static class Builder { private String content = null; @@ -59,8 +67,8 @@ public InitialResponse build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("InitialResponse"); private final String content; diff --git a/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/SinkPayload.java b/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/SinkPayload.java index cc07219438e..e8bfc3a0041 100644 --- a/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/SinkPayload.java +++ b/thrift/compiler/test/fixtures/sink/out/java/gen-java/test/fixtures/sink/SinkPayload.java @@ -34,6 +34,14 @@ protected SinkPayload() { this.content = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(SinkPayload other) { + return new Builder(other); + } + public static class Builder { private String content = null; @@ -59,8 +67,8 @@ public SinkPayload build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("SinkPayload"); private final String content; diff --git a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/AdaptedFields.java b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/AdaptedFields.java index fa0c82c3901..d4687272a94 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/AdaptedFields.java +++ b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/AdaptedFields.java @@ -40,6 +40,14 @@ protected AdaptedFields() { this.field3 = 0; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(AdaptedFields other) { + return new Builder(other); + } + public static class Builder { private int field1 = 0; private int field2 = 0; @@ -87,8 +95,8 @@ public AdaptedFields build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("AdaptedFields"); private final int field1; diff --git a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/FieldLevelTerseStruct.java b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/FieldLevelTerseStruct.java index 18d6b679ccd..8ee6863f306 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/FieldLevelTerseStruct.java +++ b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/FieldLevelTerseStruct.java @@ -121,6 +121,14 @@ protected FieldLevelTerseStruct() { this.unionField = null; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(FieldLevelTerseStruct other) { + return new Builder(other); + } + public static class Builder { private boolean terseBoolField = false; private byte terseByteField = (byte)0; @@ -465,8 +473,8 @@ public FieldLevelTerseStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("FieldLevelTerseStruct"); private final boolean terseBoolField; diff --git a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/MyStruct.java b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/MyStruct.java index bc243d08639..47d6d4c15b3 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/MyStruct.java +++ b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/MyStruct.java @@ -29,6 +29,14 @@ public MyStruct( + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStruct other) { + return new Builder(other); + } + public static class Builder { public Builder() { } @@ -43,8 +51,8 @@ public MyStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStruct"); static { diff --git a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/MyStructWithCustomDefault.java b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/MyStructWithCustomDefault.java index 72369a6ff5b..26d90545613 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/MyStructWithCustomDefault.java +++ b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/MyStructWithCustomDefault.java @@ -34,6 +34,14 @@ protected MyStructWithCustomDefault() { this.field1 = 1L; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(MyStructWithCustomDefault other) { + return new Builder(other); + } + public static class Builder { private long field1 = 1L; @@ -59,8 +67,8 @@ public MyStructWithCustomDefault build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("MyStructWithCustomDefault"); private final long field1; diff --git a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/StructLevelTerseStruct.java b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/StructLevelTerseStruct.java index 7ac8e77fa2c..9848a8db743 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/StructLevelTerseStruct.java +++ b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/StructLevelTerseStruct.java @@ -76,6 +76,14 @@ protected StructLevelTerseStruct() { this.unionField = com.facebook.thrift.test.terse_write.MyUnion.defaultInstance(); } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(StructLevelTerseStruct other) { + return new Builder(other); + } + public static class Builder { private boolean boolField = false; private byte byteField = (byte)0; @@ -255,8 +263,8 @@ public StructLevelTerseStruct build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("StructLevelTerseStruct"); private final boolean boolField; diff --git a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/TerseStructWithCustomDefault.java b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/TerseStructWithCustomDefault.java index d1ac3cf484d..856be1cb359 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/TerseStructWithCustomDefault.java +++ b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/TerseStructWithCustomDefault.java @@ -79,6 +79,14 @@ protected TerseStructWithCustomDefault() { this.structField = com.facebook.thrift.test.terse_write.MyStructWithCustomDefault.defaultInstance(); } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(TerseStructWithCustomDefault other) { + return new Builder(other); + } + public static class Builder { private boolean boolField = true; private byte byteField = (byte)1; @@ -253,8 +261,8 @@ public TerseStructWithCustomDefault build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("TerseStructWithCustomDefault"); private final boolean boolField; diff --git a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/WrappedFields.java b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/WrappedFields.java index 06688bd43b2..01baa5fc58f 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/WrappedFields.java +++ b/thrift/compiler/test/fixtures/terse_write/out/java/gen-java/com/facebook/thrift/test/terse_write/WrappedFields.java @@ -34,6 +34,14 @@ protected WrappedFields() { this.field1 = 7; } + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(WrappedFields other) { + return new Builder(other); + } + public static class Builder { private int field1 = 7; @@ -59,8 +67,8 @@ public WrappedFields build() { } } - public static final Map NAMES_TO_IDS = new HashMap(); - public static final Map THRIFT_NAMES_TO_IDS = new HashMap(); + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); public static final Map FIELD_METADATA = new HashMap<>(); private static final TStruct STRUCT_DESC = new TStruct("WrappedFields"); private final int field1;