Skip to content

Commit dd51fe4

Browse files
Dan Dengfacebook-github-bot
authored andcommitted
Add new hack annotations for thrift compiler
Summary: As discussed in thrift language and tooling meeting, let's use annotations instead of compiler options for union migration. These annotations currently don't do anything. I just want to get the new annotations synced to other repos so we can begin codemods. Reviewed By: rmakheja Differential Revision: D79417779 fbshipit-source-id: 30cc993402890c2e8b15c96641cb47459b89ac65
1 parent c8348b4 commit dd51fe4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

thrift/annotation/hack.thrift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,21 @@ struct ModuleInternal {}
210210
@scope.Service
211211
@scope.Function
212212
struct GenerateClientMethodsWithHeaders {}
213+
214+
/**
215+
* Generated Hack types are being changed to `final` by default.
216+
*
217+
* For existing thrift types that are inherited from and cannot be easily migrated,
218+
* use this annotation to make the generated class non-final.
219+
*/
220+
@scope.Structured
221+
struct MigrationBlockingAllowInheritance {}
222+
223+
/**
224+
* Hack Unions without the `protected` compiler option may rely on `fb_json_serialize` for JSON serialization.
225+
* Adding this annotation will implement the JSONSerializable Hack interface allowing `fb_json_serialize` to continue being used.
226+
*
227+
* Note: This should only be used for migration purposes. Use `JSONThriftSerializer` instead.
228+
*/
229+
@scope.Union
230+
struct MigrationBlockingLegacyJSONSerialization {}

0 commit comments

Comments
 (0)