This is an automated email from the ASF dual-hosted git repository.

dkulp 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 c1abf35  Change the default for generated fields to "private" so we 
aren't generated @Deprecated code by default
c1abf35 is described below

commit c1abf35eec063f582da2551bc9121ae0beee65f5
Author: Daniel Kulp <[email protected]>
AuthorDate: Thu Mar 28 11:47:23 2019 -0400

    Change the default for generated fields to "private" so we aren't generated 
@Deprecated code by default
---
 .../avro/compiler/specific/SpecificCompiler.java   |  2 +-
 .../compiler/specific/TestSpecificCompiler.java    |  1 +
 .../compiler/specific/TestSpecificCompiler.java    |  6 ++---
 .../org/apache/avro/mojo/AbstractAvroMojo.java     |  4 ++--
 .../avro/examples/baseball/Player.java             | 26 ++++++++++++++++++----
 .../tools/src/test/compiler/output/Player.java     | 26 ++++++++++++++++++----
 6 files changed, 51 insertions(+), 14 deletions(-)

diff --git 
a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
 
b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
index 3ea7893..2031b05 100644
--- 
a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
+++ 
b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
@@ -126,7 +126,7 @@ public class SpecificCompiler {
   private Protocol protocol;
   private VelocityEngine velocityEngine;
   private String templateDir;
-  private FieldVisibility fieldVisibility = FieldVisibility.PUBLIC_DEPRECATED;
+  private FieldVisibility fieldVisibility = FieldVisibility.PRIVATE;
   private boolean createOptionalGetters = false;
   private boolean gettersReturnOptional = false;
   private boolean createSetters = true;
diff --git 
a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
 
b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
index d6fb7f0..2af462e 100644
--- 
a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
+++ 
b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
@@ -231,6 +231,7 @@ public class TestSpecificCompiler {
   @Test
   public void testPublicDeprecatedFieldVisibility() throws IOException {
     SpecificCompiler compiler = createCompiler();
+    
compiler.setFieldVisibility(SpecificCompiler.FieldVisibility.PUBLIC_DEPRECATED);
     assertTrue(compiler.deprecatedFields());
     assertTrue(compiler.publicFields());
     assertFalse(compiler.privateFields());
diff --git 
a/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
 
b/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
index 4866190..84edb58 100644
--- 
a/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
+++ 
b/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
@@ -114,7 +114,7 @@ public class TestSpecificCompiler {
     String protocol = i.next().contents;
 
     assertTrue(errType.contains("public class finally$ extends 
org.apache.avro.specific.SpecificExceptionBase"));
-    assertTrue(errType.contains("public boolean catch$;"));
+    assertTrue(errType.contains("private boolean catch$;"));
 
     assertTrue(protocol.contains("java.lang.CharSequence 
goto$(java.lang.CharSequence break$)"));
     assertTrue(protocol.contains("public interface default$"));
@@ -138,7 +138,7 @@ public class TestSpecificCompiler {
     assertEquals(1, outputs.size());
     String contents = outputs.iterator().next().contents;
 
-    assertTrue(contents.contains("public java.lang.CharSequence package$;"));
+    assertTrue(contents.contains("private java.lang.CharSequence package$;"));
     assertTrue(contents.contains("class volatile$ extends"));
     assertTrue(contents.contains("volatile$ short$;"));
 
@@ -253,7 +253,7 @@ public class TestSpecificCompiler {
 
   /**
    * Creates a record with the given name, error status, and fields.
-   * 
+   *
    * @param name    the name of the schema.
    * @param isError true if the schema represents an error; false otherwise.
    * @param fields  the field(s) to add to the schema.
diff --git 
a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
 
b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
index d385200..0bbc137 100644
--- 
a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
+++ 
b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
@@ -81,7 +81,7 @@ public abstract class AbstractAvroMojo extends AbstractMojo {
    * A list of files or directories that should be compiled first thus making 
them
    * importable by subsequently compiled schemas. Note that imported files 
should
    * not reference each other.
-   * 
+   *
    * @parameter
    */
   protected String[] imports;
@@ -266,7 +266,7 @@ public abstract class AbstractAvroMojo extends AbstractMojo 
{
       String upper = String.valueOf(this.fieldVisibility).trim().toUpperCase();
       return SpecificCompiler.FieldVisibility.valueOf(upper);
     } catch (IllegalArgumentException e) {
-      return SpecificCompiler.FieldVisibility.PUBLIC_DEPRECATED;
+      return SpecificCompiler.FieldVisibility.PRIVATE;
     }
   }
 
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 483479e..bd373ac 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
@@ -73,10 +73,10 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
   }
 
   /** The number of the player */
-  @Deprecated public int number;
-  @Deprecated public java.lang.String first_name;
-  @Deprecated public java.lang.String last_name;
-  @Deprecated public java.util.List<avro.examples.baseball.Position> position;
+   private int number;
+   private java.lang.String first_name;
+   private java.lang.String last_name;
+   private java.util.List<avro.examples.baseball.Position> position;
 
   /**
    * Default constructor.  Note that this does not initialize fields
@@ -132,6 +132,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     return number;
   }
 
+
   /**
    * Sets the value of the 'number' field.
    * The number of the player
@@ -149,6 +150,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     return first_name;
   }
 
+
   /**
    * Sets the value of the 'first_name' field.
    * @param value the value to set.
@@ -165,6 +167,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     return last_name;
   }
 
+
   /**
    * Sets the value of the 'last_name' field.
    * @param value the value to set.
@@ -181,6 +184,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     return position;
   }
 
+
   /**
    * Sets the value of the 'position' field.
    * @param value the value to set.
@@ -297,6 +301,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
       return number;
     }
 
+
     /**
       * Sets the value of the 'number' field.
       * The number of the player
@@ -338,6 +343,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
       return first_name;
     }
 
+
     /**
       * Sets the value of the 'first_name' field.
       * @param value The value of 'first_name'.
@@ -377,6 +383,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
       return last_name;
     }
 
+
     /**
       * Sets the value of the 'last_name' field.
       * @param value The value of 'last_name'.
@@ -416,6 +423,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
       return position;
     }
 
+
     /**
       * Sets the value of the 'position' field.
       * @param value The value of 'position'.
@@ -574,3 +582,13 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     }
   }
 }
+
+
+
+
+
+
+
+
+
+
diff --git a/lang/java/tools/src/test/compiler/output/Player.java 
b/lang/java/tools/src/test/compiler/output/Player.java
index c8eb70e..642640c 100644
--- a/lang/java/tools/src/test/compiler/output/Player.java
+++ b/lang/java/tools/src/test/compiler/output/Player.java
@@ -73,10 +73,10 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
   }
 
   /** The number of the player */
-  @Deprecated public int number;
-  @Deprecated public java.lang.CharSequence first_name;
-  @Deprecated public java.lang.CharSequence last_name;
-  @Deprecated public java.util.List<avro.examples.baseball.Position> position;
+   private int number;
+   private java.lang.CharSequence first_name;
+   private java.lang.CharSequence last_name;
+   private java.util.List<avro.examples.baseball.Position> position;
 
   /**
    * Default constructor.  Note that this does not initialize fields
@@ -132,6 +132,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     return number;
   }
 
+
   /**
    * Sets the value of the 'number' field.
    * The number of the player
@@ -149,6 +150,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     return first_name;
   }
 
+
   /**
    * Sets the value of the 'first_name' field.
    * @param value the value to set.
@@ -165,6 +167,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     return last_name;
   }
 
+
   /**
    * Sets the value of the 'last_name' field.
    * @param value the value to set.
@@ -181,6 +184,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     return position;
   }
 
+
   /**
    * Sets the value of the 'position' field.
    * @param value the value to set.
@@ -297,6 +301,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
       return number;
     }
 
+
     /**
       * Sets the value of the 'number' field.
       * The number of the player
@@ -338,6 +343,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
       return first_name;
     }
 
+
     /**
       * Sets the value of the 'first_name' field.
       * @param value The value of 'first_name'.
@@ -377,6 +383,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
       return last_name;
     }
 
+
     /**
       * Sets the value of the 'last_name' field.
       * @param value The value of 'last_name'.
@@ -416,6 +423,7 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
       return position;
     }
 
+
     /**
       * Sets the value of the 'position' field.
       * @param value The value of 'position'.
@@ -574,3 +582,13 @@ public class Player extends 
org.apache.avro.specific.SpecificRecordBase implemen
     }
   }
 }
+
+
+
+
+
+
+
+
+
+

Reply via email to