From ee6de9365b9d2a79cd7874b4976372c681fb257d Mon Sep 17 00:00:00 2001
From: Benjamin Herzog <pirat267@gmail.com>
Date: Fri, 22 Apr 2016 11:17:43 +0200
Subject: [PATCH] Move nonnull begin to correct position

---
 src/compiler/objective_c_plugin.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc
index f62faa5261..9522956fde 100644
--- a/src/compiler/objective_c_plugin.cc
+++ b/src/compiler/objective_c_plugin.cc
@@ -64,8 +64,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
         ".pbobjc.h\"\n\n"
         "#import <ProtoRPC/ProtoService.h>\n"
         "#import <RxLibrary/GRXWriteable.h>\n"
-        "#import <RxLibrary/GRXWriter.h>\n\n"
-        "NS_ASSUME_NONNULL_BEGIN\n\n";
+        "#import <RxLibrary/GRXWriter.h>\n";
 
       // TODO(jcanizales): Instead forward-declare the input and output types
       // and import the files in the .pbrpc.m
@@ -82,10 +81,12 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
         declarations += grpc_objective_c_generator::GetHeader(service);
       }
 
+      ::grpc::string nonNullBegin = "\nNS_ASSUME_NONNULL_BEGIN\n\n";
       ::grpc::string nonNullEnd = "\nNS_ASSUME_NONNULL_END\n";
 
       Write(context, file_name + ".pbrpc.h",
-          imports + '\n' + proto_imports + '\n' + declarations + nonNullEnd);
+          imports + '\n' + proto_imports + '\n' + nonNullBegin + 
+          declarations + nonNullEnd);
     }
 
     {
-- 
GitLab