facebookarchive / swift

An annotation-based Java library for creating Thrift serializable types and services.
Apache License 2.0
900 stars 297 forks source link

Prune the subtree from search for @ThriftService annotations when one is... #75

Closed andrewcox closed 11 years ago

andrewcox commented 11 years ago

... found

If you have class A implements interface B, which extends from interface C, and class A is NOT annotated with @ThriftService but interface B and C are each annotated with @ThriftService, this should be fine and not produce a conflict, because interface B's @ThriftService should hide the one from interface C.

dain commented 11 years ago

This needs a test.

I'm not sure this is a good assumption. If one interface extends another interface, it should add methods, not remove all existing methods and replace it with it's own methods. The API design here follows the patterns of other common Java annotation based libraries.

andrewcox commented 11 years ago

Added tests.

The comments on the unit tests should demonstrate what I'm aiming for here. Without these changes, testInheritSingleDerivedInterface() would fail.

l3fang commented 11 years ago

@dain, the use case here is a bunch of thrift interfaces extending from a common thrift interface. A concrete example would be Scribe extends FacebookService (fb303), and both Scribe and FacebookService has the @ThriftService annotation. Of course other interface could extend FacebookService as well and at the same time has a @ThriftService annotation associated with it.