You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2013/03/04 22:09:00 UTC
svn commit: r1452526 - in /avro/trunk: CHANGES.txt
doc/src/content/xdocs/idl.xml
lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj
lang/java/compiler/src/test/idl/input/simple.avdl
lang/java/compiler/src/test/idl/output/simple.avpr
Author: cutting
Date: Mon Mar 4 21:08:59 2013
New Revision: 1452526
URL: http://svn.apache.org/r1452526
Log:
AVRO-1267. Java: Permit dashes in IDL property names.
Modified:
avro/trunk/CHANGES.txt
avro/trunk/doc/src/content/xdocs/idl.xml
avro/trunk/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj
avro/trunk/lang/java/compiler/src/test/idl/input/simple.avdl
avro/trunk/lang/java/compiler/src/test/idl/output/simple.avpr
Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1452526&r1=1452525&r2=1452526&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Mon Mar 4 21:08:59 2013
@@ -8,6 +8,8 @@ Trunk (not yet released)
AVRO-1260. Ruby: Improve read performance. (Martin Kleppmann via cutting)
+ AVRO-1267. Java: Permit dashes in IDL property names. (cutting)
+
BUG FIXES
Avro 1.7.4 (22 February 2012)
Modified: avro/trunk/doc/src/content/xdocs/idl.xml
URL: http://svn.apache.org/viewvc/avro/trunk/doc/src/content/xdocs/idl.xml?rev=1452526&r1=1452525&r2=1452526&view=diff
==============================================================================
--- avro/trunk/doc/src/content/xdocs/idl.xml (original)
+++ avro/trunk/doc/src/content/xdocs/idl.xml Mon Mar 4 21:08:59 2013
@@ -349,7 +349,7 @@ record MyRecord {
<p>A field's type may also be preceded by annotations, e.g.: </p>
<source>
record MyRecord {
- @java_class("java.util.ArrayList") array<string> myStrings;
+ @java-class("java.util.ArrayList") array<string> myStrings;
}
</source>
<p>Similarly, a <code>@namespace</code> annotation may be used to modify the namespace
Modified: avro/trunk/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj?rev=1452526&r1=1452525&r2=1452526&view=diff
==============================================================================
--- avro/trunk/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj (original)
+++ avro/trunk/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj Mon Mar 4 21:08:59 2013
@@ -971,6 +971,7 @@ TOKEN :
| < AT: "@" >
| < EQUALS: "=" >
| < DOT: "." >
+| < DASH: "-" >
}
TOKEN :
@@ -1272,7 +1273,7 @@ void SchemaProperty(Map<String, JsonNode
JsonNode val;
}
{
- "@" key = Identifier() "(" val = Json() ")"
+ "@" key = PropertyName() "(" val = Json() ")"
{
if (properties.containsKey(key))
throw error("Property '" + key + "' already specified", token);
@@ -1491,6 +1492,19 @@ Schema ResultType():
| schema = Type() { return schema; }
}
+String PropertyName():
+{
+ Token t;
+ StringBuffer name = new StringBuffer();
+}
+{
+ t = <IDENTIFIER> { name.append(t.image); }
+ ( t = <DASH> { name.append(t.image); }
+ t = <IDENTIFIER> { name.append(t.image); }
+ ) *
+ { return name.toString(); }
+}
+
String Identifier():
{
Token t;
Modified: avro/trunk/lang/java/compiler/src/test/idl/input/simple.avdl
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/compiler/src/test/idl/input/simple.avdl?rev=1452526&r1=1452525&r2=1452526&view=diff
==============================================================================
--- avro/trunk/lang/java/compiler/src/test/idl/input/simple.avdl (original)
+++ avro/trunk/lang/java/compiler/src/test/idl/input/simple.avdl Mon Mar 4 21:08:59 2013
@@ -34,7 +34,7 @@ protocol Simple {
fixed MD5(16);
/** A TestRecord. */
- @myProperty({"key":3})
+ @my-property({"key":3})
record TestRecord {
string @order("ignore") name = "foo";
Modified: avro/trunk/lang/java/compiler/src/test/idl/output/simple.avpr
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/compiler/src/test/idl/output/simple.avpr?rev=1452526&r1=1452525&r2=1452526&view=diff
==============================================================================
--- avro/trunk/lang/java/compiler/src/test/idl/output/simple.avpr (original)
+++ avro/trunk/lang/java/compiler/src/test/idl/output/simple.avpr Mon Mar 4 21:08:59 2013
@@ -45,7 +45,7 @@
"type" : "float",
"default" : "-Infinity"
} ],
- "myProperty" : {
+ "my-property" : {
"key" : 3
}
}, {