[prev in list] [next in list] [prev in thread] [next in thread]
List: avro-commits
Subject: [avro] branch master updated: AVRO-2377: Remove Reserved Words Initialization Blocks (#507)
From: fokko () apache ! org
Date: 2019-04-24 17:59:46
Message-ID: 155612878644.26000.17909877949489135948 () gitbox ! apache ! org
[Download RAW message or body]
This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/master by this push:
new 0f89cc8 AVRO-2377: Remove Reserved Words Initialization Blocks (#507)
0f89cc8 is described below
commit 0f89cc8e7347fed1f348a33b00b434a6acb4791d
Author: BELUGABEHR <BELUGABEHR@users.noreply.github.com>
AuthorDate: Wed Apr 24 13:59:41 2019 -0400
AVRO-2377: Remove Reserved Words Initialization Blocks (#507)
* AVRO-2377: Remove Reserved Words Initialization Blocks
* Applied spotless
---
.../avro/src/main/java/org/apache/avro/Protocol.java | 19 +++++++------------
.../avro/src/main/java/org/apache/avro/Schema.java | 6 ++----
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/lang/java/avro/src/main/java/org/apache/avro/Protocol.java \
b/lang/java/avro/src/main/java/org/apache/avro/Protocol.java index a2f3a7c..6eed401 \
100644
--- a/lang/java/avro/src/main/java/org/apache/avro/Protocol.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/Protocol.java
@@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets;
import java.io.IOException;
import java.security.MessageDigest;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -70,15 +71,11 @@ public class Protocol extends JsonProperties {
public static final long VERSION = 1;
// Support properties for both Protocol and Message objects
- private static final Set<String> MESSAGE_RESERVED = new HashSet<>();
- static {
- Collections.addAll(MESSAGE_RESERVED, "doc", "response", "request", "errors", \
"one-way");
- }
+ private static final Set<String> MESSAGE_RESERVED = Collections
+ .unmodifiableSet(new HashSet<>(Arrays.asList("doc", "response", "request", \
"errors", "one-way")));
- private static final Set<String> FIELD_RESERVED = new HashSet<>();
- static {
- Collections.addAll(FIELD_RESERVED, "name", "type", "doc", "default", "aliases");
- }
+ private static final Set<String> FIELD_RESERVED = Collections
+ .unmodifiableSet(new HashSet<>(Arrays.asList("name", "type", "doc", "default", \
"aliases")));
/** A protocol message. */
public class Message extends JsonProperties {
@@ -264,10 +261,8 @@ public class Protocol extends JsonProperties {
SYSTEM_ERRORS = Schema.createUnion(errors);
}
- private static final Set<String> PROTOCOL_RESERVED = new HashSet<>();
- static {
- Collections.addAll(PROTOCOL_RESERVED, "namespace", "protocol", "doc", \
"messages", "types", "errors");
- }
+ private static final Set<String> PROTOCOL_RESERVED = Collections
+ .unmodifiableSet(new HashSet<>(Arrays.asList("namespace", "protocol", "doc", \
"messages", "types", "errors")));
private Protocol() {
super(PROTOCOL_RESERVED);
diff --git a/lang/java/avro/src/main/java/org/apache/avro/Schema.java \
b/lang/java/avro/src/main/java/org/apache/avro/Schema.java index 73a094c..29c4a3a \
100644
--- a/lang/java/avro/src/main/java/org/apache/avro/Schema.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/Schema.java
@@ -413,10 +413,8 @@ public abstract class Schema extends JsonProperties {
return (hashCode == other.hashCode) || (hashCode == NO_HASHCODE) || \
(other.hashCode == NO_HASHCODE); }
- private static final Set<String> FIELD_RESERVED = new HashSet<>();
- static {
- Collections.addAll(FIELD_RESERVED, "default", "doc", "name", "order", "type", \
"aliases");
- }
+ private static final Set<String> FIELD_RESERVED = Collections
+ .unmodifiableSet(new HashSet<>(Arrays.asList("default", "doc", "name", \
"order", "type", "aliases")));
/** Returns true if this record is an union type. */
public boolean isUnion() {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic