You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/07/08 10:14:15 UTC
[groovy] branch master updated: improve doco wording
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 0d5bf5a improve doco wording
0d5bf5a is described below
commit 0d5bf5a11a2ad965cefbf2260dc94f1e49704b7f
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Jul 8 20:14:06 2020 +1000
improve doco wording
---
src/spec/doc/core-syntax.adoc | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/spec/doc/core-syntax.adoc b/src/spec/doc/core-syntax.adoc
index 6ee0790..3b2a75e 100644
--- a/src/spec/doc/core-syntax.adoc
+++ b/src/spec/doc/core-syntax.adoc
@@ -1098,16 +1098,13 @@ include::{projectdir}/src/spec/test/SyntaxTest.groovy[tags=array_3,indent=0]
<1> Retrieve the first element of the array
<2> Set the value of the third element of the array to a new value
-[NOTE]
-Java's array initializer notation is not supported by Groovy,
-as the curly braces can be misinterpreted with the notation of Groovy closures.
-
=== Java-style array initialization
Groovy has always supported literal list/array definitions using square brackets
and has avoided Java-style curly braces so as not to conflict with closure definitions.
In the case where the curly braces come immediately after an array type declaration however,
-there is no ambiguity with closure definitions, so the Java style is now also supported.
+there is no ambiguity with closure definitions,
+so Groovy 3 and above support that variant of the Java array initialization expression.
Examples: