Skip to content

Commit e765577

Browse files
iahsmeta-codesync[bot]
authored andcommitted
Remove move-only adapter support
Summary: `cpp.Adapter.moveOnly` no longer affects C++ code generation, and every production use was attached to a copyable adapted type. Remove the annotation field, stale annotations, move-only fixtures, and regenerate affected fixture outputs. Field ID 5 remains unreserved so existing serialized annotation payloads continue to decode without unknown-field enforcement. Keep the existing arithmetic `serializedSizeFixed` adapter-size support unchanged. The Configerator-owned Metarmor source change is D116658723 and must land first. Reviewed By: hchokshi Differential Revision: D116659189 fbshipit-source-id: 93fe5691c8c85f9ab30f1e68d840cac3d15e6433
1 parent 5091afc commit e765577

155 files changed

Lines changed: 1231 additions & 11105 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

third-party/thrift/src/thrift/annotation/cpp.thrift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ struct Adapter {
176176
*/
177177
3: string underlyingName;
178178
4: string extraNamespace;
179-
180-
/** Must set to true when adapted type is not copyable. */
181-
5: bool moveOnly;
182179
}
183180

184181
/**

third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/android/gen-android/com/facebook/thrift/annotation/cpp_deprecated/Adapter.java

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public class Adapter implements TBase, java.io.Serializable, Cloneable {
4747
private static final TField ADAPTED_TYPE_FIELD_DESC = new TField("adaptedType", TType.STRING, (short)2);
4848
private static final TField UNDERLYING_NAME_FIELD_DESC = new TField("underlyingName", TType.STRING, (short)3);
4949
private static final TField EXTRA_NAMESPACE_FIELD_DESC = new TField("extraNamespace", TType.STRING, (short)4);
50-
private static final TField MOVE_ONLY_FIELD_DESC = new TField("moveOnly", TType.BOOL, (short)5);
5150

5251
/**
5352
* The name of a C++ adapter type used to convert between Thrift and native
@@ -92,27 +91,20 @@ public class Adapter implements TBase, java.io.Serializable, Cloneable {
9291
*/
9392
public final String underlyingName;
9493
public final String extraNamespace;
95-
/**
96-
* Must set to true when adapted type is not copyable.
97-
*/
98-
public final Boolean moveOnly;
9994
public static final int NAME = 1;
10095
public static final int ADAPTEDTYPE = 2;
10196
public static final int UNDERLYINGNAME = 3;
10297
public static final int EXTRANAMESPACE = 4;
103-
public static final int MOVEONLY = 5;
10498

10599
public Adapter(
106100
String name,
107101
String adaptedType,
108102
String underlyingName,
109-
String extraNamespace,
110-
Boolean moveOnly) {
103+
String extraNamespace) {
111104
this.name = name;
112105
this.adaptedType = adaptedType;
113106
this.underlyingName = underlyingName;
114107
this.extraNamespace = extraNamespace;
115-
this.moveOnly = moveOnly;
116108
}
117109

118110
/**
@@ -139,11 +131,6 @@ public Adapter(Adapter other) {
139131
} else {
140132
this.extraNamespace = null;
141133
}
142-
if (other.isSetMoveOnly()) {
143-
this.moveOnly = TBaseHelper.deepCopy(other.moveOnly);
144-
} else {
145-
this.moveOnly = null;
146-
}
147134
}
148135

149136
public Adapter deepCopy() {
@@ -225,18 +212,6 @@ public boolean isSetExtraNamespace() {
225212
return this.extraNamespace != null;
226213
}
227214

228-
/**
229-
* Must set to true when adapted type is not copyable.
230-
*/
231-
public Boolean isMoveOnly() {
232-
return this.moveOnly;
233-
}
234-
235-
// Returns true if field moveOnly is set (has been assigned a value) and false otherwise
236-
public boolean isSetMoveOnly() {
237-
return this.moveOnly != null;
238-
}
239-
240215
@Override
241216
public boolean equals(Object _that) {
242217
if (_that == null)
@@ -255,14 +230,12 @@ public boolean equals(Object _that) {
255230

256231
if (!TBaseHelper.equalsNobinary(this.isSetExtraNamespace(), that.isSetExtraNamespace(), this.extraNamespace, that.extraNamespace)) { return false; }
257232

258-
if (!TBaseHelper.equalsNobinary(this.isSetMoveOnly(), that.isSetMoveOnly(), this.moveOnly, that.moveOnly)) { return false; }
259-
260233
return true;
261234
}
262235

263236
@Override
264237
public int hashCode() {
265-
return Arrays.deepHashCode(new Object[] {name, adaptedType, underlyingName, extraNamespace, moveOnly});
238+
return Arrays.deepHashCode(new Object[] {name, adaptedType, underlyingName, extraNamespace});
266239
}
267240

268241
// This is required to satisfy the TBase interface, but can't be implemented on immutable struture.
@@ -275,7 +248,6 @@ public static Adapter deserialize(TProtocol iprot) throws TException {
275248
String tmp_adaptedType = null;
276249
String tmp_underlyingName = null;
277250
String tmp_extraNamespace = null;
278-
Boolean tmp_moveOnly = null;
279251
TField __field;
280252
iprot.readStructBegin();
281253
while (true)
@@ -314,13 +286,6 @@ public static Adapter deserialize(TProtocol iprot) throws TException {
314286
TProtocolUtil.skip(iprot, __field.type);
315287
}
316288
break;
317-
case MOVEONLY:
318-
if (__field.type == TType.BOOL) {
319-
tmp_moveOnly = iprot.readBool();
320-
} else {
321-
TProtocolUtil.skip(iprot, __field.type);
322-
}
323-
break;
324289
default:
325290
TProtocolUtil.skip(iprot, __field.type);
326291
break;
@@ -335,7 +300,6 @@ public static Adapter deserialize(TProtocol iprot) throws TException {
335300
,tmp_adaptedType
336301
,tmp_underlyingName
337302
,tmp_extraNamespace
338-
,tmp_moveOnly
339303
);
340304
_that.validate();
341305
return _that;
@@ -365,11 +329,6 @@ public void write(TProtocol oprot) throws TException {
365329
oprot.writeString(this.extraNamespace);
366330
oprot.writeFieldEnd();
367331
}
368-
if (this.moveOnly != null) {
369-
oprot.writeFieldBegin(MOVE_ONLY_FIELD_DESC);
370-
oprot.writeBool(this.moveOnly);
371-
oprot.writeFieldEnd();
372-
}
373332
oprot.writeFieldStop();
374333
oprot.writeStructEnd();
375334
}

third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/android/gen-android/test/fixtures/adapter/AdaptTemplatedTestStruct.java

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -611,15 +611,15 @@ public static AdaptTemplatedTestStruct deserialize(TProtocol iprot) throws TExce
611611
case ADAPTEDLIST:
612612
if (__field.type == TType.LIST) {
613613
{
614-
TList _list88 = iprot.readListBegin();
615-
tmp_adaptedList = new ArrayList<Long>(Math.max(0, _list88.size));
616-
for (int _i89 = 0;
617-
(_list88.size < 0) ? iprot.peekList() : (_i89 < _list88.size);
618-
++_i89)
614+
TList _list87 = iprot.readListBegin();
615+
tmp_adaptedList = new ArrayList<Long>(Math.max(0, _list87.size));
616+
for (int _i88 = 0;
617+
(_list87.size < 0) ? iprot.peekList() : (_i88 < _list87.size);
618+
++_i88)
619619
{
620-
Long _elem90;
621-
_elem90 = iprot.readI64();
622-
tmp_adaptedList.add(_elem90);
620+
Long _elem89;
621+
_elem89 = iprot.readI64();
622+
tmp_adaptedList.add(_elem89);
623623
}
624624
iprot.readListEnd();
625625
}
@@ -630,15 +630,15 @@ public static AdaptTemplatedTestStruct deserialize(TProtocol iprot) throws TExce
630630
case ADAPTEDSET:
631631
if (__field.type == TType.SET) {
632632
{
633-
TSet _set91 = iprot.readSetBegin();
634-
tmp_adaptedSet = new HashSet<Long>(Math.max(0, 2*_set91.size));
635-
for (int _i92 = 0;
636-
(_set91.size < 0) ? iprot.peekSet() : (_i92 < _set91.size);
637-
++_i92)
633+
TSet _set90 = iprot.readSetBegin();
634+
tmp_adaptedSet = new HashSet<Long>(Math.max(0, 2*_set90.size));
635+
for (int _i91 = 0;
636+
(_set90.size < 0) ? iprot.peekSet() : (_i91 < _set90.size);
637+
++_i91)
638638
{
639-
Long _elem93;
640-
_elem93 = iprot.readI64();
641-
tmp_adaptedSet.add(_elem93);
639+
Long _elem92;
640+
_elem92 = iprot.readI64();
641+
tmp_adaptedSet.add(_elem92);
642642
}
643643
iprot.readSetEnd();
644644
}
@@ -649,17 +649,17 @@ public static AdaptTemplatedTestStruct deserialize(TProtocol iprot) throws TExce
649649
case ADAPTEDMAP:
650650
if (__field.type == TType.MAP) {
651651
{
652-
TMap _map94 = iprot.readMapBegin();
653-
tmp_adaptedMap = new HashMap<Long,Long>(Math.max(0, 2*_map94.size));
654-
for (int _i95 = 0;
655-
(_map94.size < 0) ? iprot.peekMap() : (_i95 < _map94.size);
656-
++_i95)
652+
TMap _map93 = iprot.readMapBegin();
653+
tmp_adaptedMap = new HashMap<Long,Long>(Math.max(0, 2*_map93.size));
654+
for (int _i94 = 0;
655+
(_map93.size < 0) ? iprot.peekMap() : (_i94 < _map93.size);
656+
++_i94)
657657
{
658-
Long _key96;
659-
Long _val97;
660-
_key96 = iprot.readI64();
661-
_val97 = iprot.readI64();
662-
tmp_adaptedMap.put(_key96, _val97);
658+
Long _key95;
659+
Long _val96;
660+
_key95 = iprot.readI64();
661+
_val96 = iprot.readI64();
662+
tmp_adaptedMap.put(_key95, _val96);
663663
}
664664
iprot.readMapEnd();
665665
}
@@ -726,15 +726,15 @@ public static AdaptTemplatedTestStruct deserialize(TProtocol iprot) throws TExce
726726
case ADAPTEDLISTDEFAULT:
727727
if (__field.type == TType.LIST) {
728728
{
729-
TList _list98 = iprot.readListBegin();
730-
tmp_adaptedListDefault = new ArrayList<Long>(Math.max(0, _list98.size));
731-
for (int _i99 = 0;
732-
(_list98.size < 0) ? iprot.peekList() : (_i99 < _list98.size);
733-
++_i99)
729+
TList _list97 = iprot.readListBegin();
730+
tmp_adaptedListDefault = new ArrayList<Long>(Math.max(0, _list97.size));
731+
for (int _i98 = 0;
732+
(_list97.size < 0) ? iprot.peekList() : (_i98 < _list97.size);
733+
++_i98)
734734
{
735-
Long _elem100;
736-
_elem100 = iprot.readI64();
737-
tmp_adaptedListDefault.add(_elem100);
735+
Long _elem99;
736+
_elem99 = iprot.readI64();
737+
tmp_adaptedListDefault.add(_elem99);
738738
}
739739
iprot.readListEnd();
740740
}
@@ -745,15 +745,15 @@ public static AdaptTemplatedTestStruct deserialize(TProtocol iprot) throws TExce
745745
case ADAPTEDSETDEFAULT:
746746
if (__field.type == TType.SET) {
747747
{
748-
TSet _set101 = iprot.readSetBegin();
749-
tmp_adaptedSetDefault = new HashSet<Long>(Math.max(0, 2*_set101.size));
750-
for (int _i102 = 0;
751-
(_set101.size < 0) ? iprot.peekSet() : (_i102 < _set101.size);
752-
++_i102)
748+
TSet _set100 = iprot.readSetBegin();
749+
tmp_adaptedSetDefault = new HashSet<Long>(Math.max(0, 2*_set100.size));
750+
for (int _i101 = 0;
751+
(_set100.size < 0) ? iprot.peekSet() : (_i101 < _set100.size);
752+
++_i101)
753753
{
754-
Long _elem103;
755-
_elem103 = iprot.readI64();
756-
tmp_adaptedSetDefault.add(_elem103);
754+
Long _elem102;
755+
_elem102 = iprot.readI64();
756+
tmp_adaptedSetDefault.add(_elem102);
757757
}
758758
iprot.readSetEnd();
759759
}
@@ -764,17 +764,17 @@ public static AdaptTemplatedTestStruct deserialize(TProtocol iprot) throws TExce
764764
case ADAPTEDMAPDEFAULT:
765765
if (__field.type == TType.MAP) {
766766
{
767-
TMap _map104 = iprot.readMapBegin();
768-
tmp_adaptedMapDefault = new HashMap<Long,Long>(Math.max(0, 2*_map104.size));
769-
for (int _i105 = 0;
770-
(_map104.size < 0) ? iprot.peekMap() : (_i105 < _map104.size);
771-
++_i105)
767+
TMap _map103 = iprot.readMapBegin();
768+
tmp_adaptedMapDefault = new HashMap<Long,Long>(Math.max(0, 2*_map103.size));
769+
for (int _i104 = 0;
770+
(_map103.size < 0) ? iprot.peekMap() : (_i104 < _map103.size);
771+
++_i104)
772772
{
773-
Long _key106;
774-
Long _val107;
775-
_key106 = iprot.readI64();
776-
_val107 = iprot.readI64();
777-
tmp_adaptedMapDefault.put(_key106, _val107);
773+
Long _key105;
774+
Long _val106;
775+
_key105 = iprot.readI64();
776+
_val106 = iprot.readI64();
777+
tmp_adaptedMapDefault.put(_key105, _val106);
778778
}
779779
iprot.readMapEnd();
780780
}
@@ -869,8 +869,8 @@ public void write(TProtocol oprot) throws TException {
869869
oprot.writeFieldBegin(ADAPTED_LIST_FIELD_DESC);
870870
{
871871
oprot.writeListBegin(new TList(TType.I64, this.adaptedList.size()));
872-
for (Long _iter108 : this.adaptedList) {
873-
oprot.writeI64(_iter108);
872+
for (Long _iter107 : this.adaptedList) {
873+
oprot.writeI64(_iter107);
874874
}
875875
oprot.writeListEnd();
876876
}
@@ -880,8 +880,8 @@ public void write(TProtocol oprot) throws TException {
880880
oprot.writeFieldBegin(ADAPTED_SET_FIELD_DESC);
881881
{
882882
oprot.writeSetBegin(new TSet(TType.I64, this.adaptedSet.size()));
883-
for (Long _iter109 : this.adaptedSet) {
884-
oprot.writeI64(_iter109);
883+
for (Long _iter108 : this.adaptedSet) {
884+
oprot.writeI64(_iter108);
885885
}
886886
oprot.writeSetEnd();
887887
}
@@ -891,9 +891,9 @@ public void write(TProtocol oprot) throws TException {
891891
oprot.writeFieldBegin(ADAPTED_MAP_FIELD_DESC);
892892
{
893893
oprot.writeMapBegin(new TMap(TType.I64, TType.I64, this.adaptedMap.size()));
894-
for (Map.Entry<Long, Long> _iter110 : this.adaptedMap.entrySet()) {
895-
oprot.writeI64(_iter110.getKey());
896-
oprot.writeI64(_iter110.getValue());
894+
for (Map.Entry<Long, Long> _iter109 : this.adaptedMap.entrySet()) {
895+
oprot.writeI64(_iter109.getKey());
896+
oprot.writeI64(_iter109.getValue());
897897
}
898898
oprot.writeMapEnd();
899899
}
@@ -943,8 +943,8 @@ public void write(TProtocol oprot) throws TException {
943943
oprot.writeFieldBegin(ADAPTED_LIST_DEFAULT_FIELD_DESC);
944944
{
945945
oprot.writeListBegin(new TList(TType.I64, this.adaptedListDefault.size()));
946-
for (Long _iter111 : this.adaptedListDefault) {
947-
oprot.writeI64(_iter111);
946+
for (Long _iter110 : this.adaptedListDefault) {
947+
oprot.writeI64(_iter110);
948948
}
949949
oprot.writeListEnd();
950950
}
@@ -954,8 +954,8 @@ public void write(TProtocol oprot) throws TException {
954954
oprot.writeFieldBegin(ADAPTED_SET_DEFAULT_FIELD_DESC);
955955
{
956956
oprot.writeSetBegin(new TSet(TType.I64, this.adaptedSetDefault.size()));
957-
for (Long _iter112 : this.adaptedSetDefault) {
958-
oprot.writeI64(_iter112);
957+
for (Long _iter111 : this.adaptedSetDefault) {
958+
oprot.writeI64(_iter111);
959959
}
960960
oprot.writeSetEnd();
961961
}
@@ -965,9 +965,9 @@ public void write(TProtocol oprot) throws TException {
965965
oprot.writeFieldBegin(ADAPTED_MAP_DEFAULT_FIELD_DESC);
966966
{
967967
oprot.writeMapBegin(new TMap(TType.I64, TType.I64, this.adaptedMapDefault.size()));
968-
for (Map.Entry<Long, Long> _iter113 : this.adaptedMapDefault.entrySet()) {
969-
oprot.writeI64(_iter113.getKey());
970-
oprot.writeI64(_iter113.getValue());
968+
for (Map.Entry<Long, Long> _iter112 : this.adaptedMapDefault.entrySet()) {
969+
oprot.writeI64(_iter112.getKey());
970+
oprot.writeI64(_iter112.getValue());
971971
}
972972
oprot.writeMapEnd();
973973
}

0 commit comments

Comments
 (0)