avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject [avro] branch master updated: AVRO-2132: Allow dots in IDL property names. (kdrakon via cutting)
Date Thu, 22 Feb 2018 19:24:22 GMT
This is an automated email from the ASF dual-hosted git repository.

cutting 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 9c200c9  AVRO-2132: Allow dots in IDL property names. (kdrakon via cutting)
9c200c9 is described below

commit 9c200c993147dd3ac0b5f6ed94b558ad863d7c18
Author: Doug Cutting <cutting@apache.org>
AuthorDate: Thu Feb 22 11:22:10 2018 -0800

    AVRO-2132: Allow dots in IDL property names. (kdrakon via cutting)
---
 CHANGES.txt                                                       | 2 ++
 .../compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj  | 2 ++
 lang/java/compiler/src/test/idl/input/simple.avdl                 | 3 +++
 lang/java/compiler/src/test/idl/output/simple.avpr                | 8 +++++++-
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index e7d63ee..faea72c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -32,6 +32,8 @@ Trunk (not yet released)
     AVRO-1932: Java: Allow setting the SchemaStore on generated classes. 
     (Niels Basjes)
 
+    AVRO-2132: Allow dots in IDL property names. (kdrakon via cutting)
+
   OPTIMIZATIONS
 
   IMPROVEMENTS
diff --git a/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj b/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj
index 4213210..7de123e 100644
--- a/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj
+++ b/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj
@@ -1528,6 +1528,8 @@ String PropertyName():
 {
   t = <IDENTIFIER>   { name.append(t.image); }
   ( t = <DASH>       { name.append(t.image); }
+    t = <IDENTIFIER> { name.append(t.image); } |
+    t = <DOT>        { name.append(t.image); }
     t = <IDENTIFIER> { name.append(t.image); }
   ) *
   { return name.toString(); }
diff --git a/lang/java/compiler/src/test/idl/input/simple.avdl b/lang/java/compiler/src/test/idl/input/simple.avdl
index 37aed9e..1bfcd7b 100644
--- a/lang/java/compiler/src/test/idl/input/simple.avdl
+++ b/lang/java/compiler/src/test/idl/input/simple.avdl
@@ -49,6 +49,9 @@ protocol Simple {
     float average = -Infinity;
     date d = 0;
     time_ms t = 0;
+
+    @foo.bar("bar.foo") long l;
+    union {null, @foo.foo.bar(42) @foo.foo.foo("3foo") string} nested_properties;
   }
 
   error TestError {
diff --git a/lang/java/compiler/src/test/idl/output/simple.avpr b/lang/java/compiler/src/test/idl/output/simple.avpr
index c3e18e2..f400307 100644
--- a/lang/java/compiler/src/test/idl/output/simple.avpr
+++ b/lang/java/compiler/src/test/idl/output/simple.avpr
@@ -54,7 +54,13 @@
       "name": "t",
       "type": {"type": "int", "logicalType": "time-millis"},
       "default": 0
-    } ],
+    } , {
+      "name": "l",
+      "type": {"type": "long", "foo.bar": "bar.foo"}
+    } , {
+      "name": "nested_properties",
+      "type": [ "null" , {"type":"string", "foo.foo.bar": 42, "foo.foo.foo": "3foo"} ]
+    }],
     "my-property" : {
       "key" : 3
     }

-- 
To stop receiving notification emails like this one, please contact
cutting@apache.org.

Mime
View raw message