diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java index 3683fa7a9b..9ed4d534b1 100644 --- a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java +++ b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java @@ -1973,7 +1973,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri * Gets the descriptor for an extension. The implementation depends on whether the extension is * scoped in the top level of a file or scoped in a Message. */ - static interface ExtensionDescriptorRetriever { + interface ExtensionDescriptorRetriever { FieldDescriptor getDescriptor(); } @@ -2193,18 +2193,12 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri Object getRaw(GeneratedMessageV3 message); - Object getRaw(GeneratedMessageV3.Builder builder); - void set(Builder builder, Object value); Object getRepeated(GeneratedMessageV3 message, int index); Object getRepeated(GeneratedMessageV3.Builder builder, int index); - Object getRepeatedRaw(GeneratedMessageV3 message, int index); - - Object getRepeatedRaw(GeneratedMessageV3.Builder builder, int index); - void setRepeated(Builder builder, int index, Object value); void addRepeated(Builder builder, Object value); @@ -2323,14 +2317,14 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri } private static final class ReflectionInvoker implements MethodInvoker { - protected final Method getMethod; - protected final Method getMethodBuilder; - protected final Method setMethod; - protected final Method hasMethod; - protected final Method hasMethodBuilder; - protected final Method clearMethod; - protected final Method caseMethod; - protected final Method caseMethodBuilder; + private final Method getMethod; + private final Method getMethodBuilder; + private final Method setMethod; + private final Method hasMethod; + private final Method hasMethodBuilder; + private final Method clearMethod; + private final Method caseMethod; + private final Method caseMethodBuilder; ReflectionInvoker( final FieldDescriptor descriptor, @@ -2456,11 +2450,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri return get(message); } - @Override - public Object getRaw(GeneratedMessageV3.Builder builder) { - return get(builder); - } - @Override public void set(final Builder builder, final Object value) { invoker.set(builder, value); @@ -2476,18 +2465,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri throw new UnsupportedOperationException("getRepeatedField() called on a singular field."); } - @Override - public Object getRepeatedRaw(final GeneratedMessageV3 message, final int index) { - throw new UnsupportedOperationException( - "getRepeatedFieldRaw() called on a singular field."); - } - - @Override - public Object getRepeatedRaw(GeneratedMessageV3.Builder builder, int index) { - throw new UnsupportedOperationException( - "getRepeatedFieldRaw() called on a singular field."); - } - @Override public void setRepeated(final Builder builder, final int index, final Object value) { throw new UnsupportedOperationException("setRepeatedField() called on a singular field."); @@ -2690,11 +2667,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri return get(message); } - @Override - public Object getRaw(GeneratedMessageV3.Builder builder) { - return get(builder); - } - @Override public void set(final Builder builder, final Object value) { // Add all the elements individually. This serves two purposes: @@ -2717,16 +2689,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri return invoker.getRepeated(builder, index); } - @Override - public Object getRepeatedRaw(GeneratedMessageV3 message, int index) { - return getRepeated(message, index); - } - - @Override - public Object getRepeatedRaw(GeneratedMessageV3.Builder builder, int index) { - return getRepeated(builder, index); - } - @Override public void setRepeated(final Builder builder, final int index, final Object value) { invoker.setRepeated(builder, index, value); @@ -2842,11 +2804,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri return get(message); } - @Override - public Object getRaw(GeneratedMessageV3.Builder builder) { - return get(builder); - } - @Override public void set(Builder builder, Object value) { clear(builder); @@ -2865,16 +2822,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri return getMapField(builder).getList().get(index); } - @Override - public Object getRepeatedRaw(GeneratedMessageV3 message, int index) { - return getRepeated(message, index); - } - - @Override - public Object getRepeatedRaw(Builder builder, int index) { - return getRepeated(builder, index); - } - @Override public void setRepeated(Builder builder, int index, Object value) { getMutableMapField(builder).getMutableList().set(index, coerceType((Message) value)); @@ -3115,13 +3062,11 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri final String containingOneofCamelCaseName) { super(descriptor, camelCaseName, messageClass, builderClass, containingOneofCamelCaseName); getBytesMethod = getMethodOrDie(messageClass, "get" + camelCaseName + "Bytes"); - getBytesMethodBuilder = getMethodOrDie(builderClass, "get" + camelCaseName + "Bytes"); setBytesMethodBuilder = getMethodOrDie(builderClass, "set" + camelCaseName + "Bytes", ByteString.class); } private final Method getBytesMethod; - private final Method getBytesMethodBuilder; private final Method setBytesMethodBuilder; @Override @@ -3129,11 +3074,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri return invokeOrDie(getBytesMethod, message); } - @Override - public Object getRaw(GeneratedMessageV3.Builder builder) { - return invokeOrDie(getBytesMethodBuilder, builder); - } - @Override public void set(GeneratedMessageV3.Builder builder, Object value) { if (value instanceof ByteString) {