Skip to content
This repository was archived by the owner on Oct 15, 2019. It is now read-only.

[codec] Fully support abstract struct types.#280

Closed
jsirois wants to merge 1 commit intofacebookarchive:masterfrom
jsirois:jsirois/issues/279
Closed

[codec] Fully support abstract struct types.#280
jsirois wants to merge 1 commit intofacebookarchive:masterfrom
jsirois:jsirois/issues/279

Conversation

@jsirois
Copy link

@jsirois jsirois commented Nov 24, 2015

This addresses: #279

Commit 243fa41 removed the 'structs must be final' check which paved
the way for builders to produce (hidden) implementations of abstract
structs. Although a pure abstract struct class can be used today, a
struct interface cannot due to remaining assumptions in the
ThriftCodecByteCodeGenerator that the struct type is a class.

This change fixes up the ThriftCodecByteCodeGenerator to handle
structs of interface type and adds tests to cover both the abstract
class and interface struct builder cases.

Test Plan: Unit tests included. Also, works in a spike for Apache Aurora
where swift is being explored as a dual REST/thrift interface generator:
https://issues.apache.org/jira/browse/AURORA-987

Reviewers: @andrewcox, @jesboat, @alandau

This addresses: facebookarchive#279

Commit 243fa41 removed the 'structs must be final' check which paved
the way for builders to produce (hidden) implementations of abstract
structs.  Although a pure abstract struct class can be used today, a
struct interface cannot due to remaining assumptions in the
`ThriftCodecByteCodeGenerator` that the struct type is a class.

This change fixes up the `ThriftCodecByteCodeGenerator` to handle
structs of interface type and adds tests to cover both the abstract
class and interface struct builder cases.

Test Plan: Unit tests included. Also, works in a spike for Apache Aurora
where swift is being explored as a dual REST/thrift interface generator:
https://issues.apache.org/jira/browse/AURORA-987

Reviewers: @andrewcox, @jesboat, @alandau
@bgould
Copy link
Contributor

bgould commented Nov 24, 2015

FYI - I have a working implementation of this in a PR as well that you may be interested in, in particular it has more comprehensive consistency checks, and I've been using it in production for a while.

#257

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants