Upgrade to protobuf-3.0.0-beta-1
diff --git a/.travis.yml b/.travis.yml
index ef2fd49..b25e182 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,13 +4,13 @@
 
 env:
   global:
-    - LDFLAGS=-L/tmp/proto3-a3/lib
-    - CXXFLAGS=-I/tmp/proto3-a3/include
-    - LD_LIBRARY_PATH=/tmp/proto3-a3/lib
-    - PATH=/tmp/proto3-a3/bin:$PATH
+    - PROTOBUF_VERSION=3.0.0-beta-1
+    - LDFLAGS=-L/tmp/protobuf-${PROTOBUF_VERSION}/lib
+    - CXXFLAGS=-I/tmp/protobuf-${PROTOBUF_VERSION}/include
+    - LD_LIBRARY_PATH=/tmp/protobuf-${PROTOBUF_VERSION}/lib
 
 before_install:
-  - buildscripts/make_dependencies.sh # build protoc into /tmp/proto3-a3
+  - buildscripts/make_dependencies.sh # build protoc into /tmp/protobuf-${PROTOBUF_VERSION}
   - mkdir -p $HOME/.gradle
   - echo "checkstyle.ignoreFailures=false" >> $HOME/.gradle/gradle.properties
 
@@ -31,7 +31,7 @@
 
 cache:
   directories:
-    - /tmp/proto3-a3
+    - /tmp/protobuf-${PROTOBUF_VERSION}
     - $HOME/.m2/repository/io/netty
     - $HOME/.gradle/caches/modules-2
     - $HOME/.gradle/wrapper
diff --git a/COMPILING.md b/COMPILING.md
index fff734f..7ac36dd 100644
--- a/COMPILING.md
+++ b/COMPILING.md
@@ -27,13 +27,13 @@
 generation. Most users only need to use `skipCodegen=true` as discussed above.
 
 ### Build Protobuf
-The codegen plugin is C++ code and requires protobuf 3.0.0-alpha-3.1.
+The codegen plugin is C++ code and requires protobuf 3.0.0-beta-1.
 
 For Linux, Mac and MinGW:
 ```
 $ git clone https://github.com/google/protobuf.git
 $ cd protobuf
-$ git checkout v3.0.0-alpha-3.1
+$ git checkout v3.0.0-beta-1
 $ ./autogen.sh
 $ ./configure
 $ make
@@ -72,15 +72,15 @@
 Gradle to find protobuf:
 ```
 .\gradlew install ^
-    -PvcProtobufInclude=C:\path\to\protobuf-3.0.0-alpha-3.1\src ^
-    -PvcProtobufLibs=C:\path\to\protobuf-3.0.0-alpha-3.1\vsprojects\Release
+    -PvcProtobufInclude=C:\path\to\protobuf-3.0.0-beta-1\src ^
+    -PvcProtobufLibs=C:\path\to\protobuf-3.0.0-beta-1\vsprojects\Release
 ```
 
 Since specifying those properties every build is bothersome, you can instead
 create ``<project-root>\gradle.properties`` with contents like:
 ```
-vcProtobufInclude=C:\\path\\to\\protobuf-3.0.0-alpha-3.1\\src
-vcProtobufLibs=C:\\path\\to\\protobuf-3.0.0-alpha-3.1\\vsprojects\\Release
+vcProtobufInclude=C:\\path\\to\\protobuf-3.0.0-beta-1\\src
+vcProtobufLibs=C:\\path\\to\\protobuf-3.0.0-beta-1\\vsprojects\\Release
 ```
 
 The build script will build the codegen for the same architecture as the Java
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgs.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgs.java
index f166b26..f5212ed 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgs.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgs.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.ClientArgs)
     ClientArgsOrBuilder {
   // Use ClientArgs.newBuilder() to construct.
-  private ClientArgs(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private ClientArgs(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private ClientArgs() {
@@ -46,7 +46,8 @@
             if (argtypeCase_ == 1) {
               subBuilder = ((io.grpc.testing.ClientConfig) argtype_).toBuilder();
             }
-            argtype_ = input.readMessage(io.grpc.testing.ClientConfig.PARSER, extensionRegistry);
+            argtype_ =
+                input.readMessage(io.grpc.testing.ClientConfig.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom((io.grpc.testing.ClientConfig) argtype_);
               argtype_ = subBuilder.buildPartial();
@@ -59,7 +60,8 @@
             if (argtypeCase_ == 2) {
               subBuilder = ((io.grpc.testing.Mark) argtype_).toBuilder();
             }
-            argtype_ = input.readMessage(io.grpc.testing.Mark.PARSER, extensionRegistry);
+            argtype_ =
+                input.readMessage(io.grpc.testing.Mark.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom((io.grpc.testing.Mark) argtype_);
               argtype_ = subBuilder.buildPartial();
@@ -182,9 +184,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -196,7 +197,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeMessageSize(2, (io.grpc.testing.Mark) argtype_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -698,8 +699,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<ClientArgs> PARSER =
-      new com.google.protobuf.AbstractParser<ClientArgs>() {
+  private static final com.google.protobuf.Parser<ClientArgs>
+      PARSER = new com.google.protobuf.AbstractParser<ClientArgs>() {
     public ClientArgs parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgsOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgsOrBuilder.java
index 1b8c054..5d5a538 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgsOrBuilder.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ClientArgsOrBuilder.java
@@ -24,4 +24,6 @@
    * <code>optional .grpc.testing.Mark mark = 2;</code>
    */
   io.grpc.testing.MarkOrBuilder getMarkOrBuilder();
+
+  public io.grpc.testing.ClientArgs.ArgtypeCase getArgtypeCase();
 }
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ClientConfig.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientConfig.java
index 4843d02..33c12ef 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ClientConfig.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ClientConfig.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.ClientConfig)
     ClientConfigOrBuilder {
   // Use ClientConfig.newBuilder() to construct.
-  private ClientConfig(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private ClientConfig(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private ClientConfig() {
@@ -50,12 +50,12 @@
             break;
           }
           case 10: {
-            com.google.protobuf.ByteString bs = input.readBytes();
+            String s = input.readStringRequireUtf8();
             if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
               serverTargets_ = new com.google.protobuf.LazyStringArrayList();
               mutable_bitField0_ |= 0x00000001;
             }
-            serverTargets_.add(bs);
+            serverTargets_.add(s);
             break;
           }
           case 16: {
@@ -246,7 +246,7 @@
   public void writeTo(com.google.protobuf.CodedOutputStream output)
                       throws java.io.IOException {
     for (int i = 0; i < serverTargets_.size(); i++) {
-      output.writeBytes(1, serverTargets_.getByteString(i));
+      com.google.protobuf.GeneratedMessage.writeString(output, 1, serverTargets_.getRaw(i));
     }
     if (clientType_ != io.grpc.testing.ClientType.SYNCHRONOUS_CLIENT.getNumber()) {
       output.writeEnum(2, clientType_);
@@ -271,17 +271,15 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
     {
       int dataSize = 0;
       for (int i = 0; i < serverTargets_.size(); i++) {
-        dataSize += com.google.protobuf.CodedOutputStream
-          .computeBytesSizeNoTag(serverTargets_.getByteString(i));
+        dataSize += computeStringSizeNoTag(serverTargets_.getRaw(i));
       }
       size += dataSize;
       size += 1 * getServerTargetsList().size();
@@ -314,7 +312,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeEnumSize(8, rpcType_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -638,7 +636,8 @@
       if (value == null) {
     throw new NullPointerException();
   }
-  ensureServerTargetsIsMutable();
+  checkByteStringIsUtf8(value);
+      ensureServerTargetsIsMutable();
       serverTargets_.add(value);
       onChanged();
       return this;
@@ -897,8 +896,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<ClientConfig> PARSER =
-      new com.google.protobuf.AbstractParser<ClientConfig>() {
+  private static final com.google.protobuf.Parser<ClientConfig>
+      PARSER = new com.google.protobuf.AbstractParser<ClientConfig>() {
     public ClientConfig parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ClientStats.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientStats.java
index 45d6139..ba61940 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ClientStats.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ClientStats.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.ClientStats)
     ClientStatsOrBuilder {
   // Use ClientStats.newBuilder() to construct.
-  private ClientStats(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private ClientStats(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private ClientStats() {
@@ -49,7 +49,7 @@
             if (latencies_ != null) {
               subBuilder = latencies_.toBuilder();
             }
-            latencies_ = input.readMessage(io.grpc.testing.HistogramData.PARSER, extensionRegistry);
+            latencies_ = input.readMessage(io.grpc.testing.HistogramData.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom(latencies_);
               latencies_ = subBuilder.buildPartial();
@@ -170,9 +170,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -192,7 +191,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeDoubleSize(5, timeSystem_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -616,8 +615,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<ClientStats> PARSER =
-      new com.google.protobuf.AbstractParser<ClientStats>() {
+  private static final com.google.protobuf.Parser<ClientStats>
+      PARSER = new com.google.protobuf.AbstractParser<ClientStats>() {
     public ClientStats parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ClientStatus.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientStatus.java
index a260203..186e38a 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ClientStatus.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ClientStatus.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.ClientStatus)
     ClientStatusOrBuilder {
   // Use ClientStatus.newBuilder() to construct.
-  private ClientStatus(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private ClientStatus(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private ClientStatus() {
@@ -46,7 +46,7 @@
             if (stats_ != null) {
               subBuilder = stats_.toBuilder();
             }
-            stats_ = input.readMessage(io.grpc.testing.ClientStats.PARSER, extensionRegistry);
+            stats_ = input.readMessage(io.grpc.testing.ClientStats.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom(stats_);
               stats_ = subBuilder.buildPartial();
@@ -116,9 +116,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -126,7 +125,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeMessageSize(1, getStats());
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -454,8 +453,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<ClientStatus> PARSER =
-      new com.google.protobuf.AbstractParser<ClientStatus>() {
+  private static final com.google.protobuf.Parser<ClientStatus>
+      PARSER = new com.google.protobuf.AbstractParser<ClientStatus>() {
     public ClientStatus parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ClientType.java b/benchmarks/src/generated/main/java/io/grpc/testing/ClientType.java
index c9339ad..1301a7e 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ClientType.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ClientType.java
@@ -49,8 +49,8 @@
       internalGetValueMap() {
     return internalValueMap;
   }
-  private static com.google.protobuf.Internal.EnumLiteMap<ClientType>
-      internalValueMap =
+  private static final com.google.protobuf.Internal.EnumLiteMap<
+      ClientType> internalValueMap =
         new com.google.protobuf.Internal.EnumLiteMap<ClientType>() {
           public ClientType findValueByNumber(int number) {
             return ClientType.valueOf(number);
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/HistogramData.java b/benchmarks/src/generated/main/java/io/grpc/testing/HistogramData.java
index e09181f..921519b 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/HistogramData.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/HistogramData.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.HistogramData)
     HistogramDataOrBuilder {
   // Use HistogramData.newBuilder() to construct.
-  private HistogramData(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private HistogramData(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private HistogramData() {
@@ -226,9 +226,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -266,7 +265,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeDoubleSize(6, count_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -710,8 +709,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<HistogramData> PARSER =
-      new com.google.protobuf.AbstractParser<HistogramData>() {
+  private static final com.google.protobuf.Parser<HistogramData>
+      PARSER = new com.google.protobuf.AbstractParser<HistogramData>() {
     public HistogramData parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/Mark.java b/benchmarks/src/generated/main/java/io/grpc/testing/Mark.java
index c02928c..18079c8 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/Mark.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/Mark.java
@@ -15,7 +15,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.Mark)
     MarkOrBuilder {
   // Use Mark.newBuilder() to construct.
-  private Mark(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private Mark(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private Mark() {
@@ -82,13 +82,12 @@
                       throws java.io.IOException {
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -289,8 +288,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<Mark> PARSER =
-      new com.google.protobuf.AbstractParser<Mark>() {
+  private static final com.google.protobuf.Parser<Mark>
+      PARSER = new com.google.protobuf.AbstractParser<Mark>() {
     public Mark parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/Payload.java b/benchmarks/src/generated/main/java/io/grpc/testing/Payload.java
index 8957be2..b7ee1ba 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/Payload.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/Payload.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.Payload)
     PayloadOrBuilder {
   // Use Payload.newBuilder() to construct.
-  private Payload(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private Payload(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private Payload() {
@@ -135,9 +135,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -149,7 +148,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeBytesSize(2, body_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -463,8 +462,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<Payload> PARSER =
-      new com.google.protobuf.AbstractParser<Payload>() {
+  private static final com.google.protobuf.Parser<Payload>
+      PARSER = new com.google.protobuf.AbstractParser<Payload>() {
     public Payload parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/PayloadType.java b/benchmarks/src/generated/main/java/io/grpc/testing/PayloadType.java
index efd675d..dc3aab2 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/PayloadType.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/PayloadType.java
@@ -82,8 +82,8 @@
       internalGetValueMap() {
     return internalValueMap;
   }
-  private static com.google.protobuf.Internal.EnumLiteMap<PayloadType>
-      internalValueMap =
+  private static final com.google.protobuf.Internal.EnumLiteMap<
+      PayloadType> internalValueMap =
         new com.google.protobuf.Internal.EnumLiteMap<PayloadType>() {
           public PayloadType findValueByNumber(int number) {
             return PayloadType.valueOf(number);
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/RpcType.java b/benchmarks/src/generated/main/java/io/grpc/testing/RpcType.java
index 23c5d23..b5785cf 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/RpcType.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/RpcType.java
@@ -49,8 +49,8 @@
       internalGetValueMap() {
     return internalValueMap;
   }
-  private static com.google.protobuf.Internal.EnumLiteMap<RpcType>
-      internalValueMap =
+  private static final com.google.protobuf.Internal.EnumLiteMap<
+      RpcType> internalValueMap =
         new com.google.protobuf.Internal.EnumLiteMap<RpcType>() {
           public RpcType findValueByNumber(int number) {
             return RpcType.valueOf(number);
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgs.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgs.java
index 38c8b17..2561483 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgs.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgs.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.ServerArgs)
     ServerArgsOrBuilder {
   // Use ServerArgs.newBuilder() to construct.
-  private ServerArgs(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private ServerArgs(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private ServerArgs() {
@@ -46,7 +46,8 @@
             if (argtypeCase_ == 1) {
               subBuilder = ((io.grpc.testing.ServerConfig) argtype_).toBuilder();
             }
-            argtype_ = input.readMessage(io.grpc.testing.ServerConfig.PARSER, extensionRegistry);
+            argtype_ =
+                input.readMessage(io.grpc.testing.ServerConfig.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom((io.grpc.testing.ServerConfig) argtype_);
               argtype_ = subBuilder.buildPartial();
@@ -59,7 +60,8 @@
             if (argtypeCase_ == 2) {
               subBuilder = ((io.grpc.testing.Mark) argtype_).toBuilder();
             }
-            argtype_ = input.readMessage(io.grpc.testing.Mark.PARSER, extensionRegistry);
+            argtype_ =
+                input.readMessage(io.grpc.testing.Mark.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom((io.grpc.testing.Mark) argtype_);
               argtype_ = subBuilder.buildPartial();
@@ -182,9 +184,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -196,7 +197,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeMessageSize(2, (io.grpc.testing.Mark) argtype_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -698,8 +699,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<ServerArgs> PARSER =
-      new com.google.protobuf.AbstractParser<ServerArgs>() {
+  private static final com.google.protobuf.Parser<ServerArgs>
+      PARSER = new com.google.protobuf.AbstractParser<ServerArgs>() {
     public ServerArgs parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgsOrBuilder.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgsOrBuilder.java
index 6deb4dd..49dee62 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgsOrBuilder.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ServerArgsOrBuilder.java
@@ -24,4 +24,6 @@
    * <code>optional .grpc.testing.Mark mark = 2;</code>
    */
   io.grpc.testing.MarkOrBuilder getMarkOrBuilder();
+
+  public io.grpc.testing.ServerArgs.ArgtypeCase getArgtypeCase();
 }
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ServerConfig.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerConfig.java
index d5115af..f2dd8b5 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ServerConfig.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ServerConfig.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.ServerConfig)
     ServerConfigOrBuilder {
   // Use ServerConfig.newBuilder() to construct.
-  private ServerConfig(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private ServerConfig(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private ServerConfig() {
@@ -141,9 +141,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -159,7 +158,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeBoolSize(3, enableSsl_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -470,8 +469,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<ServerConfig> PARSER =
-      new com.google.protobuf.AbstractParser<ServerConfig>() {
+  private static final com.google.protobuf.Parser<ServerConfig>
+      PARSER = new com.google.protobuf.AbstractParser<ServerConfig>() {
     public ServerConfig parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ServerStats.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerStats.java
index b7e7d07..98c9eee 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ServerStats.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ServerStats.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.ServerStats)
     ServerStatsOrBuilder {
   // Use ServerStats.newBuilder() to construct.
-  private ServerStats(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private ServerStats(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private ServerStats() {
@@ -145,9 +145,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -163,7 +162,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeDoubleSize(3, timeSystem_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -492,8 +491,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<ServerStats> PARSER =
-      new com.google.protobuf.AbstractParser<ServerStats>() {
+  private static final com.google.protobuf.Parser<ServerStats>
+      PARSER = new com.google.protobuf.AbstractParser<ServerStats>() {
     public ServerStats parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ServerStatus.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerStatus.java
index 634f716..aa21114 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ServerStatus.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ServerStatus.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.ServerStatus)
     ServerStatusOrBuilder {
   // Use ServerStatus.newBuilder() to construct.
-  private ServerStatus(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private ServerStatus(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private ServerStatus() {
@@ -47,7 +47,7 @@
             if (stats_ != null) {
               subBuilder = stats_.toBuilder();
             }
-            stats_ = input.readMessage(io.grpc.testing.ServerStats.PARSER, extensionRegistry);
+            stats_ = input.readMessage(io.grpc.testing.ServerStats.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom(stats_);
               stats_ = subBuilder.buildPartial();
@@ -134,9 +134,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -148,7 +147,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeInt32Size(2, port_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -508,8 +507,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<ServerStatus> PARSER =
-      new com.google.protobuf.AbstractParser<ServerStatus>() {
+  private static final com.google.protobuf.Parser<ServerStatus>
+      PARSER = new com.google.protobuf.AbstractParser<ServerStatus>() {
     public ServerStatus parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/ServerType.java b/benchmarks/src/generated/main/java/io/grpc/testing/ServerType.java
index 9c35c79..7fb1881 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/ServerType.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/ServerType.java
@@ -49,8 +49,8 @@
       internalGetValueMap() {
     return internalValueMap;
   }
-  private static com.google.protobuf.Internal.EnumLiteMap<ServerType>
-      internalValueMap =
+  private static final com.google.protobuf.Internal.EnumLiteMap<
+      ServerType> internalValueMap =
         new com.google.protobuf.Internal.EnumLiteMap<ServerType>() {
           public ServerType findValueByNumber(int number) {
             return ServerType.valueOf(number);
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/SimpleRequest.java b/benchmarks/src/generated/main/java/io/grpc/testing/SimpleRequest.java
index 6a38bce..5914e3b 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/SimpleRequest.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/SimpleRequest.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.SimpleRequest)
     SimpleRequestOrBuilder {
   // Use SimpleRequest.newBuilder() to construct.
-  private SimpleRequest(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private SimpleRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private SimpleRequest() {
@@ -59,7 +59,7 @@
             if (payload_ != null) {
               subBuilder = payload_.toBuilder();
             }
-            payload_ = input.readMessage(io.grpc.testing.Payload.PARSER, extensionRegistry);
+            payload_ = input.readMessage(io.grpc.testing.Payload.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom(payload_);
               payload_ = subBuilder.buildPartial();
@@ -187,9 +187,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -205,7 +204,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeMessageSize(3, getPayload());
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -691,8 +690,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<SimpleRequest> PARSER =
-      new com.google.protobuf.AbstractParser<SimpleRequest>() {
+  private static final com.google.protobuf.Parser<SimpleRequest>
+      PARSER = new com.google.protobuf.AbstractParser<SimpleRequest>() {
     public SimpleRequest parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/SimpleResponse.java b/benchmarks/src/generated/main/java/io/grpc/testing/SimpleResponse.java
index f33033b..d40d738 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/SimpleResponse.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/SimpleResponse.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.SimpleResponse)
     SimpleResponseOrBuilder {
   // Use SimpleResponse.newBuilder() to construct.
-  private SimpleResponse(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private SimpleResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private SimpleResponse() {
@@ -46,7 +46,7 @@
             if (payload_ != null) {
               subBuilder = payload_.toBuilder();
             }
-            payload_ = input.readMessage(io.grpc.testing.Payload.PARSER, extensionRegistry);
+            payload_ = input.readMessage(io.grpc.testing.Payload.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom(payload_);
               payload_ = subBuilder.buildPartial();
@@ -116,9 +116,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -126,7 +125,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeMessageSize(1, getPayload());
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -454,8 +453,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<SimpleResponse> PARSER =
-      new com.google.protobuf.AbstractParser<SimpleResponse>() {
+  private static final com.google.protobuf.Parser<SimpleResponse>
+      PARSER = new com.google.protobuf.AbstractParser<SimpleResponse>() {
     public SimpleResponse parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/benchmarks/src/generated/main/java/io/grpc/testing/StatsRequest.java b/benchmarks/src/generated/main/java/io/grpc/testing/StatsRequest.java
index 1dcbf29..5efc6d1 100644
--- a/benchmarks/src/generated/main/java/io/grpc/testing/StatsRequest.java
+++ b/benchmarks/src/generated/main/java/io/grpc/testing/StatsRequest.java
@@ -11,7 +11,7 @@
     // @@protoc_insertion_point(message_implements:grpc.testing.StatsRequest)
     StatsRequestOrBuilder {
   // Use StatsRequest.newBuilder() to construct.
-  private StatsRequest(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private StatsRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private StatsRequest() {
@@ -101,9 +101,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -111,7 +110,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeInt32Size(1, testNum_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -352,8 +351,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<StatsRequest> PARSER =
-      new com.google.protobuf.AbstractParser<StatsRequest>() {
+  private static final com.google.protobuf.Parser<StatsRequest>
+      PARSER = new com.google.protobuf.AbstractParser<StatsRequest>() {
     public StatsRequest parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/build.gradle b/build.gradle
index 9d0b13b..f2e8f5c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -53,7 +53,8 @@
         protocPluginBaseName = 'protoc-gen-grpc-java'
         javaPluginPath = "$rootDir/compiler/build/binaries/java_pluginExecutable/$protocPluginBaseName$exeSuffix"
 
-        protobufVersion = '3.0.0-alpha-3.1'
+        protobufVersion = '3.0.0-beta-1'
+        protobufNanoVersion = '3.0.0-alpha-4'
 
         configureProtoCompilation = {
           String generatedSourcePath = "${projectDir}/src/generated"
@@ -129,7 +130,7 @@
                 oauth_client: 'com.google.auth:google-auth-library-oauth2-http:0.2.0',
                 okhttp: 'com.squareup.okhttp:okhttp:2.4.0',
                 protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
-                protobuf_nano: "com.google.protobuf.nano:protobuf-javanano:${protobufVersion}",
+                protobuf_nano: "com.google.protobuf.nano:protobuf-javanano:${protobufNanoVersion}",
                 protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.7.0',
 
                 netty: 'io.netty:netty-codec-http2:4.1.0.Beta5',
diff --git a/buildscripts/make_dependencies.sh b/buildscripts/make_dependencies.sh
index 094b5d6..c3592e9 100755
--- a/buildscripts/make_dependencies.sh
+++ b/buildscripts/make_dependencies.sh
@@ -3,16 +3,20 @@
 # Build protoc & netty
 set -ev
 
+DOWNLOAD_DIR=/tmp/source
+INSTALL_DIR=/tmp/protobuf-${PROTOBUF_VERSION}
+mkdir -p $DOWNLOAD_DIR
+
 # Make protoc
 # Can't check for presence of directory as cache auto-creates it.
-if [ -f /tmp/proto3-a3/bin/protoc ]; then
+if [ -f ${INSTALL_DIR}/bin/protoc ]; then
   echo "Not building protobuf. Already built"
 else
-  wget -O - https://github.com/google/protobuf/archive/v3.0.0-alpha-3.1.tar.gz | tar xz -C /tmp
-  pushd /tmp/protobuf-3.0.0-alpha-3.1
+  wget -O - https://github.com/google/protobuf/archive/v${PROTOBUF_VERSION}.tar.gz | tar xz -C $DOWNLOAD_DIR
+  pushd $DOWNLOAD_DIR/protobuf-${PROTOBUF_VERSION}
   ./autogen.sh
   # install here so we don't need sudo
-  ./configure --prefix=/tmp/proto3-a3
+  ./configure --prefix=${INSTALL_DIR}
   make -j2
   make install
   popd
diff --git a/compiler/Dockerfile b/compiler/Dockerfile
index 32c4850..df92927 100644
--- a/compiler/Dockerfile
+++ b/compiler/Dockerfile
@@ -2,7 +2,7 @@
 
 RUN scl enable devtoolset-1.1 'bash -c "cd /protobuf && \
     git fetch && \
-    git checkout v3.0.0-alpha-3.1 && \
+    git checkout v3.0.0-beta-1 && \
     ./autogen.sh && \
     CXXFLAGS=-m32 ./configure --disable-shared --prefix=/protobuf-32 && \
     make clean && make && make install"'
diff --git a/compiler/README.md b/compiler/README.md
index 561f118..ce89ca5 100644
--- a/compiler/README.md
+++ b/compiler/README.md
@@ -13,7 +13,7 @@
 
 * Linux, Mac OS X with Clang, or Windows with MSYS2
 * Java 7 or up
-* [Protobuf](https://github.com/google/protobuf) 3.0.0-alpha-3.1 or up
+* [Protobuf](https://github.com/google/protobuf) 3.0.0-beta-1 or up
 
 ## Compiling and testing the codegen
 Change to the `compiler` directory:
diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp
index a777af9..6152dc5 100644
--- a/compiler/src/java_plugin/cpp/java_generator.cpp
+++ b/compiler/src/java_plugin/cpp/java_generator.cpp
@@ -3,6 +3,7 @@
 #include <iostream>
 #include <map>
 #include <google/protobuf/compiler/java/java_names.h>
+#include <google/protobuf/descriptor.pb.h>
 #include <google/protobuf/io/printer.h>
 #include <google/protobuf/io/zero_copy_stream.h>
 
@@ -55,11 +56,23 @@
   return "METHOD_" + ToAllUpperCase(method->name());
 }
 
-static inline string MessageFullJavaName(const Descriptor* desc) {
-  return google::protobuf::compiler::java::ClassName(desc);
+static inline string MessageFullJavaName(
+    const FileDescriptor* file, bool nano, const Descriptor* desc) {
+  string name = google::protobuf::compiler::java::ClassName(desc);
+  if (nano  && !file->options().javanano_use_deprecated_package()) {
+    // XXX: Add "nano" to the original package
+    // (https://github.com/grpc/grpc-java/issues/900)
+    for (int i = 0; i < name.size(); ++i) {
+      if ((name[i] == '.') && (i < (name.size() - 1)) && isupper(name[i + 1])) {
+        return name.substr(0, i + 1) + "nano." + name.substr(i + 1);
+      }
+    }
+  }
+  return name;
 }
 
 static void PrintMethodFields(
+    const FileDescriptor* file,
     const ServiceDescriptor* service, map<string, string>* vars, Printer* p,
     bool generate_nano) {
   p->Print("// Static method descriptors that strictly reflect the proto.\n");
@@ -67,8 +80,10 @@
   for (int i = 0; i < service->method_count(); ++i) {
     const MethodDescriptor* method = service->method(i);
     (*vars)["method_name"] = method->name();
-    (*vars)["input_type"] = MessageFullJavaName(method->input_type());
-    (*vars)["output_type"] = MessageFullJavaName(method->output_type());
+    (*vars)["input_type"] = MessageFullJavaName(file, generate_nano,
+                                                method->input_type());
+    (*vars)["output_type"] = MessageFullJavaName(file, generate_nano,
+                                                 method->output_type());
     (*vars)["method_field_name"] = MethodPropertiesFieldName(method);
     bool client_streaming = method->client_streaming();
     bool server_streaming = method->server_streaming();
@@ -147,9 +162,11 @@
 };
 
 // Prints a client interface or implementation class, or a server interface.
-static void PrintStub(const google::protobuf::ServiceDescriptor* service,
-                        map<string, string>* vars,
-                        Printer* p, StubType type) {
+static void PrintStub(
+    const FileDescriptor* file,
+    const ServiceDescriptor* service,
+    map<string, string>* vars,
+    Printer* p, StubType type, bool generate_nano) {
   (*vars)["service_name"] = service->name();
   string interface_name = service->name();
   string impl_name = service->name();
@@ -254,8 +271,10 @@
   // RPC methods
   for (int i = 0; i < service->method_count(); ++i) {
     const MethodDescriptor* method = service->method(i);
-    (*vars)["input_type"] = MessageFullJavaName(method->input_type());
-    (*vars)["output_type"] = MessageFullJavaName(method->output_type());
+    (*vars)["input_type"] = MessageFullJavaName(file, generate_nano,
+                                                method->input_type());
+    (*vars)["output_type"] = MessageFullJavaName(file, generate_nano,
+                                                 method->output_type());
     (*vars)["lower_method_name"] = LowerMethodName(method);
     (*vars)["method_field_name"] = MethodPropertiesFieldName(method);
     bool client_streaming = method->client_streaming();
@@ -391,9 +410,11 @@
   p->Print("}\n\n");
 }
 
-static void PrintBindServiceMethod(const ServiceDescriptor* service,
+static void PrintBindServiceMethod(const FileDescriptor* file,
+                                   const ServiceDescriptor* service,
                                    map<string, string>* vars,
-                                   Printer* p) {
+                                   Printer* p,
+                                   bool generate_nano) {
   (*vars)["service_name"] = service->name();
   p->Print(
       *vars,
@@ -408,8 +429,10 @@
     const MethodDescriptor* method = service->method(i);
     (*vars)["lower_method_name"] = LowerMethodName(method);
     (*vars)["method_field_name"] = MethodPropertiesFieldName(method);
-    (*vars)["input_type"] = MessageFullJavaName(method->input_type());
-    (*vars)["output_type"] = MessageFullJavaName(method->output_type());
+    (*vars)["input_type"] = MessageFullJavaName(file, generate_nano,
+                                                method->input_type());
+    (*vars)["output_type"] = MessageFullJavaName(file, generate_nano,
+                                                 method->output_type());
     bool client_streaming = method->client_streaming();
     bool server_streaming = method->server_streaming();
     if (client_streaming) {
@@ -481,7 +504,8 @@
   p->Print("}\n");
 }
 
-static void PrintService(const ServiceDescriptor* service,
+static void PrintService(const FileDescriptor* file,
+                         const ServiceDescriptor* service,
                          map<string, string>* vars,
                          Printer* p,
                          bool generate_nano) {
@@ -493,7 +517,7 @@
       "public class $service_class_name$ {\n\n");
   p->Indent();
 
-  PrintMethodFields(service, vars, p, generate_nano);
+  PrintMethodFields(file, service, vars, p, generate_nano);
 
   p->Print(
       *vars,
@@ -525,13 +549,13 @@
   p->Outdent();
   p->Print("}\n\n");
 
-  PrintStub(service, vars, p, ASYNC_INTERFACE);
-  PrintStub(service, vars, p, BLOCKING_CLIENT_INTERFACE);
-  PrintStub(service, vars, p, FUTURE_CLIENT_INTERFACE);
-  PrintStub(service, vars, p, ASYNC_CLIENT_IMPL);
-  PrintStub(service, vars, p, BLOCKING_CLIENT_IMPL);
-  PrintStub(service, vars, p, FUTURE_CLIENT_IMPL);
-  PrintBindServiceMethod(service, vars, p);
+  PrintStub(file, service, vars, p, ASYNC_INTERFACE, generate_nano);
+  PrintStub(file, service, vars, p, BLOCKING_CLIENT_INTERFACE, generate_nano);
+  PrintStub(file, service, vars, p, FUTURE_CLIENT_INTERFACE, generate_nano);
+  PrintStub(file, service, vars, p, ASYNC_CLIENT_IMPL, generate_nano);
+  PrintStub(file, service, vars, p, BLOCKING_CLIENT_IMPL, generate_nano);
+  PrintStub(file, service, vars, p, FUTURE_CLIENT_IMPL, generate_nano);
+  PrintBindServiceMethod(file, service, vars, p, generate_nano);
   p->Outdent();
   p->Print("}\n");
 }
@@ -567,7 +591,8 @@
   }
 }
 
-void GenerateService(const ServiceDescriptor* service,
+void GenerateService(const FileDescriptor* file,
+                     const ServiceDescriptor* service,
                      google::protobuf::io::ZeroCopyOutputStream* out,
                      bool generate_nano) {
   // All non-generated classes must be referred by fully qualified names to
@@ -611,7 +636,7 @@
   if (!vars["Package"].empty()) {
     vars["Package"].append(".");
   }
-  PrintService(service, &vars, &printer, generate_nano);
+  PrintService(file, service, &vars, &printer, generate_nano);
 }
 
 string ServiceJavaPackage(const FileDescriptor* file) {
diff --git a/compiler/src/java_plugin/cpp/java_generator.h b/compiler/src/java_plugin/cpp/java_generator.h
index 6494192..f0adcea 100644
--- a/compiler/src/java_plugin/cpp/java_generator.h
+++ b/compiler/src/java_plugin/cpp/java_generator.h
@@ -46,7 +46,8 @@
 string ServiceClassName(const google::protobuf::ServiceDescriptor* service);
 
 // Writes the generated service interface into the given ZeroCopyOutputStream
-void GenerateService(const google::protobuf::ServiceDescriptor* service,
+void GenerateService(const google::protobuf::FileDescriptor* file,
+                     const google::protobuf::ServiceDescriptor* service,
                      google::protobuf::io::ZeroCopyOutputStream* out,
                      bool generate_nano);
 
diff --git a/compiler/src/java_plugin/cpp/java_plugin.cpp b/compiler/src/java_plugin/cpp/java_plugin.cpp
index 41c8999..ece8e2a 100644
--- a/compiler/src/java_plugin/cpp/java_plugin.cpp
+++ b/compiler/src/java_plugin/cpp/java_plugin.cpp
@@ -49,7 +49,7 @@
           + java_grpc_generator::ServiceClassName(service) + ".java";
       std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
           context->Open(filename));
-      java_grpc_generator::GenerateService(service, output.get(), generate_nano);
+      java_grpc_generator::GenerateService(file, service, output.get(), generate_nano);
     }
     return true;
   }
diff --git a/compiler/src/test/golden/TestServiceNano.java.txt b/compiler/src/test/golden/TestServiceNano.java.txt
index 188555d..a98a80f 100644
--- a/compiler/src/test/golden/TestServiceNano.java.txt
+++ b/compiler/src/test/golden/TestServiceNano.java.txt
@@ -19,104 +19,104 @@
 public class TestServiceGrpc {
 
   // Static method descriptors that strictly reflect the proto.
-  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
-      io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL =
+  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
+      io.grpc.testing.integration.nano.Test.SimpleResponse> METHOD_UNARY_CALL =
       io.grpc.MethodDescriptor.create(
           io.grpc.MethodDescriptor.MethodType.UNARY,
           generateFullMethodName(
               "grpc.testing.TestService", "UnaryCall"),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.SimpleRequest>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.SimpleRequest>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleRequest>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.SimpleRequest>() {
                   @Override
-                  public io.grpc.testing.integration.Test.SimpleRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.SimpleRequest.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.SimpleRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.SimpleRequest.parseFrom(input);
                   }
           }),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.SimpleResponse>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.SimpleResponse>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleResponse>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.SimpleResponse>() {
                   @Override
-                  public io.grpc.testing.integration.Test.SimpleResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.SimpleResponse.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.SimpleResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.SimpleResponse.parseFrom(input);
                   }
           }));
-  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
-      io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
+  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+      io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
       io.grpc.MethodDescriptor.create(
           io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING,
           generateFullMethodName(
               "grpc.testing.TestService", "StreamingOutputCall"),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallRequest>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallRequest>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>() {
                   @Override
-                  public io.grpc.testing.integration.Test.StreamingOutputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.StreamingOutputCallRequest.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest.parseFrom(input);
                   }
           }),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallResponse>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>() {
                   @Override
-                  public io.grpc.testing.integration.Test.StreamingOutputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.StreamingOutputCallResponse.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse.parseFrom(input);
                   }
           }));
-  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
-      io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
+  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
+      io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
       io.grpc.MethodDescriptor.create(
           io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING,
           generateFullMethodName(
               "grpc.testing.TestService", "StreamingInputCall"),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingInputCallRequest>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.StreamingInputCallRequest>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>() {
                   @Override
-                  public io.grpc.testing.integration.Test.StreamingInputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.StreamingInputCallRequest.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.StreamingInputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.StreamingInputCallRequest.parseFrom(input);
                   }
           }),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingInputCallResponse>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.StreamingInputCallResponse>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>() {
                   @Override
-                  public io.grpc.testing.integration.Test.StreamingInputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.StreamingInputCallResponse.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.StreamingInputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.StreamingInputCallResponse.parseFrom(input);
                   }
           }));
-  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
-      io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
+  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+      io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
       io.grpc.MethodDescriptor.create(
           io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
           generateFullMethodName(
               "grpc.testing.TestService", "FullBidiCall"),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallRequest>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallRequest>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>() {
                   @Override
-                  public io.grpc.testing.integration.Test.StreamingOutputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.StreamingOutputCallRequest.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest.parseFrom(input);
                   }
           }),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallResponse>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>() {
                   @Override
-                  public io.grpc.testing.integration.Test.StreamingOutputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.StreamingOutputCallResponse.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse.parseFrom(input);
                   }
           }));
-  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
-      io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
+  public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+      io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
       io.grpc.MethodDescriptor.create(
           io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
           generateFullMethodName(
               "grpc.testing.TestService", "HalfBidiCall"),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallRequest>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallRequest>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>() {
                   @Override
-                  public io.grpc.testing.integration.Test.StreamingOutputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.StreamingOutputCallRequest.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest.parseFrom(input);
                   }
           }),
-          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallResponse>marshaller(
-              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
+          io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
+              new io.grpc.protobuf.nano.Parser<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>() {
                   @Override
-                  public io.grpc.testing.integration.Test.StreamingOutputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
-                      return io.grpc.testing.integration.Test.StreamingOutputCallResponse.parseFrom(input);
+                  public io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
+                      return io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse.parseFrom(input);
                   }
           }));
 
@@ -136,34 +136,34 @@
 
   public static interface TestService {
 
-    public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
+    public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver);
 
-    public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
+    public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
 
-    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
+    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver);
 
-    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
+    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
 
-    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
+    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
   }
 
   public static interface TestServiceBlockingClient {
 
-    public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
+    public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request);
 
-    public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
-        io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
+    public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
+        io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request);
   }
 
   public static interface TestServiceFutureClient {
 
-    public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
-        io.grpc.testing.integration.Test.SimpleRequest request);
+    public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
+        io.grpc.testing.integration.nano.Test.SimpleRequest request);
   }
 
   public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
@@ -184,36 +184,36 @@
     }
 
     @java.lang.Override
-    public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
+    public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
       asyncUnaryCall(
           channel.newCall(METHOD_UNARY_CALL, callOptions), request, responseObserver);
     }
 
     @java.lang.Override
-    public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
+    public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
       asyncServerStreamingCall(
           channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request, responseObserver);
     }
 
     @java.lang.Override
-    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
+    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
       return asyncClientStreamingCall(
           channel.newCall(METHOD_STREAMING_INPUT_CALL, callOptions), responseObserver);
     }
 
     @java.lang.Override
-    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
+    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
       return asyncBidiStreamingCall(
           channel.newCall(METHOD_FULL_BIDI_CALL, callOptions), responseObserver);
     }
 
     @java.lang.Override
-    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
-        io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
+    public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
+        io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
       return asyncBidiStreamingCall(
           channel.newCall(METHOD_HALF_BIDI_CALL, callOptions), responseObserver);
     }
@@ -237,14 +237,14 @@
     }
 
     @java.lang.Override
-    public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
+    public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request) {
       return blockingUnaryCall(
           channel.newCall(METHOD_UNARY_CALL, callOptions), request);
     }
 
     @java.lang.Override
-    public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
-        io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
+    public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
+        io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) {
       return blockingServerStreamingCall(
           channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request);
     }
@@ -268,8 +268,8 @@
     }
 
     @java.lang.Override
-    public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
-        io.grpc.testing.integration.Test.SimpleRequest request) {
+    public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
+        io.grpc.testing.integration.nano.Test.SimpleRequest request) {
       return futureUnaryCall(
           channel.newCall(METHOD_UNARY_CALL, callOptions), request);
     }
@@ -282,12 +282,12 @@
           METHOD_UNARY_CALL,
           asyncUnaryCall(
             new io.grpc.stub.ServerCalls.UnaryMethod<
-                io.grpc.testing.integration.Test.SimpleRequest,
-                io.grpc.testing.integration.Test.SimpleResponse>() {
+                io.grpc.testing.integration.nano.Test.SimpleRequest,
+                io.grpc.testing.integration.nano.Test.SimpleResponse>() {
               @java.lang.Override
               public void invoke(
-                  io.grpc.testing.integration.Test.SimpleRequest request,
-                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
+                  io.grpc.testing.integration.nano.Test.SimpleRequest request,
+                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
                 serviceImpl.unaryCall(request, responseObserver);
               }
             })))
@@ -295,12 +295,12 @@
           METHOD_STREAMING_OUTPUT_CALL,
           asyncServerStreamingCall(
             new io.grpc.stub.ServerCalls.ServerStreamingMethod<
-                io.grpc.testing.integration.Test.StreamingOutputCallRequest,
-                io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
+                io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+                io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>() {
               @java.lang.Override
               public void invoke(
-                  io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
-                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
+                  io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
+                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
                 serviceImpl.streamingOutputCall(request, responseObserver);
               }
             })))
@@ -308,11 +308,11 @@
           METHOD_STREAMING_INPUT_CALL,
           asyncClientStreamingCall(
             new io.grpc.stub.ServerCalls.ClientStreamingMethod<
-                io.grpc.testing.integration.Test.StreamingInputCallRequest,
-                io.grpc.testing.integration.Test.StreamingInputCallResponse>() {
+                io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
+                io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>() {
               @java.lang.Override
-              public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> invoke(
-                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
+              public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> invoke(
+                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
                 return serviceImpl.streamingInputCall(responseObserver);
               }
             })))
@@ -320,11 +320,11 @@
           METHOD_FULL_BIDI_CALL,
           asyncBidiStreamingCall(
             new io.grpc.stub.ServerCalls.BidiStreamingMethod<
-                io.grpc.testing.integration.Test.StreamingOutputCallRequest,
-                io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
+                io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+                io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>() {
               @java.lang.Override
-              public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
-                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
+              public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> invoke(
+                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
                 return serviceImpl.fullBidiCall(responseObserver);
               }
             })))
@@ -332,11 +332,11 @@
           METHOD_HALF_BIDI_CALL,
           asyncBidiStreamingCall(
             new io.grpc.stub.ServerCalls.BidiStreamingMethod<
-                io.grpc.testing.integration.Test.StreamingOutputCallRequest,
-                io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
+                io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
+                io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>() {
               @java.lang.Override
-              public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
-                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
+              public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> invoke(
+                  io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
                 return serviceImpl.halfBidiCall(responseObserver);
               }
             }))).build();
diff --git a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java
index c0503ec..316b996 100644
--- a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java
+++ b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloRequest.java
@@ -15,7 +15,7 @@
     // @@protoc_insertion_point(message_implements:helloworld.HelloRequest)
     HelloRequestOrBuilder {
   // Use HelloRequest.newBuilder() to construct.
-  private HelloRequest(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private HelloRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private HelloRequest() {
@@ -47,9 +47,9 @@
             break;
           }
           case 10: {
-            com.google.protobuf.ByteString bs = input.readBytes();
+            String s = input.readStringRequireUtf8();
 
-            name_ = bs;
+            name_ = s;
             break;
           }
         }
@@ -89,9 +89,7 @@
       com.google.protobuf.ByteString bs = 
           (com.google.protobuf.ByteString) ref;
       java.lang.String s = bs.toStringUtf8();
-      if (bs.isValidUtf8()) {
-        name_ = s;
-      }
+      name_ = s;
       return s;
     }
   }
@@ -125,21 +123,19 @@
   public void writeTo(com.google.protobuf.CodedOutputStream output)
                       throws java.io.IOException {
     if (!getNameBytes().isEmpty()) {
-      output.writeBytes(1, getNameBytes());
+      com.google.protobuf.GeneratedMessage.writeString(output, 1, name_);
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
     if (!getNameBytes().isEmpty()) {
-      size += com.google.protobuf.CodedOutputStream
-        .computeBytesSize(1, getNameBytes());
+      size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -334,9 +330,7 @@
         com.google.protobuf.ByteString bs =
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          name_ = s;
-        }
+        name_ = s;
         return s;
       } else {
         return (java.lang.String) ref;
@@ -388,7 +382,8 @@
       if (value == null) {
     throw new NullPointerException();
   }
-  
+  checkByteStringIsUtf8(value);
+      
       name_ = value;
       onChanged();
       return this;
@@ -417,8 +412,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<HelloRequest> PARSER =
-      new com.google.protobuf.AbstractParser<HelloRequest>() {
+  private static final com.google.protobuf.Parser<HelloRequest>
+      PARSER = new com.google.protobuf.AbstractParser<HelloRequest>() {
     public HelloRequest parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloResponse.java b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloResponse.java
index fe99d49..e31e45d 100644
--- a/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloResponse.java
+++ b/examples/src/generated/main/java/io/grpc/examples/helloworld/HelloResponse.java
@@ -15,7 +15,7 @@
     // @@protoc_insertion_point(message_implements:helloworld.HelloResponse)
     HelloResponseOrBuilder {
   // Use HelloResponse.newBuilder() to construct.
-  private HelloResponse(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private HelloResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private HelloResponse() {
@@ -47,9 +47,9 @@
             break;
           }
           case 10: {
-            com.google.protobuf.ByteString bs = input.readBytes();
+            String s = input.readStringRequireUtf8();
 
-            message_ = bs;
+            message_ = s;
             break;
           }
         }
@@ -89,9 +89,7 @@
       com.google.protobuf.ByteString bs = 
           (com.google.protobuf.ByteString) ref;
       java.lang.String s = bs.toStringUtf8();
-      if (bs.isValidUtf8()) {
-        message_ = s;
-      }
+      message_ = s;
       return s;
     }
   }
@@ -125,21 +123,19 @@
   public void writeTo(com.google.protobuf.CodedOutputStream output)
                       throws java.io.IOException {
     if (!getMessageBytes().isEmpty()) {
-      output.writeBytes(1, getMessageBytes());
+      com.google.protobuf.GeneratedMessage.writeString(output, 1, message_);
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
     if (!getMessageBytes().isEmpty()) {
-      size += com.google.protobuf.CodedOutputStream
-        .computeBytesSize(1, getMessageBytes());
+      size += com.google.protobuf.GeneratedMessage.computeStringSize(1, message_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -334,9 +330,7 @@
         com.google.protobuf.ByteString bs =
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          message_ = s;
-        }
+        message_ = s;
         return s;
       } else {
         return (java.lang.String) ref;
@@ -388,7 +382,8 @@
       if (value == null) {
     throw new NullPointerException();
   }
-  
+  checkByteStringIsUtf8(value);
+      
       message_ = value;
       onChanged();
       return this;
@@ -417,8 +412,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<HelloResponse> PARSER =
-      new com.google.protobuf.AbstractParser<HelloResponse>() {
+  private static final com.google.protobuf.Parser<HelloResponse>
+      PARSER = new com.google.protobuf.AbstractParser<HelloResponse>() {
     public HelloResponse parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/examples/src/generated/main/java/io/grpc/examples/routeguide/Feature.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/Feature.java
index 21f37c8..827d309 100644
--- a/examples/src/generated/main/java/io/grpc/examples/routeguide/Feature.java
+++ b/examples/src/generated/main/java/io/grpc/examples/routeguide/Feature.java
@@ -16,7 +16,7 @@
     // @@protoc_insertion_point(message_implements:routeguide.Feature)
     FeatureOrBuilder {
   // Use Feature.newBuilder() to construct.
-  private Feature(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private Feature(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private Feature() {
@@ -48,9 +48,9 @@
             break;
           }
           case 10: {
-            com.google.protobuf.ByteString bs = input.readBytes();
+            String s = input.readStringRequireUtf8();
 
-            name_ = bs;
+            name_ = s;
             break;
           }
           case 18: {
@@ -58,7 +58,7 @@
             if (location_ != null) {
               subBuilder = location_.toBuilder();
             }
-            location_ = input.readMessage(io.grpc.examples.routeguide.Point.PARSER, extensionRegistry);
+            location_ = input.readMessage(io.grpc.examples.routeguide.Point.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom(location_);
               location_ = subBuilder.buildPartial();
@@ -107,9 +107,7 @@
       com.google.protobuf.ByteString bs = 
           (com.google.protobuf.ByteString) ref;
       java.lang.String s = bs.toStringUtf8();
-      if (bs.isValidUtf8()) {
-        name_ = s;
-      }
+      name_ = s;
       return s;
     }
   }
@@ -180,28 +178,26 @@
   public void writeTo(com.google.protobuf.CodedOutputStream output)
                       throws java.io.IOException {
     if (!getNameBytes().isEmpty()) {
-      output.writeBytes(1, getNameBytes());
+      com.google.protobuf.GeneratedMessage.writeString(output, 1, name_);
     }
     if (location_ != null) {
       output.writeMessage(2, getLocation());
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
     if (!getNameBytes().isEmpty()) {
-      size += com.google.protobuf.CodedOutputStream
-        .computeBytesSize(1, getNameBytes());
+      size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_);
     }
     if (location_ != null) {
       size += com.google.protobuf.CodedOutputStream
         .computeMessageSize(2, getLocation());
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -415,9 +411,7 @@
         com.google.protobuf.ByteString bs =
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          name_ = s;
-        }
+        name_ = s;
         return s;
       } else {
         return (java.lang.String) ref;
@@ -485,7 +479,8 @@
       if (value == null) {
     throw new NullPointerException();
   }
-  
+  checkByteStringIsUtf8(value);
+      
       name_ = value;
       onChanged();
       return this;
@@ -667,8 +662,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<Feature> PARSER =
-      new com.google.protobuf.AbstractParser<Feature>() {
+  private static final com.google.protobuf.Parser<Feature>
+      PARSER = new com.google.protobuf.AbstractParser<Feature>() {
     public Feature parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/examples/src/generated/main/java/io/grpc/examples/routeguide/Point.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/Point.java
index 884fa8c..49aefc7 100644
--- a/examples/src/generated/main/java/io/grpc/examples/routeguide/Point.java
+++ b/examples/src/generated/main/java/io/grpc/examples/routeguide/Point.java
@@ -18,7 +18,7 @@
     // @@protoc_insertion_point(message_implements:routeguide.Point)
     PointOrBuilder {
   // Use Point.newBuilder() to construct.
-  private Point(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private Point(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private Point() {
@@ -122,9 +122,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -136,7 +135,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeInt32Size(2, longitude_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -404,8 +403,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<Point> PARSER =
-      new com.google.protobuf.AbstractParser<Point>() {
+  private static final com.google.protobuf.Parser<Point>
+      PARSER = new com.google.protobuf.AbstractParser<Point>() {
     public Point parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/examples/src/generated/main/java/io/grpc/examples/routeguide/Rectangle.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/Rectangle.java
index 8638c76..8268e7f 100644
--- a/examples/src/generated/main/java/io/grpc/examples/routeguide/Rectangle.java
+++ b/examples/src/generated/main/java/io/grpc/examples/routeguide/Rectangle.java
@@ -16,7 +16,7 @@
     // @@protoc_insertion_point(message_implements:routeguide.Rectangle)
     RectangleOrBuilder {
   // Use Rectangle.newBuilder() to construct.
-  private Rectangle(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private Rectangle(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private Rectangle() {
@@ -51,7 +51,7 @@
             if (lo_ != null) {
               subBuilder = lo_.toBuilder();
             }
-            lo_ = input.readMessage(io.grpc.examples.routeguide.Point.PARSER, extensionRegistry);
+            lo_ = input.readMessage(io.grpc.examples.routeguide.Point.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom(lo_);
               lo_ = subBuilder.buildPartial();
@@ -64,7 +64,7 @@
             if (hi_ != null) {
               subBuilder = hi_.toBuilder();
             }
-            hi_ = input.readMessage(io.grpc.examples.routeguide.Point.PARSER, extensionRegistry);
+            hi_ = input.readMessage(io.grpc.examples.routeguide.Point.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom(hi_);
               hi_ = subBuilder.buildPartial();
@@ -182,9 +182,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -196,7 +195,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeMessageSize(2, getHi());
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -732,8 +731,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<Rectangle> PARSER =
-      new com.google.protobuf.AbstractParser<Rectangle>() {
+  private static final com.google.protobuf.Parser<Rectangle>
+      PARSER = new com.google.protobuf.AbstractParser<Rectangle>() {
     public Rectangle parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteNote.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteNote.java
index a0e972b..867cfc1 100644
--- a/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteNote.java
+++ b/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteNote.java
@@ -15,7 +15,7 @@
     // @@protoc_insertion_point(message_implements:routeguide.RouteNote)
     RouteNoteOrBuilder {
   // Use RouteNote.newBuilder() to construct.
-  private RouteNote(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private RouteNote(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private RouteNote() {
@@ -51,7 +51,7 @@
             if (location_ != null) {
               subBuilder = location_.toBuilder();
             }
-            location_ = input.readMessage(io.grpc.examples.routeguide.Point.PARSER, extensionRegistry);
+            location_ = input.readMessage(io.grpc.examples.routeguide.Point.parser(), extensionRegistry);
             if (subBuilder != null) {
               subBuilder.mergeFrom(location_);
               location_ = subBuilder.buildPartial();
@@ -60,9 +60,9 @@
             break;
           }
           case 18: {
-            com.google.protobuf.ByteString bs = input.readBytes();
+            String s = input.readStringRequireUtf8();
 
-            message_ = bs;
+            message_ = s;
             break;
           }
         }
@@ -139,9 +139,7 @@
       com.google.protobuf.ByteString bs = 
           (com.google.protobuf.ByteString) ref;
       java.lang.String s = bs.toStringUtf8();
-      if (bs.isValidUtf8()) {
-        message_ = s;
-      }
+      message_ = s;
       return s;
     }
   }
@@ -182,13 +180,12 @@
       output.writeMessage(1, getLocation());
     }
     if (!getMessageBytes().isEmpty()) {
-      output.writeBytes(2, getMessageBytes());
+      com.google.protobuf.GeneratedMessage.writeString(output, 2, message_);
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -197,10 +194,9 @@
         .computeMessageSize(1, getLocation());
     }
     if (!getMessageBytes().isEmpty()) {
-      size += com.google.protobuf.CodedOutputStream
-        .computeBytesSize(2, getMessageBytes());
+      size += com.google.protobuf.GeneratedMessage.computeStringSize(2, message_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -566,9 +562,7 @@
         com.google.protobuf.ByteString bs =
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          message_ = s;
-        }
+        message_ = s;
         return s;
       } else {
         return (java.lang.String) ref;
@@ -636,7 +630,8 @@
       if (value == null) {
     throw new NullPointerException();
   }
-  
+  checkByteStringIsUtf8(value);
+      
       message_ = value;
       onChanged();
       return this;
@@ -665,8 +660,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<RouteNote> PARSER =
-      new com.google.protobuf.AbstractParser<RouteNote>() {
+  private static final com.google.protobuf.Parser<RouteNote>
+      PARSER = new com.google.protobuf.AbstractParser<RouteNote>() {
     public RouteNote parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteSummary.java b/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteSummary.java
index 52da52d..0ab163e 100644
--- a/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteSummary.java
+++ b/examples/src/generated/main/java/io/grpc/examples/routeguide/RouteSummary.java
@@ -18,7 +18,7 @@
     // @@protoc_insertion_point(message_implements:routeguide.RouteSummary)
     RouteSummaryOrBuilder {
   // Use RouteSummary.newBuilder() to construct.
-  private RouteSummary(com.google.protobuf.GeneratedMessage.Builder builder) {
+  private RouteSummary(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
     super(builder);
   }
   private RouteSummary() {
@@ -174,9 +174,8 @@
     }
   }
 
-  private int memoizedSerializedSize = -1;
   public int getSerializedSize() {
-    int size = memoizedSerializedSize;
+    int size = memoizedSize;
     if (size != -1) return size;
 
     size = 0;
@@ -196,7 +195,7 @@
       size += com.google.protobuf.CodedOutputStream
         .computeInt32Size(4, elapsedTime_);
     }
-    memoizedSerializedSize = size;
+    memoizedSize = size;
     return size;
   }
 
@@ -576,8 +575,8 @@
     return DEFAULT_INSTANCE;
   }
 
-  public static final com.google.protobuf.Parser<RouteSummary> PARSER =
-      new com.google.protobuf.AbstractParser<RouteSummary>() {
+  private static final com.google.protobuf.Parser<RouteSummary>
+      PARSER = new com.google.protobuf.AbstractParser<RouteSummary>() {
     public RouteSummary parsePartialFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/interop-testing/src/generated/main/java/com/google/protobuf/EmptyProtos.java b/interop-testing/src/generated/main/java/com/google/protobuf/EmptyProtos.java
index deeadbe..e1b0b21 100644
--- a/interop-testing/src/generated/main/java/com/google/protobuf/EmptyProtos.java
+++ b/interop-testing/src/generated/main/java/com/google/protobuf/EmptyProtos.java
@@ -29,7 +29,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.Empty)
       EmptyOrBuilder {
     // Use Empty.newBuilder() to construct.
-    private Empty(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private Empty(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private Empty() {
@@ -101,14 +101,13 @@
       unknownFields.writeTo(output);
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
       size += unknownFields.getSerializedSize();
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -305,8 +304,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<Empty> PARSER =
-        new com.google.protobuf.AbstractParser<Empty>() {
+    @java.lang.Deprecated public static final com.google.protobuf.Parser<Empty>
+        PARSER = new com.google.protobuf.AbstractParser<Empty>() {
       public Empty parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/interop-testing/src/generated/main/java/io/grpc/testing/integration/Messages.java b/interop-testing/src/generated/main/java/io/grpc/testing/integration/Messages.java
index 8325868..4827673 100644
--- a/interop-testing/src/generated/main/java/io/grpc/testing/integration/Messages.java
+++ b/interop-testing/src/generated/main/java/io/grpc/testing/integration/Messages.java
@@ -91,8 +91,8 @@
         internalGetValueMap() {
       return internalValueMap;
     }
-    private static com.google.protobuf.Internal.EnumLiteMap<PayloadType>
-        internalValueMap =
+    private static final com.google.protobuf.Internal.EnumLiteMap<
+        PayloadType> internalValueMap =
           new com.google.protobuf.Internal.EnumLiteMap<PayloadType>() {
             public PayloadType findValueByNumber(int number) {
               return PayloadType.valueOf(number);
@@ -179,7 +179,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.Payload)
       PayloadOrBuilder {
     // Use Payload.newBuilder() to construct.
-    private Payload(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private Payload(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private Payload() {
@@ -303,9 +303,8 @@
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
@@ -317,7 +316,7 @@
         size += com.google.protobuf.CodedOutputStream
           .computeBytesSize(2, body_);
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -635,8 +634,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<Payload> PARSER =
-        new com.google.protobuf.AbstractParser<Payload>() {
+    private static final com.google.protobuf.Parser<Payload>
+        PARSER = new com.google.protobuf.AbstractParser<Payload>() {
       public Payload parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -757,7 +756,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.SimpleRequest)
       SimpleRequestOrBuilder {
     // Use SimpleRequest.newBuilder() to construct.
-    private SimpleRequest(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private SimpleRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private SimpleRequest() {
@@ -807,7 +806,7 @@
               if (payload_ != null) {
                 subBuilder = payload_.toBuilder();
               }
-              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.PARSER, extensionRegistry);
+              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.parser(), extensionRegistry);
               if (subBuilder != null) {
                 subBuilder.mergeFrom(payload_);
                 payload_ = subBuilder.buildPartial();
@@ -977,9 +976,8 @@
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
@@ -1003,7 +1001,7 @@
         size += com.google.protobuf.CodedOutputStream
           .computeBoolSize(5, fillOauthScope_);
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -1581,8 +1579,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<SimpleRequest> PARSER =
-        new com.google.protobuf.AbstractParser<SimpleRequest>() {
+    private static final com.google.protobuf.Parser<SimpleRequest>
+        PARSER = new com.google.protobuf.AbstractParser<SimpleRequest>() {
       public SimpleRequest parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -1694,7 +1692,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.SimpleResponse)
       SimpleResponseOrBuilder {
     // Use SimpleResponse.newBuilder() to construct.
-    private SimpleResponse(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private SimpleResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private SimpleResponse() {
@@ -1731,7 +1729,7 @@
               if (payload_ != null) {
                 subBuilder = payload_.toBuilder();
               }
-              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.PARSER, extensionRegistry);
+              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.parser(), extensionRegistry);
               if (subBuilder != null) {
                 subBuilder.mergeFrom(payload_);
                 payload_ = subBuilder.buildPartial();
@@ -1740,15 +1738,15 @@
               break;
             }
             case 18: {
-              com.google.protobuf.ByteString bs = input.readBytes();
+              String s = input.readStringRequireUtf8();
 
-              username_ = bs;
+              username_ = s;
               break;
             }
             case 26: {
-              com.google.protobuf.ByteString bs = input.readBytes();
+              String s = input.readStringRequireUtf8();
 
-              oauthScope_ = bs;
+              oauthScope_ = s;
               break;
             }
           }
@@ -1826,9 +1824,7 @@
         com.google.protobuf.ByteString bs = 
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          username_ = s;
-        }
+        username_ = s;
         return s;
       }
     }
@@ -1871,9 +1867,7 @@
         com.google.protobuf.ByteString bs = 
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          oauthScope_ = s;
-        }
+        oauthScope_ = s;
         return s;
       }
     }
@@ -1914,16 +1908,15 @@
         output.writeMessage(1, getPayload());
       }
       if (!getUsernameBytes().isEmpty()) {
-        output.writeBytes(2, getUsernameBytes());
+        com.google.protobuf.GeneratedMessage.writeString(output, 2, username_);
       }
       if (!getOauthScopeBytes().isEmpty()) {
-        output.writeBytes(3, getOauthScopeBytes());
+        com.google.protobuf.GeneratedMessage.writeString(output, 3, oauthScope_);
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
@@ -1932,14 +1925,12 @@
           .computeMessageSize(1, getPayload());
       }
       if (!getUsernameBytes().isEmpty()) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(2, getUsernameBytes());
+        size += com.google.protobuf.GeneratedMessage.computeStringSize(2, username_);
       }
       if (!getOauthScopeBytes().isEmpty()) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(3, getOauthScopeBytes());
+        size += com.google.protobuf.GeneratedMessage.computeStringSize(3, oauthScope_);
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -2313,9 +2304,7 @@
           com.google.protobuf.ByteString bs =
               (com.google.protobuf.ByteString) ref;
           java.lang.String s = bs.toStringUtf8();
-          if (bs.isValidUtf8()) {
-            username_ = s;
-          }
+          username_ = s;
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2387,7 +2376,8 @@
         if (value == null) {
     throw new NullPointerException();
   }
-  
+  checkByteStringIsUtf8(value);
+        
         username_ = value;
         onChanged();
         return this;
@@ -2407,9 +2397,7 @@
           com.google.protobuf.ByteString bs =
               (com.google.protobuf.ByteString) ref;
           java.lang.String s = bs.toStringUtf8();
-          if (bs.isValidUtf8()) {
-            oauthScope_ = s;
-          }
+          oauthScope_ = s;
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2477,7 +2465,8 @@
         if (value == null) {
     throw new NullPointerException();
   }
-  
+  checkByteStringIsUtf8(value);
+        
         oauthScope_ = value;
         onChanged();
         return this;
@@ -2506,8 +2495,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<SimpleResponse> PARSER =
-        new com.google.protobuf.AbstractParser<SimpleResponse>() {
+    private static final com.google.protobuf.Parser<SimpleResponse>
+        PARSER = new com.google.protobuf.AbstractParser<SimpleResponse>() {
       public SimpleResponse parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -2562,7 +2551,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.SimpleContext)
       SimpleContextOrBuilder {
     // Use SimpleContext.newBuilder() to construct.
-    private SimpleContext(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private SimpleContext(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private SimpleContext() {
@@ -2594,9 +2583,9 @@
               break;
             }
             case 10: {
-              com.google.protobuf.ByteString bs = input.readBytes();
+              String s = input.readStringRequireUtf8();
 
-              value_ = bs;
+              value_ = s;
               break;
             }
           }
@@ -2636,9 +2625,7 @@
         com.google.protobuf.ByteString bs = 
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          value_ = s;
-        }
+        value_ = s;
         return s;
       }
     }
@@ -2672,21 +2659,19 @@
     public void writeTo(com.google.protobuf.CodedOutputStream output)
                         throws java.io.IOException {
       if (!getValueBytes().isEmpty()) {
-        output.writeBytes(1, getValueBytes());
+        com.google.protobuf.GeneratedMessage.writeString(output, 1, value_);
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
       if (!getValueBytes().isEmpty()) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(1, getValueBytes());
+        size += com.google.protobuf.GeneratedMessage.computeStringSize(1, value_);
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -2877,9 +2862,7 @@
           com.google.protobuf.ByteString bs =
               (com.google.protobuf.ByteString) ref;
           java.lang.String s = bs.toStringUtf8();
-          if (bs.isValidUtf8()) {
-            value_ = s;
-          }
+          value_ = s;
           return s;
         } else {
           return (java.lang.String) ref;
@@ -2931,7 +2914,8 @@
         if (value == null) {
     throw new NullPointerException();
   }
-  
+  checkByteStringIsUtf8(value);
+        
         value_ = value;
         onChanged();
         return this;
@@ -2960,8 +2944,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<SimpleContext> PARSER =
-        new com.google.protobuf.AbstractParser<SimpleContext>() {
+    private static final com.google.protobuf.Parser<SimpleContext>
+        PARSER = new com.google.protobuf.AbstractParser<SimpleContext>() {
       public SimpleContext parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -3035,7 +3019,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.StreamingInputCallRequest)
       StreamingInputCallRequestOrBuilder {
     // Use StreamingInputCallRequest.newBuilder() to construct.
-    private StreamingInputCallRequest(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private StreamingInputCallRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private StreamingInputCallRequest() {
@@ -3070,7 +3054,7 @@
               if (payload_ != null) {
                 subBuilder = payload_.toBuilder();
               }
-              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.PARSER, extensionRegistry);
+              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.parser(), extensionRegistry);
               if (subBuilder != null) {
                 subBuilder.mergeFrom(payload_);
                 payload_ = subBuilder.buildPartial();
@@ -3152,9 +3136,8 @@
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
@@ -3162,7 +3145,7 @@
         size += com.google.protobuf.CodedOutputStream
           .computeMessageSize(1, getPayload());
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -3530,8 +3513,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<StreamingInputCallRequest> PARSER =
-        new com.google.protobuf.AbstractParser<StreamingInputCallRequest>() {
+    private static final com.google.protobuf.Parser<StreamingInputCallRequest>
+        PARSER = new com.google.protobuf.AbstractParser<StreamingInputCallRequest>() {
       public StreamingInputCallRequest parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -3589,7 +3572,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.StreamingInputCallResponse)
       StreamingInputCallResponseOrBuilder {
     // Use StreamingInputCallResponse.newBuilder() to construct.
-    private StreamingInputCallResponse(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private StreamingInputCallResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private StreamingInputCallResponse() {
@@ -3679,9 +3662,8 @@
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
@@ -3689,7 +3671,7 @@
         size += com.google.protobuf.CodedOutputStream
           .computeInt32Size(1, aggregatedPayloadSize_);
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -3934,8 +3916,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<StreamingInputCallResponse> PARSER =
-        new com.google.protobuf.AbstractParser<StreamingInputCallResponse>() {
+    private static final com.google.protobuf.Parser<StreamingInputCallResponse>
+        PARSER = new com.google.protobuf.AbstractParser<StreamingInputCallResponse>() {
       public StreamingInputCallResponse parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -4004,7 +3986,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.ResponseParameters)
       ResponseParametersOrBuilder {
     // Use ResponseParameters.newBuilder() to construct.
-    private ResponseParameters(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private ResponseParameters(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private ResponseParameters() {
@@ -4118,9 +4100,8 @@
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
@@ -4132,7 +4113,7 @@
         size += com.google.protobuf.CodedOutputStream
           .computeInt32Size(2, intervalUs_);
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -4427,8 +4408,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<ResponseParameters> PARSER =
-        new com.google.protobuf.AbstractParser<ResponseParameters>() {
+    private static final com.google.protobuf.Parser<ResponseParameters>
+        PARSER = new com.google.protobuf.AbstractParser<ResponseParameters>() {
       public ResponseParameters parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -4569,7 +4550,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.StreamingOutputCallRequest)
       StreamingOutputCallRequestOrBuilder {
     // Use StreamingOutputCallRequest.newBuilder() to construct.
-    private StreamingOutputCallRequest(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private StreamingOutputCallRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private StreamingOutputCallRequest() {
@@ -4612,7 +4593,7 @@
                 responseParameters_ = new java.util.ArrayList<io.grpc.testing.integration.Messages.ResponseParameters>();
                 mutable_bitField0_ |= 0x00000002;
               }
-              responseParameters_.add(input.readMessage(io.grpc.testing.integration.Messages.ResponseParameters.PARSER, extensionRegistry));
+              responseParameters_.add(input.readMessage(io.grpc.testing.integration.Messages.ResponseParameters.parser(), extensionRegistry));
               break;
             }
             case 26: {
@@ -4620,7 +4601,7 @@
               if (payload_ != null) {
                 subBuilder = payload_.toBuilder();
               }
-              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.PARSER, extensionRegistry);
+              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.parser(), extensionRegistry);
               if (subBuilder != null) {
                 subBuilder.mergeFrom(payload_);
                 payload_ = subBuilder.buildPartial();
@@ -4797,9 +4778,8 @@
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
@@ -4815,7 +4795,7 @@
         size += com.google.protobuf.CodedOutputStream
           .computeMessageSize(3, getPayload());
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -5626,8 +5606,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<StreamingOutputCallRequest> PARSER =
-        new com.google.protobuf.AbstractParser<StreamingOutputCallRequest>() {
+    private static final com.google.protobuf.Parser<StreamingOutputCallRequest>
+        PARSER = new com.google.protobuf.AbstractParser<StreamingOutputCallRequest>() {
       public StreamingOutputCallRequest parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -5701,7 +5681,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.StreamingOutputCallResponse)
       StreamingOutputCallResponseOrBuilder {
     // Use StreamingOutputCallResponse.newBuilder() to construct.
-    private StreamingOutputCallResponse(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private StreamingOutputCallResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private StreamingOutputCallResponse() {
@@ -5736,7 +5716,7 @@
               if (payload_ != null) {
                 subBuilder = payload_.toBuilder();
               }
-              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.PARSER, extensionRegistry);
+              payload_ = input.readMessage(io.grpc.testing.integration.Messages.Payload.parser(), extensionRegistry);
               if (subBuilder != null) {
                 subBuilder.mergeFrom(payload_);
                 payload_ = subBuilder.buildPartial();
@@ -5818,9 +5798,8 @@
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
@@ -5828,7 +5807,7 @@
         size += com.google.protobuf.CodedOutputStream
           .computeMessageSize(1, getPayload());
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -6196,8 +6175,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<StreamingOutputCallResponse> PARSER =
-        new com.google.protobuf.AbstractParser<StreamingOutputCallResponse>() {
+    private static final com.google.protobuf.Parser<StreamingOutputCallResponse>
+        PARSER = new com.google.protobuf.AbstractParser<StreamingOutputCallResponse>() {
       public StreamingOutputCallResponse parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
@@ -6266,7 +6245,7 @@
       // @@protoc_insertion_point(message_implements:grpc.testing.ReconnectInfo)
       ReconnectInfoOrBuilder {
     // Use ReconnectInfo.newBuilder() to construct.
-    private ReconnectInfo(com.google.protobuf.GeneratedMessage.Builder builder) {
+    private ReconnectInfo(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
     }
     private ReconnectInfo() {
@@ -6409,9 +6388,8 @@
       }
     }
 
-    private int memoizedSerializedSize = -1;
     public int getSerializedSize() {
-      int size = memoizedSerializedSize;
+      int size = memoizedSize;
       if (size != -1) return size;
 
       size = 0;
@@ -6433,7 +6411,7 @@
         }
         backoffMsMemoizedSerializedSize = dataSize;
       }
-      memoizedSerializedSize = size;
+      memoizedSize = size;
       return size;
     }
 
@@ -6755,8 +6733,8 @@
       return DEFAULT_INSTANCE;
     }
 
-    public static final com.google.protobuf.Parser<ReconnectInfo> PARSER =
-        new com.google.protobuf.AbstractParser<ReconnectInfo>() {
+    private static final com.google.protobuf.Parser<ReconnectInfo>
+        PARSER = new com.google.protobuf.AbstractParser<ReconnectInfo>() {
       public ReconnectInfo parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
diff --git a/protobuf/src/test/java/io/grpc/protobuf/ProtoUtilsTest.java b/protobuf/src/test/java/io/grpc/protobuf/ProtoUtilsTest.java
index c06d9e0..c1b3780 100644
--- a/protobuf/src/test/java/io/grpc/protobuf/ProtoUtilsTest.java
+++ b/protobuf/src/test/java/io/grpc/protobuf/ProtoUtilsTest.java
@@ -47,7 +47,7 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
-import java.util.Random;
+import java.util.Arrays;
 
 /** Unit tests for {@link ProtoUtils}. */
 @RunWith(JUnit4.class)
@@ -79,7 +79,7 @@
   public void marshallerShouldNotLimitProtoSize() throws Exception {
     // The default limit is 64MB. Using a larger proto to verify that the limit is not enforced.
     byte[] bigName = new byte[70 * 1024 * 1024];
-    new Random().nextBytes(bigName);
+    Arrays.fill(bigName, (byte) 32);
 
     proto = Type.newBuilder().setNameBytes(ByteString.copyFrom(bigName)).build();