[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16693973#comment-16693973 ] ASF subversion and git services commented on AVRO-1658: --- Commit 619c6c0bf5b3440cfe80fff8b1c399b91d1d69db in avro's branch refs/heads/master from rstata [ https://gitbox.apache.org/repos/asf?p=avro.git;h=619c6c0 ] AVRO-1658 Added Javadoc to AvroDoc.java, which was missing on initial commit. > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Apache Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Raymie Stata >Priority: Major > Labels: reflection > Fix For: 1.9.0 > > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16693972#comment-16693972 ] ASF GitHub Bot commented on AVRO-1658: -- dkulp closed pull request #388: AVRO-1658 Added license to AvroDoc.java URL: https://github.com/apache/avro/pull/388 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroDoc.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroDoc.java index 7b46a476b..7226a02cc 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroDoc.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroDoc.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.avro.reflect; import java.lang.annotation.ElementType; This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Apache Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Raymie Stata >Priority: Major > Labels: reflection > Fix For: 1.9.0 > > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16693948#comment-16693948 ] ASF GitHub Bot commented on AVRO-1658: -- rstata opened a new pull request #388: AVRO-1658 Added license to AvroDoc.java URL: https://github.com/apache/avro/pull/388 License file for org.apache.avro.reflect.AvroDoc was missing a license, breaking the build. This patch adds the standard lic header. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Apache Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Raymie Stata >Priority: Major > Labels: reflection > Fix For: 1.9.0 > > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16693754#comment-16693754 ] ASF GitHub Bot commented on AVRO-1658: -- dkulp closed pull request #189: AVRO-1658: Java: Add reflection annotation @AvroDoc. URL: https://github.com/apache/avro/pull/189 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroDoc.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroDoc.java new file mode 100644 index 0..7b46a476b --- /dev/null +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroDoc.java @@ -0,0 +1,17 @@ +package org.apache.avro.reflect; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Sets the avrodoc for this java field. + * When reading into this class, a reflectdatumreader + * looks for a schema field with the avrodoc. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.FIELD}) +public @interface AvroDoc { + String value(); +} diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java index eb9f5fb0f..29f2acf71 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java @@ -572,6 +572,8 @@ protected Schema createSchema(Type type, Map names) { String fullName = c.getName(); Schema schema = names.get(fullName); if (schema == null) { +AvroDoc annotatedDoc = c.getAnnotation(AvroDoc.class);// Docstring +String doc = (annotatedDoc != null) ? annotatedDoc.value() : null; String name = c.getSimpleName(); String space = c.getPackage() == null ? "" : c.getPackage().getName(); if (c.getEnclosingClass() != null) // nested class @@ -588,18 +590,18 @@ protected Schema createSchema(Type type, Map names) { Enum[] constants = (Enum[])c.getEnumConstants(); for (int i = 0; i < constants.length; i++) symbols.add(constants[i].name()); - schema = Schema.createEnum(name, null /* doc */, space, symbols); + schema = Schema.createEnum(name, doc, space, symbols); consumeAvroAliasAnnotation(c, schema); } else if (GenericFixed.class.isAssignableFrom(c)) { // fixed int size = c.getAnnotation(FixedSize.class).value(); - schema = Schema.createFixed(name, null /* doc */, space, size); + schema = Schema.createFixed(name, doc, space, size); consumeAvroAliasAnnotation(c, schema); } else if (IndexedRecord.class.isAssignableFrom(c)) { // specific return super.createSchema(type, names); } else { // record List fields = new ArrayList(); boolean error = Throwable.class.isAssignableFrom(c); - schema = Schema.createRecord(name, null /* doc */, space, error); + schema = Schema.createRecord(name, doc, space, error); consumeAvroAliasAnnotation(c, schema); names.put(c.getName(), schema); for (Field field : getCachedFields(c)) @@ -611,6 +613,8 @@ protected Schema createSchema(Type type, Map names) { JsonNode defaultValue = (defaultAnnotation == null) ? null : Schema.parseJson(defaultAnnotation.value()); + annotatedDoc = field.getAnnotation(AvroDoc.class);// Docstring + doc = (annotatedDoc != null) ? annotatedDoc.value() : null; if (defaultValue == null && fieldSchema.getType() == Schema.Type.UNION) { @@ -624,7 +628,7 @@ protected Schema createSchema(Type type, Map names) { ? annotatedName.value() : field.getName(); Schema.Field recordField -= new Schema.Field(fieldName, fieldSchema, null, defaultValue); += new Schema.Field(fieldName, fieldSchema, doc, defaultValue); AvroMeta meta = field.getAnnotation(AvroMeta.class); // add metadata if (meta != null) diff --git a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java index afe7f08ae..ddca2f9bb 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java +++ b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java @@
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16693753#comment-16693753 ] ASF subversion and git services commented on AVRO-1658: --- Commit 01a347e996a20406b0bf13026dd375725c4efb7f in avro's branch refs/heads/master from [~aeroevan] [ https://gitbox.apache.org/repos/asf?p=avro.git;h=01a347e ] AVRO-1658: Java: Add reflection annotation @AvroDoc. @AvroMeta can be used for other keys, but doc is passed into the field's constructor. Patch 2: @AvroDoc should work for class-level documentation too. Closes #189 > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Apache Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun >Priority: Major > Labels: reflection > Fix For: 1.9.0 > > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16641872#comment-16641872 ] ASF GitHub Bot commented on AVRO-1658: -- Hillkorn edited a comment on issue #189: AVRO-1658: Java: Add reflection annotation @AvroDoc. URL: https://github.com/apache/avro/pull/189#issuecomment-427846348 In Jira https://issues.apache.org/jira/browse/AVRO-1658?focusedCommentId=16130729=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16130729 he wants to have unit tests for class level avro doc and as I see in the changes he covers them See https://github.com/apache/avro/pull/189/files#diff-f12fe0e1e72a3f7235da43f8c631bafcR1110 for the test and https://github.com/apache/avro/pull/189/files#diff-f12fe0e1e72a3f7235da43f8c631bafcR1126 where it is checked. Is still something missing? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun >Priority: Major > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16641871#comment-16641871 ] ASF GitHub Bot commented on AVRO-1658: -- Hillkorn commented on issue #189: AVRO-1658: Java: Add reflection annotation @AvroDoc. URL: https://github.com/apache/avro/pull/189#issuecomment-427846348 In Jira https://issues.apache.org/jira/browse/AVRO-1658?focusedCommentId=16130729=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16130729 he wants to have unit tests for class level avro doc tests and as I see in the changes he covers them See https://github.com/apache/avro/pull/189/files#diff-f12fe0e1e72a3f7235da43f8c631bafcR1110 for the test and https://github.com/apache/avro/pull/189/files#diff-f12fe0e1e72a3f7235da43f8c631bafcR1126 where it is checked. Is still something missing? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun >Priority: Major > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16637656#comment-16637656 ] ASF GitHub Bot commented on AVRO-1658: -- erhwenkuo commented on issue #240: AVRO-1658: Java: Add reflection annotation @AvroDoc. URL: https://github.com/apache/avro/pull/240#issuecomment-426847421 Is AVRO-1658 merged yet? Still can't see in 1.8 version. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun >Priority: Major > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16321101#comment-16321101 ] Sebastien Dubois commented on AVRO-1658: Any idea when this could be released? > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16169187#comment-16169187 ] Evan McClain commented on AVRO-1658: Updated the annotation target and unit test in my PR. > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16130729#comment-16130729 ] Doug Cutting commented on AVRO-1658: Shouldn't the unit test also check class-level documentation? At present it looks like it only tests field-level documentation. > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16130329#comment-16130329 ] ASF GitHub Bot commented on AVRO-1658: -- Github user przeemek closed the pull request at: https://github.com/apache/avro/pull/240 > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16130109#comment-16130109 ] ASF GitHub Bot commented on AVRO-1658: -- GitHub user przeemek opened a pull request: https://github.com/apache/avro/pull/240 AVRO-1658: Java: Add reflection annotation @AvroDoc. This is a follow up of Pull-Request https://github.com/apache/avro/pull/189, where all merge conflicts are resolved and the feature is ready for review/merge You can merge this pull request into a Git repository by running: $ git pull https://github.com/przeemek/avro AVRO-1658 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/avro/pull/240.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #240 commit c0f1aa0ec738efcde4f48d48929f1c3d24451acf Author: Evan McClainDate: 2016-07-30T23:47:50Z AVRO-1658: Java: Add reflection annotation @AvroDoc. @AvroMeta can be used for other keys, but doc is passed into the field's constructor. commit e86c002947f3b6463d238e10de85d259a4a52c54 Author: Evan McClain Date: 2017-04-05T02:54:23Z Merge remote-tracking branch 'origin/master' into AVRO-1658 commit deade58297827c4cb467d5be441607cfa1d76c69 Author: Evan McClain Date: 2016-07-30T23:47:50Z AVRO-1658: Java: Add reflection annotation @AvroDoc. @AvroMeta can be used for other keys, but doc is passed into the field's constructor. commit f672635fce9ee8f68fe0da90e61c9b65f70c1fde Author: przwik Date: 2017-08-17T08:40:29Z Merge remote-tracking branch 'origin/AVRO-1658' into AVRO-1658-c Conflicts: lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java commit 1c597512eb2fedc25059349f6d4cc3748299edd1 Author: przwik Date: 2017-08-17T08:43:24Z AVRO-1658 - resolve merge conflicts > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16123468#comment-16123468 ] Nandor Kollar commented on AVRO-1658: - I didn't see any test failure after merging Evan's PR, all unit test passed. I just had to resolve a merge conflict in the test class, the patch looks good to me. > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15956228#comment-15956228 ] Evan McClain commented on AVRO-1658: Just merged in master into my PR, and the unit tests pass for me. It also doesn't look like that test failure is related to this change. > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun >Assignee: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15954514#comment-15954514 ] Suraj Acharya commented on AVRO-1658: - Tests on merging with master are failing. {code} Tests run: 4, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.993 sec <<< FAILURE! - in org.apache.avro.tool.TestSpecificCompilerTool testCompileSchemaTwoFiles(org.apache.avro.tool.TestSpecificCompilerTool) Time elapsed: 0.706 sec <<< FAILURE! org.junit.ComparisonFailure: Found file: target/compiler/output/avro/examples/baseball/Player.java does not match expected file: src/test/compiler/output/Player.java expected:<...Builder other) {[if (other == null) { return new avro.examples.baseball.Player.Builder();} else { return new avro.examples.baseball.Player.Builder(other);} } /** * Creates a new Player RecordBuilder by copying an existing Player instance. * @param other The existing instance to copy. * @return A new Player RecordBuilder */ public static avro.examples.baseball.Player.Builder newBuilder(avro.examples.baseball.Player other) {if (other == null) { return new avro.examples.baseball.Player.Builder();} else { return new avro.examples.baseball.Player.Builder(other);} } /** * RecordBuilder for Player instances. */ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBaseimplements org.apache.avro.data.RecordBuilder {/** The number of the player */ private int number;private java.lang.CharSequence first_name;private java.lang.CharSequence last_name;private java.util.List position;/** Creates a new Builder */private Builder() { super(SCHEMA$);}/** * Creates a Builder by copying an existing Builder. * @param other The existing Builder to copy. */private Builder(avro.examples.baseball.Player.Builder other) { super(other); if (isValidValue(fields()[0], other.number)) {this.number = data().deepCopy(fields()[0].schema(), other.number);fieldSetFlags()[0] = other.fieldSetFlags()[0]; } if (isValidValue(fields()[1], other.first_name)) {this.first_name = data().deepCopy(fields()[1].schema(), other.first_name); fieldSetFlags()[1] = other.fieldSetFlags()[1]; } if (isValidValue(fields()[2], other.last_name)) {this.last_name = data().deepCopy(fields()[2].schema(), other.last_name); fieldSetFlags()[2] = other.fieldSetFlags()[2]; } if (isValidValue(fields()[3], other.position)) {this.position = data().deepCopy(fields()[3].schema(), other.position); fieldSetFlags()[3] = other.fieldSetFlags()[3]; }}/** * Creates a Builder by copying an existing Player instance * @param other The existing instance to copy. */private Builder(avro.examples.baseball.Player other) {] super(SCHEMA$)...> but was:<...Builder other) {[return new avro.examples.baseball.Player.Builder(other); } /** * Creates a new Player RecordBuilder by copying an existing Player instance. * @param other The existing instance to copy. * @return A new Player RecordBuilder */ public static avro.examples.baseball.Player.Builder newBuilder(avro.examples.baseball.Player other) {return new avro.examples.baseball.Player.Builder(other); } /** * RecordBuilder for Player instances. */ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBaseimplements org.apache.avro.data.RecordBuilder {/** The number of the player */ private int number;private java.lang.CharSequence first_name;private java.lang.CharSequence last_name;private java.util.List position;/** Creates a new Builder */private Builder() { super(SCHEMA$);}/** * Creates a Builder by copying an existing Builder. * @param other The existing Builder to copy. */private Builder(avro.examples.baseball.Player.Builder other) { super(other); if (isValidValue(fields()[0], other.number)) {this.number = data().deepCopy(fields()[0].schema(), other.number);fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.first_name)) { this.first_name = data().deepCopy(fields()[1].schema(), other.first_name); fieldSetFlags()[1] = true; } if (isValidValue(fields()[2], other.last_name)) {this.last_name = data().deepCopy(fields()[2].schema(), other.last_name); fieldSetFlags()[2] = true; } if (isValidValue(fields()[3], other.position)) {this.position = data().deepCopy(fields()[3].schema(), other.position);fieldSetFlags()[3] = true; }}/** * Creates a Builder by copying an existing Player instance * @param other The existing instance to copy. */private
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15843796#comment-15843796 ] ASF GitHub Bot commented on AVRO-1658: -- GitHub user aeroevan opened a pull request: https://github.com/apache/avro/pull/189 AVRO-1658: Java: Add reflection annotation @AvroDoc. @AvroMeta can be used for other keys, but doc is passed into the field's constructor. You can merge this pull request into a Git repository by running: $ git pull https://github.com/aeroevan/avro AVRO-1658 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/avro/pull/189.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #189 commit c0f1aa0ec738efcde4f48d48929f1c3d24451acf Author: Evan McClainDate: 2016-07-30T23:47:50Z AVRO-1658: Java: Add reflection annotation @AvroDoc. @AvroMeta can be used for other keys, but doc is passed into the field's constructor. > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15418190#comment-15418190 ] Evan McClain commented on AVRO-1658: Patch that applies cleanly to master: https://github.com/aeroevan/avro/commit/324aac7304fd41d21c79c602ae55f6a51120b2d5 > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch, > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15107181#comment-15107181 ] Ryan Blue commented on AVRO-1658: - [~aeroevan], thanks for picking this up! The patch looks like a good start and I'm happy to see there's a test in there. It looks like it only supports doc strings on fields, but Records, Enums, and Fixed can all have doc strings as well. What do you think about updating your patch to allow AvroDoc to be used with Java classes and enums? > Add avroDoc on reflect > -- > > Key: AVRO-1658 > URL: https://issues.apache.org/jira/browse/AVRO-1658 > Project: Avro > Issue Type: New Feature > Components: java >Affects Versions: 1.7.7 >Reporter: Zhaonan Sun > Labels: reflection > Attachments: > 0001-AVRO-1658-Java-Add-reflection-annotation-AvroDoc.patch > > > Looks like @AvroMeta can't add reserved fields, like @AvroMeta("doc", "some > doc") will have exceptions. > I would be greate if we have a @AvroDoc("some documentations") in > org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (AVRO-1658) Add avroDoc on reflect
[ https://issues.apache.org/jira/browse/AVRO-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14395191#comment-14395191 ] Ryan Blue commented on AVRO-1658: - Thanks for opening this [~sunzhaonan]! If you're also interested in working on it, let me know if you need help. Add avroDoc on reflect -- Key: AVRO-1658 URL: https://issues.apache.org/jira/browse/AVRO-1658 Project: Avro Issue Type: New Feature Components: java Reporter: Zhaonan Sun Looks like @AvroMeta can't add reserved fields, like @AvroMeta(doc, some doc) will have exceptions. I would be greate if we have a @AvroDoc(some documentations) in org.apache.avro.reflect -- This message was sent by Atlassian JIRA (v6.3.4#6332)