From 6f9501098ec0714f620b0913ffdc6f824f8aca14 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Tue, 7 Jun 2016 16:52:19 -0700 Subject: [PATCH 1/2] fix for issue 5548. Deprecated old classes and created subclasses. --- src/compiler/objective_c_generator.cc | 4 ++-- src/objective-c/ProtoRPC/ProtoMethod.h | 9 +++++++++ src/objective-c/ProtoRPC/ProtoMethod.m | 4 ++++ src/objective-c/ProtoRPC/ProtoRPC.h | 11 ++++++++++- src/objective-c/ProtoRPC/ProtoRPC.m | 6 +++++- src/objective-c/ProtoRPC/ProtoService.h | 15 +++++++++++++-- src/objective-c/ProtoRPC/ProtoService.m | 4 ++++ 7 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 465491e385f..75665cd5c0d 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -94,7 +94,7 @@ void PrintSimpleSignature(Printer *printer, const MethodDescriptor *method, void PrintAdvancedSignature(Printer *printer, const MethodDescriptor *method, map< ::grpc::string, ::grpc::string> vars) { vars["method_name"] = "RPCTo" + vars["method_name"]; - vars["return_type"] = "ProtoRPC *"; + vars["return_type"] = "GRPCProtoRPC *"; PrintMethodSignature(printer, method, vars); } @@ -199,7 +199,7 @@ void PrintMethodImplementations(Printer *printer, " marshalling and parsing.\n"); printer.Print(vars, "@interface $service_class$ :" - " ProtoService<$service_class$>\n"); + " GRPCProtoService<$service_class$>\n"); printer.Print( "- (instancetype)initWithHost:(NSString *)host" " NS_DESIGNATED_INITIALIZER;\n"); diff --git a/src/objective-c/ProtoRPC/ProtoMethod.h b/src/objective-c/ProtoRPC/ProtoMethod.h index a0ed2cf98a5..bd1a848c19a 100644 --- a/src/objective-c/ProtoRPC/ProtoMethod.h +++ b/src/objective-c/ProtoRPC/ProtoMethod.h @@ -37,6 +37,7 @@ * A fully-qualified proto service method name. Full qualification is needed because a gRPC endpoint * can implement multiple services. */ +__attribute__((deprecated("Please use GRPCProtoMethod."))) @interface ProtoMethod : NSObject @property(nonatomic, readonly) NSString *package; @property(nonatomic, readonly) NSString *service; @@ -48,3 +49,11 @@ service:(NSString *)service method:(NSString *)method; @end + +/** + * This subclass is empty now. Eventually we'll remove ProtoService class + * to avoid potential naming conflict + */ +@interface GRPCProtoMethod : ProtoMethod + +@end diff --git a/src/objective-c/ProtoRPC/ProtoMethod.m b/src/objective-c/ProtoRPC/ProtoMethod.m index 4b7ed63123c..e9978f38afe 100644 --- a/src/objective-c/ProtoRPC/ProtoMethod.m +++ b/src/objective-c/ProtoRPC/ProtoMethod.m @@ -53,3 +53,7 @@ } } @end + +@implementation GRPCProtoMethod + +@end diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index bd926b73287..55fefb0aa88 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -36,13 +36,22 @@ #import "ProtoMethod.h" +__attribute__((deprecated("Please use GRPCProtoRPC."))) @interface ProtoRPC : GRPCCall - (instancetype)initWithHost:(NSString *)host - method:(ProtoMethod *)method + method:(GRPCProtoMethod *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable NS_DESIGNATED_INITIALIZER; - (void)start; @end + +/** + * This subclass is empty now. Eventually we'll remove ProtoService class + * to avoid potential naming conflict + */ +@interface GRPCProtoRPC : ProtoRPC + +@end diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index 9bf66f347ac..27c8b0eff7e 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -70,7 +70,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing // Designated initializer - (instancetype)initWithHost:(NSString *)host - method:(ProtoMethod *)method + method:(GRPCProtoMethod *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable { @@ -117,3 +117,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing _responseWriteable = nil; } @end + +@implementation GRPCProtoRPC + +@end diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index 2e8cb33696b..edec8a4770f 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -33,17 +33,28 @@ #import -@class ProtoRPC; +@class GRPCProtoRPC; @protocol GRXWriteable; @class GRXWriter; + +__attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService : NSObject - (instancetype)initWithHost:(NSString *)host packageName:(NSString *)packageName serviceName:(NSString *)serviceName NS_DESIGNATED_INITIALIZER; -- (ProtoRPC *)RPCToMethod:(NSString *)method +- (GRPCProtoRPC *)RPCToMethod:(NSString *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable; @end + + +/** + * This subclass is empty now. Eventually we'll remove ProtoService class + * to avoid potential naming conflict + */ +@interface GRPCProtoService : ProtoService + +@end diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m index fccc6aadc9c..597c3cf0fed 100644 --- a/src/objective-c/ProtoRPC/ProtoService.m +++ b/src/objective-c/ProtoRPC/ProtoService.m @@ -79,3 +79,7 @@ responsesWriteable:responsesWriteable]; } @end + +@implementation GRPCProtoService + +@end From 4f11ab1ffd20a3a0cf2c33a563fcd5437733c189 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Wed, 8 Jun 2016 10:40:00 -0700 Subject: [PATCH 2/2] addressed feedback. --- src/compiler/objective_c_generator.cc | 2 +- src/objective-c/ProtoRPC/ProtoMethod.h | 2 +- src/objective-c/ProtoRPC/ProtoRPC.h | 6 +++--- src/objective-c/ProtoRPC/ProtoRPC.m | 2 +- src/objective-c/ProtoRPC/ProtoService.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 75665cd5c0d..71a674174d7 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -94,7 +94,7 @@ void PrintSimpleSignature(Printer *printer, const MethodDescriptor *method, void PrintAdvancedSignature(Printer *printer, const MethodDescriptor *method, map< ::grpc::string, ::grpc::string> vars) { vars["method_name"] = "RPCTo" + vars["method_name"]; - vars["return_type"] = "GRPCProtoRPC *"; + vars["return_type"] = "GRPCProtoCall *"; PrintMethodSignature(printer, method, vars); } diff --git a/src/objective-c/ProtoRPC/ProtoMethod.h b/src/objective-c/ProtoRPC/ProtoMethod.h index bd1a848c19a..f9fdbb35ffd 100644 --- a/src/objective-c/ProtoRPC/ProtoMethod.h +++ b/src/objective-c/ProtoRPC/ProtoMethod.h @@ -51,7 +51,7 @@ __attribute__((deprecated("Please use GRPCProtoMethod."))) @end /** - * This subclass is empty now. Eventually we'll remove ProtoService class + * This subclass is empty now. Eventually we'll remove ProtoMethod class * to avoid potential naming conflict */ @interface GRPCProtoMethod : ProtoMethod diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index 55fefb0aa88..f22d731f68b 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -36,7 +36,7 @@ #import "ProtoMethod.h" -__attribute__((deprecated("Please use GRPCProtoRPC."))) +__attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC : GRPCCall - (instancetype)initWithHost:(NSString *)host @@ -49,9 +49,9 @@ __attribute__((deprecated("Please use GRPCProtoRPC."))) @end /** - * This subclass is empty now. Eventually we'll remove ProtoService class + * This subclass is empty now. Eventually we'll remove ProtoRPC class * to avoid potential naming conflict */ -@interface GRPCProtoRPC : ProtoRPC +@interface GRPCProtoCall : ProtoRPC @end diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index 27c8b0eff7e..fb0b566f199 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -118,6 +118,6 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing } @end -@implementation GRPCProtoRPC +@implementation GRPCProtoCall @end diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index edec8a4770f..87d06e1ae59 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -33,7 +33,7 @@ #import -@class GRPCProtoRPC; +@class GRPCProtoCall; @protocol GRXWriteable; @class GRXWriter; @@ -44,7 +44,7 @@ __attribute__((deprecated("Please use GRPCProtoService."))) packageName:(NSString *)packageName serviceName:(NSString *)serviceName NS_DESIGNATED_INITIALIZER; -- (GRPCProtoRPC *)RPCToMethod:(NSString *)method +- (GRPCProtoCall *)RPCToMethod:(NSString *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable;