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 2010/08/17 21:35:26 UTC

svn commit: r986461 - in /avro/trunk: CHANGES.txt lang/java/src/java/org/apache/avro/specific/SpecificCompiler.java

Author: cutting
Date: Tue Aug 17 19:35:25 2010
New Revision: 986461

URL: http://svn.apache.org/viewvc?rev=986461&view=rev
Log:
AVRO-616. Java: Add a comment to generated source files noting that they should not be edited.  Contributed by Patrick Wendell.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/src/java/org/apache/avro/specific/SpecificCompiler.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=986461&r1=986460&r2=986461&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Tue Aug 17 19:35:25 2010
@@ -115,6 +115,9 @@ Avro 1.4.0 (unreleased)
     AVRO-586. Java: Permit specification of MapReduce output file
     metadata properties. (Ken Krugler via cutting)
 
+    AVRO-616. Java: Add comment to generated source files noting that
+    they should not be edited. (Patrick Wendell via cutting)
+
   BUG FIXES
 
     AVRO-502. Memory leak from parsing JSON schema.

Modified: avro/trunk/lang/java/src/java/org/apache/avro/specific/SpecificCompiler.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/java/org/apache/avro/specific/SpecificCompiler.java?rev=986461&r1=986460&r2=986461&view=diff
==============================================================================
--- avro/trunk/lang/java/src/java/org/apache/avro/specific/SpecificCompiler.java (original)
+++ avro/trunk/lang/java/src/java/org/apache/avro/specific/SpecificCompiler.java Tue Aug 17 19:35:25 2010
@@ -57,7 +57,13 @@ public class SpecificCompiler {
           "super", "switch", "synchronized", "this", "throw", "throws",
           "transient", "true", "try", "void", "volatile", "while"
         }));
-
+  private static final String FILE_HEADER = 
+      "/**\n" +
+      " * Autogenerated by Avro\n" +
+      " * \n" +
+      " * DO NOT EDIT DIRECTLY\n" +
+      " */\n";
+  
   public SpecificCompiler(Protocol protocol) {
     // enqueue all types
     for (Schema s : protocol.getTypes()) {
@@ -89,6 +95,7 @@ public class SpecificCompiler {
       f.getParentFile().mkdirs();
       FileWriter fw = new FileWriter(f);
       try {
+        fw.write(FILE_HEADER);
         fw.write(contents);
       } finally {
         fw.close();