aboutsummaryrefslogtreecommitdiff
path: root/java/src/main
diff options
context:
space:
mode:
authorFeng Xiao <xfxyjwf@gmail.com>2014-10-01 18:26:48 -0700
committerFeng Xiao <xfxyjwf@gmail.com>2014-10-01 18:26:48 -0700
commitf5691a617ee2e72bac6a0eb97764497a223702d9 (patch)
tree08049c3969b158a8c716cc09260c07e0cb5fdbf2 /java/src/main
parent61477681710871dab2a5832d0d6324aa9b7d7867 (diff)
downloadprotobuf-f5691a617ee2e72bac6a0eb97764497a223702d9.tar.gz
protobuf-f5691a617ee2e72bac6a0eb97764497a223702d9.tar.bz2
protobuf-f5691a617ee2e72bac6a0eb97764497a223702d9.zip
Fix descriptor validation logic for packed enum fields.
Diffstat (limited to 'java/src/main')
-rw-r--r--java/src/main/java/com/google/protobuf/Descriptors.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/java/src/main/java/com/google/protobuf/Descriptors.java b/java/src/main/java/com/google/protobuf/Descriptors.java
index 3dd49c64..caae0f77 100644
--- a/java/src/main/java/com/google/protobuf/Descriptors.java
+++ b/java/src/main/java/com/google/protobuf/Descriptors.java
@@ -1103,13 +1103,6 @@ public final class Descriptors {
"Field numbers must be positive integers.");
}
- // Only repeated primitive fields may be packed.
- if (proto.getOptions().getPacked() && !isPackable()) {
- throw new DescriptorValidationException(this,
- "[packed = true] can only be specified for repeated primitive " +
- "fields.");
- }
-
if (isExtension) {
if (!proto.hasExtendee()) {
throw new DescriptorValidationException(this,
@@ -1218,6 +1211,13 @@ public final class Descriptors {
}
}
+ // Only repeated primitive fields may be packed.
+ if (proto.getOptions().getPacked() && !isPackable()) {
+ throw new DescriptorValidationException(this,
+ "[packed = true] can only be specified for repeated primitive " +
+ "fields.");
+ }
+
// We don't attempt to parse the default value until here because for
// enums we need the enum type's descriptor.
if (proto.hasDefaultValue()) {