You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by fo...@apache.org on 2019/07/31 08:37:26 UTC

[avro] branch master updated: AVRO-2491: Deprecate Schema#createRecord from list of fields method (#598)

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

fokko 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 1c5d3ff  AVRO-2491: Deprecate Schema#createRecord from list of fields method (#598)
1c5d3ff is described below

commit 1c5d3ff4ff78551edd4bab9824642d6918d3565d
Author: Ismaël Mejía <ie...@gmail.com>
AuthorDate: Wed Jul 31 10:37:20 2019 +0200

    AVRO-2491: Deprecate Schema#createRecord from list of fields method (#598)
    
    This method should be removed in the future because it allows to create
    invalid schemas (without name) that are not Parseable by Avro.
---
 .gitignore                                               |  2 ++
 lang/java/avro/src/main/java/org/apache/avro/Schema.java | 11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 5cbf6d9..19b5616 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,5 @@ test-output
 /lang/java/compiler/nb-configuration.xml
 /lang/java/compiler/nbproject/
 **/.vscode/**/*
+.factorypath
+
diff --git a/lang/java/avro/src/main/java/org/apache/avro/Schema.java b/lang/java/avro/src/main/java/org/apache/avro/Schema.java
index abf2b75..65bea4d 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/Schema.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/Schema.java
@@ -191,7 +191,16 @@ public abstract class Schema extends JsonProperties implements Serializable {
     this.logicalType = logicalType;
   }
 
-  /** Create an anonymous record schema. */
+  /**
+   * Create an anonymous record schema.
+   *
+   * @deprecated This method allows to create Schema objects that cannot be parsed
+   *             by {@link Schema.Parser#parse(String)}. It will be removed in a
+   *             future version of Avro. Better use
+   *             i{@link #createRecord(String, String, String, boolean, List)} to
+   *             produce a fully qualified Schema.
+   */
+  @Deprecated
   public static Schema createRecord(List<Field> fields) {
     Schema result = createRecord(null, null, null, false);
     result.setFields(fields);