Repository: avro
Updated Branches:
  refs/heads/master 33d495840 -> 27cb9e271


AVRO-1913: No warnings in the generated Java code.


Project: http://git-wip-us.apache.org/repos/asf/avro/repo
Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/4810d48c
Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/4810d48c
Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/4810d48c

Branch: refs/heads/master
Commit: 4810d48cf9643850587e98a1cde17215feb24655
Parents: 33d4958
Author: Niels Basjes <nbas...@bol.com>
Authored: Thu Sep 15 10:18:05 2016 +0200
Committer: Niels Basjes <nbas...@bol.com>
Committed: Thu Sep 15 10:18:05 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                            |  2 ++
 .../java/org/apache/avro/FooBarSpecificRecord.java     |  4 ++--
 .../compiler/specific/templates/java/classic/fixed.vm  |  4 ++--
 .../compiler/specific/templates/java/classic/record.vm | 13 +++++++++----
 .../output-string/avro/examples/baseball/Player.java   | 11 +++++++----
 lang/java/tools/src/test/compiler/output/Player.java   | 11 +++++++----
 6 files changed, 29 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/avro/blob/4810d48c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index b5818cc..365c6bd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -56,6 +56,8 @@ Trunk (not yet released)
 
     AVRO-1900: Java: Remove dev-tools to fix Java build. (blue)
 
+    AVRO-1913: No warnings in the generated Java code. (Niels Basjes)
+
 Avro 1.8.1 (14 May 2016)
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/avro/blob/4810d48c/lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java
----------------------------------------------------------------------
diff --git 
a/lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java 
b/lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java
index babcd36..bab3620 100644
--- a/lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java
+++ b/lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java
@@ -373,7 +373,7 @@ public class FooBarSpecificRecord extends 
org.apache.avro.specific.SpecificRecor
   }
 
   private static final org.apache.avro.io.DatumWriter
-    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
+    WRITER$ = new 
org.apache.avro.specific.SpecificDatumWriter<FooBarSpecificRecord>(SCHEMA$);
 
   @Override public void writeExternal(java.io.ObjectOutput out)
     throws java.io.IOException {
@@ -381,7 +381,7 @@ public class FooBarSpecificRecord extends 
org.apache.avro.specific.SpecificRecor
   }
 
   private static final org.apache.avro.io.DatumReader
-    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
+    READER$ = new 
org.apache.avro.specific.SpecificDatumReader<FooBarSpecificRecord>(SCHEMA$);
 
   @Override public void readExternal(java.io.ObjectInput in)
     throws java.io.IOException {

http://git-wip-us.apache.org/repos/asf/avro/blob/4810d48c/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm
----------------------------------------------------------------------
diff --git 
a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm
 
b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm
index b19e1b1..b06854e 100644
--- 
a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm
+++ 
b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm
@@ -47,7 +47,7 @@ public class ${this.mangle($schema.getName())} extends 
org.apache.avro.specific.
   }
 
   private static final org.apache.avro.io.DatumWriter
-    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
+    WRITER$ = new 
org.apache.avro.specific.SpecificDatumWriter<${this.mangle($schema.getName())}>(SCHEMA$);
 
   @Override public void writeExternal(java.io.ObjectOutput out)
     throws java.io.IOException {
@@ -55,7 +55,7 @@ public class ${this.mangle($schema.getName())} extends 
org.apache.avro.specific.
   }
 
   private static final org.apache.avro.io.DatumReader
-    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
+    READER$ = new 
org.apache.avro.specific.SpecificDatumReader<${this.mangle($schema.getName())}>(SCHEMA$);
 
   @Override public void readExternal(java.io.ObjectInput in)
     throws java.io.IOException {

http://git-wip-us.apache.org/repos/asf/avro/blob/4810d48c/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
----------------------------------------------------------------------
diff --git 
a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
 
b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
index 1170d79..15ea734 100644
--- 
a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
+++ 
b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
@@ -20,8 +20,10 @@ package $schema.getNamespace();
 #end
 
 import org.apache.avro.specific.SpecificData;
+#if (!$schema.isError())
 import org.apache.avro.message.BinaryMessageEncoder;
 import org.apache.avro.message.BinaryMessageDecoder;
+#end
 
 @SuppressWarnings("all")
 #if ($schema.getDoc())
@@ -399,6 +401,7 @@ public class ${this.mangle($schema.getName())}#if 
($schema.isError()) extends or
 
 #end
     @Override
+    @SuppressWarnings("unchecked")
     public ${this.mangle($schema.getName())} build() {
       try {
         ${this.mangle($schema.getName())} record = new 
${this.mangle($schema.getName())}(#if ($schema.isError())getValue(), 
getCause()#end);
@@ -428,16 +431,18 @@ public class ${this.mangle($schema.getName())}#if 
($schema.isError()) extends or
     }
   }
 
-  private static final org.apache.avro.io.DatumWriter
-    WRITER$ = MODEL$.createDatumWriter(SCHEMA$);
+  @SuppressWarnings("unchecked")
+  private static final 
org.apache.avro.io.DatumWriter<${this.mangle($schema.getName())}>
+    WRITER$ = 
(org.apache.avro.io.DatumWriter<${this.mangle($schema.getName())}>)MODEL$.createDatumWriter(SCHEMA$);
 
   @Override public void writeExternal(java.io.ObjectOutput out)
     throws java.io.IOException {
     WRITER$.write(this, SpecificData.getEncoder(out));
   }
 
-  private static final org.apache.avro.io.DatumReader
-    READER$ = MODEL$.createDatumReader(SCHEMA$);
+  @SuppressWarnings("unchecked")
+  private static final 
org.apache.avro.io.DatumReader<${this.mangle($schema.getName())}>
+    READER$ = 
(org.apache.avro.io.DatumReader<${this.mangle($schema.getName())}>)MODEL$.createDatumReader(SCHEMA$);
 
   @Override public void readExternal(java.io.ObjectInput in)
     throws java.io.IOException {

http://git-wip-us.apache.org/repos/asf/avro/blob/4810d48c/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
----------------------------------------------------------------------
diff --git 
a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
 
b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
index 89b4af8..557868a 100644
--- 
a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
+++ 
b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
@@ -403,6 +403,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public Player build() {
       try {
         Player record = new Player();
@@ -417,16 +418,18 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     }
   }
 
-  private static final org.apache.avro.io.DatumWriter
-    WRITER$ = MODEL$.createDatumWriter(SCHEMA$);
+  @SuppressWarnings("unchecked")
+  private static final org.apache.avro.io.DatumWriter<Player>
+    WRITER$ = 
(org.apache.avro.io.DatumWriter<Player>)MODEL$.createDatumWriter(SCHEMA$);
 
   @Override public void writeExternal(java.io.ObjectOutput out)
     throws java.io.IOException {
     WRITER$.write(this, SpecificData.getEncoder(out));
   }
 
-  private static final org.apache.avro.io.DatumReader
-    READER$ = MODEL$.createDatumReader(SCHEMA$);
+  @SuppressWarnings("unchecked")
+  private static final org.apache.avro.io.DatumReader<Player>
+    READER$ = 
(org.apache.avro.io.DatumReader<Player>)MODEL$.createDatumReader(SCHEMA$);
 
   @Override public void readExternal(java.io.ObjectInput in)
     throws java.io.IOException {

http://git-wip-us.apache.org/repos/asf/avro/blob/4810d48c/lang/java/tools/src/test/compiler/output/Player.java
----------------------------------------------------------------------
diff --git a/lang/java/tools/src/test/compiler/output/Player.java 
b/lang/java/tools/src/test/compiler/output/Player.java
index bfd3d07..589ec2a 100644
--- a/lang/java/tools/src/test/compiler/output/Player.java
+++ b/lang/java/tools/src/test/compiler/output/Player.java
@@ -403,6 +403,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public Player build() {
       try {
         Player record = new Player();
@@ -417,16 +418,18 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     }
   }
 
-  private static final org.apache.avro.io.DatumWriter
-    WRITER$ = MODEL$.createDatumWriter(SCHEMA$);
+  @SuppressWarnings("unchecked")
+  private static final org.apache.avro.io.DatumWriter<Player>
+    WRITER$ = 
(org.apache.avro.io.DatumWriter<Player>)MODEL$.createDatumWriter(SCHEMA$);
 
   @Override public void writeExternal(java.io.ObjectOutput out)
     throws java.io.IOException {
     WRITER$.write(this, SpecificData.getEncoder(out));
   }
 
-  private static final org.apache.avro.io.DatumReader
-    READER$ = MODEL$.createDatumReader(SCHEMA$);
+  @SuppressWarnings("unchecked")
+  private static final org.apache.avro.io.DatumReader<Player>
+    READER$ = 
(org.apache.avro.io.DatumReader<Player>)MODEL$.createDatumReader(SCHEMA$);
 
   @Override public void readExternal(java.io.ObjectInput in)
     throws java.io.IOException {

Reply via email to