[jira] [Commented] (GROOVY-8242) Javadoc for Newify is missing some attribute values
[ https://issues.apache.org/jira/browse/GROOVY-8242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16115748#comment-16115748 ] Paul King commented on GROOVY-8242: --- Just for historical reference, I don't believe the Groovy compiler will complain for all cases where an annotation attribute has no default and is not supplied with one when not used. There are several cases: # If the annotation and usage are both Groovy I think you will normally see (for the {{value}} annotation attribute as an example): {code} No explicit/default value found for annotation attribute 'value' in @MyAnnotation {code} # If the annotation is Java and it has SOURCE retention, Groovy will keep quiet. # If the annotation is Java and it has RUNTIME retention you will see the JVM complain: {code} java.lang.annotation.IncompleteAnnotationException: MyAnnotation missing element value {code} I suspect that at least the last of these, case (3), is a bug. I presume in earlier versions of the JVM and/or ASM libraries reading a Java annotation with no default value triggered the same check as for Groovy above, case (1), but now it yields a {{ReturnStatement}} containing {{null}} as the return value and this avoids detection. Probably the second is also a bug provided annotation processing is finished which I think will be true since the mandatory attribute check is done during classgen. In any case, it doesn't affect this issue. I.e. the issue is valid and PR good. I'll create an additional issue to track this. > Javadoc for Newify is missing some attribute values > --- > > Key: GROOVY-8242 > URL: https://issues.apache.org/jira/browse/GROOVY-8242 > Project: Groovy > Issue Type: Bug >Reporter: Eric Milles >Assignee: John Wagenleitner >Priority: Minor > Fix For: 2.4.13 > > > I was looking at thw Newify AST transform. Some of the Javadoc appears > incorrect since the annotation requires a value. > {code} > * or this ("Ruby-style"): > * > * {@code @Newify} class MyTreeProcessor { -- Is this supposed to be > @Newify([Tree,Leaf])? > * def myTree = Tree.new(Tree.new(Leaf.new("A"), Leaf.new("B")), > Leaf.new("C")) > * def process() { ... } > * } > * > {code} > {code} > * An example showing how to use the annotation at different levels: > * > * {@code @Newify(auto=false, value=Foo)} > * class Main { > * {@code @Newify} // turn auto on for field -- Is this supposed to be > @Newify(BigInteger)? > * def field1 = java.math.BigInteger.new(42) > * def field2, field3, field4 > * > * {@code @Newify(Bar)} > * def process() { > * field2 = Bar("my bar") > * } > * > * {@code @Newify(Baz)} > * Main() { > * field3 = Foo("my foo") > * field4 = Baz("my baz") > * } > * } > * > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8242) Javadoc for Newify is missing some attribute values
[ https://issues.apache.org/jira/browse/GROOVY-8242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16115613#comment-16115613 ] ASF GitHub Bot commented on GROOVY-8242: Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/579 > Javadoc for Newify is missing some attribute values > --- > > Key: GROOVY-8242 > URL: https://issues.apache.org/jira/browse/GROOVY-8242 > Project: Groovy > Issue Type: Bug >Reporter: Eric Milles >Priority: Minor > > I was looking at thw Newify AST transform. Some of the Javadoc appears > incorrect since the annotation requires a value. > {code} > * or this ("Ruby-style"): > * > * {@code @Newify} class MyTreeProcessor { -- Is this supposed to be > @Newify([Tree,Leaf])? > * def myTree = Tree.new(Tree.new(Leaf.new("A"), Leaf.new("B")), > Leaf.new("C")) > * def process() { ... } > * } > * > {code} > {code} > * An example showing how to use the annotation at different levels: > * > * {@code @Newify(auto=false, value=Foo)} > * class Main { > * {@code @Newify} // turn auto on for field -- Is this supposed to be > @Newify(BigInteger)? > * def field1 = java.math.BigInteger.new(42) > * def field2, field3, field4 > * > * {@code @Newify(Bar)} > * def process() { > * field2 = Bar("my bar") > * } > * > * {@code @Newify(Baz)} > * Main() { > * field3 = Foo("my foo") > * field4 = Baz("my baz") > * } > * } > * > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8242) Javadoc for Newify is missing some attribute values
[ https://issues.apache.org/jira/browse/GROOVY-8242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16115516#comment-16115516 ] ASF GitHub Bot commented on GROOVY-8242: GitHub user jwagenleitner opened a pull request: https://github.com/apache/groovy/pull/579 GROOVY-8242: @Newify default attribute value Class values are only required for Python-style conversions so the attribute should default to an empty array to indicate it is not strictly required. You can merge this pull request into a Git repository by running: $ git pull https://github.com/jwagenleitner/groovy 8242-Newify-value-default Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/579.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 #579 commit e68a7c7ca60e9c6453565bbb91720dfe6479567c Author: John WagenleitnerDate: 2017-08-05T18:05:17Z GROOVY-8242: @Newify default attribute value Class values are only required for Python-style conversions so the attribute should default to an empty array to indicate it is not strictly required. > Javadoc for Newify is missing some attribute values > --- > > Key: GROOVY-8242 > URL: https://issues.apache.org/jira/browse/GROOVY-8242 > Project: Groovy > Issue Type: Bug >Reporter: Eric Milles >Priority: Minor > > I was looking at thw Newify AST transform. Some of the Javadoc appears > incorrect since the annotation requires a value. > {code} > * or this ("Ruby-style"): > * > * {@code @Newify} class MyTreeProcessor { -- Is this supposed to be > @Newify([Tree,Leaf])? > * def myTree = Tree.new(Tree.new(Leaf.new("A"), Leaf.new("B")), > Leaf.new("C")) > * def process() { ... } > * } > * > {code} > {code} > * An example showing how to use the annotation at different levels: > * > * {@code @Newify(auto=false, value=Foo)} > * class Main { > * {@code @Newify} // turn auto on for field -- Is this supposed to be > @Newify(BigInteger)? > * def field1 = java.math.BigInteger.new(42) > * def field2, field3, field4 > * > * {@code @Newify(Bar)} > * def process() { > * field2 = Bar("my bar") > * } > * > * {@code @Newify(Baz)} > * Main() { > * field3 = Foo("my foo") > * field4 = Baz("my baz") > * } > * } > * > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8242) Javadoc for Newify is missing some attribute values
[ https://issues.apache.org/jira/browse/GROOVY-8242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16074068#comment-16074068 ] John Wagenleitner commented on GROOVY-8242: --- As part of the PR for GROOVY-8245 I added a default for the {{value}} attribute. > Javadoc for Newify is missing some attribute values > --- > > Key: GROOVY-8242 > URL: https://issues.apache.org/jira/browse/GROOVY-8242 > Project: Groovy > Issue Type: Bug >Reporter: Eric Milles >Priority: Minor > > I was looking at thw Newify AST transform. Some of the Javadoc appears > incorrect since the annotation requires a value. > {code} > * or this ("Ruby-style"): > * > * {@code @Newify} class MyTreeProcessor { -- Is this supposed to be > @Newify([Tree,Leaf])? > * def myTree = Tree.new(Tree.new(Leaf.new("A"), Leaf.new("B")), > Leaf.new("C")) > * def process() { ... } > * } > * > {code} > {code} > * An example showing how to use the annotation at different levels: > * > * {@code @Newify(auto=false, value=Foo)} > * class Main { > * {@code @Newify} // turn auto on for field -- Is this supposed to be > @Newify(BigInteger)? > * def field1 = java.math.BigInteger.new(42) > * def field2, field3, field4 > * > * {@code @Newify(Bar)} > * def process() { > * field2 = Bar("my bar") > * } > * > * {@code @Newify(Baz)} > * Main() { > * field3 = Foo("my foo") > * field4 = Baz("my baz") > * } > * } > * > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8242) Javadoc for Newify is missing some attribute values
[ https://issues.apache.org/jira/browse/GROOVY-8242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16073882#comment-16073882 ] John Wagenleitner commented on GROOVY-8242: --- Based on the docs and tests, I believe it's clear that the intent of {{Newify}} is to allow the annotation without providing class values. Assuming that's true then this issue should be about providing a default for that attribute in order to avoid warnings. > Javadoc for Newify is missing some attribute values > --- > > Key: GROOVY-8242 > URL: https://issues.apache.org/jira/browse/GROOVY-8242 > Project: Groovy > Issue Type: Bug >Reporter: Eric Milles >Priority: Minor > > I was looking at thw Newify AST transform. Some of the Javadoc appears > incorrect since the annotation requires a value. > {code} > * or this ("Ruby-style"): > * > * {@code @Newify} class MyTreeProcessor { -- Is this supposed to be > @Newify([Tree,Leaf])? > * def myTree = Tree.new(Tree.new(Leaf.new("A"), Leaf.new("B")), > Leaf.new("C")) > * def process() { ... } > * } > * > {code} > {code} > * An example showing how to use the annotation at different levels: > * > * {@code @Newify(auto=false, value=Foo)} > * class Main { > * {@code @Newify} // turn auto on for field -- Is this supposed to be > @Newify(BigInteger)? > * def field1 = java.math.BigInteger.new(42) > * def field2, field3, field4 > * > * {@code @Newify(Bar)} > * def process() { > * field2 = Bar("my bar") > * } > * > * {@code @Newify(Baz)} > * Main() { > * field3 = Foo("my foo") > * field4 = Baz("my baz") > * } > * } > * > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8242) Javadoc for Newify is missing some attribute values
[ https://issues.apache.org/jira/browse/GROOVY-8242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16073794#comment-16073794 ] Eric Milles commented on GROOVY-8242: - But the value attribute does not have a default value. So if none is set, I get warnings that I must set value. > Javadoc for Newify is missing some attribute values > --- > > Key: GROOVY-8242 > URL: https://issues.apache.org/jira/browse/GROOVY-8242 > Project: Groovy > Issue Type: Bug >Reporter: Eric Milles >Priority: Minor > > I was looking at thw Newify AST transform. Some of the Javadoc appears > incorrect since the annotation requires a value. > {code} > * or this ("Ruby-style"): > * > * {@code @Newify} class MyTreeProcessor { -- Is this supposed to be > @Newify([Tree,Leaf])? > * def myTree = Tree.new(Tree.new(Leaf.new("A"), Leaf.new("B")), > Leaf.new("C")) > * def process() { ... } > * } > * > {code} > {code} > * An example showing how to use the annotation at different levels: > * > * {@code @Newify(auto=false, value=Foo)} > * class Main { > * {@code @Newify} // turn auto on for field -- Is this supposed to be > @Newify(BigInteger)? > * def field1 = java.math.BigInteger.new(42) > * def field2, field3, field4 > * > * {@code @Newify(Bar)} > * def process() { > * field2 = Bar("my bar") > * } > * > * {@code @Newify(Baz)} > * Main() { > * field3 = Foo("my foo") > * field4 = Baz("my baz") > * } > * } > * > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8242) Javadoc for Newify is missing some attribute values
[ https://issues.apache.org/jira/browse/GROOVY-8242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16071780#comment-16071780 ] John Wagenleitner commented on GROOVY-8242: --- I believe the javadoc code is valid. You can omit providing a value if using the Ruby style, {{Integer.new(7)}}, unless {{auto=false}} is set. The value is required when using the Python style, {{Integer(7)}} as noted in this line from the javadoc: {quote}The "Python-style" conversions require you to specify each class on which you want them to apply.{quote} > Javadoc for Newify is missing some attribute values > --- > > Key: GROOVY-8242 > URL: https://issues.apache.org/jira/browse/GROOVY-8242 > Project: Groovy > Issue Type: Bug >Reporter: Eric Milles >Priority: Minor > > I was looking at thw Newify AST transform. Some of the Javadoc appears > incorrect since the annotation requires a value. > {code} > * or this ("Ruby-style"): > * > * {@code @Newify} class MyTreeProcessor { -- Is this supposed to be > @Newify([Tree,Leaf])? > * def myTree = Tree.new(Tree.new(Leaf.new("A"), Leaf.new("B")), > Leaf.new("C")) > * def process() { ... } > * } > * > {code} > {code} > * An example showing how to use the annotation at different levels: > * > * {@code @Newify(auto=false, value=Foo)} > * class Main { > * {@code @Newify} // turn auto on for field -- Is this supposed to be > @Newify(BigInteger)? > * def field1 = java.math.BigInteger.new(42) > * def field2, field3, field4 > * > * {@code @Newify(Bar)} > * def process() { > * field2 = Bar("my bar") > * } > * > * {@code @Newify(Baz)} > * Main() { > * field3 = Foo("my foo") > * field4 = Baz("my baz") > * } > * } > * > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)