[groovy] branch GROOVY_2_5_X updated: GROOVY-9637: prefactor existing utility
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push: new 22acefc GROOVY-9637: prefactor existing utility 22acefc is described below commit 22acefcdc12ffb165ec0d272a00f4eef71bd948c Author: Daniel Sun AuthorDate: Mon Jul 13 02:40:57 2020 +0800 GROOVY-9637: prefactor existing utility --- .../org/apache/groovy/ast/tools/ImmutablePropertyUtils.java | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java b/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java index c04c545..11d9265 100644 --- a/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java +++ b/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java @@ -69,7 +69,15 @@ public class ImmutablePropertyUtils { This list can by extended by providing "known immutable" classes via Immutable.knownImmutableClasses */ -private static Set builtinImmutables = new HashSet(Arrays.asList( +private static final Set BUILTIN_IMMUTABLES = new HashSet(Arrays.asList( +"boolean", +"byte", +"char", +"double", +"float", +"int", +"long", +"short", "java.lang.Class", "java.lang.Boolean", "java.lang.Byte", @@ -195,7 +203,7 @@ public class ImmutablePropertyUtils { } public static boolean isBuiltinImmutable(String typeName) { -return builtinImmutables.contains(typeName); +return BUILTIN_IMMUTABLES.contains(typeName); } private static boolean hasImmutableAnnotation(Class clazz) {
[groovy] branch GROOVY_3_0_X updated: GROOVY-9637: prefactor existing utility
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push: new 9b0b4e5 GROOVY-9637: prefactor existing utility 9b0b4e5 is described below commit 9b0b4e5478657a1bfc82d39634d24deeacc2910e Author: Daniel Sun AuthorDate: Mon Jul 13 02:40:57 2020 +0800 GROOVY-9637: prefactor existing utility --- .../org/apache/groovy/ast/tools/ImmutablePropertyUtils.java | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java b/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java index 4e2bde0..c89b484 100644 --- a/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java +++ b/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java @@ -69,7 +69,15 @@ public class ImmutablePropertyUtils { This list can by extended by providing "known immutable" classes via Immutable.knownImmutableClasses */ -private static Set builtinImmutables = new HashSet(Arrays.asList( +private static final Set BUILTIN_IMMUTABLES = new HashSet(Arrays.asList( +"boolean", +"byte", +"char", +"double", +"float", +"int", +"long", +"short", "java.lang.Class", "java.lang.Boolean", "java.lang.Byte", @@ -196,7 +204,7 @@ public class ImmutablePropertyUtils { } public static boolean isBuiltinImmutable(String typeName) { -return builtinImmutables.contains(typeName); +return BUILTIN_IMMUTABLES.contains(typeName); } private static boolean hasImmutableAnnotation(Class clazz) {
[groovy] branch master updated: GROOVY-9637: prefactor existing utility
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 3e8c19e GROOVY-9637: prefactor existing utility 3e8c19e is described below commit 3e8c19e0d2b693fea3caeecede9512a350cd27f3 Author: Daniel Sun AuthorDate: Mon Jul 13 02:40:57 2020 +0800 GROOVY-9637: prefactor existing utility --- .../org/apache/groovy/ast/tools/ImmutablePropertyUtils.java | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java b/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java index 4e2bde0..c89b484 100644 --- a/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java +++ b/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java @@ -69,7 +69,15 @@ public class ImmutablePropertyUtils { This list can by extended by providing "known immutable" classes via Immutable.knownImmutableClasses */ -private static Set builtinImmutables = new HashSet(Arrays.asList( +private static final Set BUILTIN_IMMUTABLES = new HashSet(Arrays.asList( +"boolean", +"byte", +"char", +"double", +"float", +"int", +"long", +"short", "java.lang.Class", "java.lang.Boolean", "java.lang.Byte", @@ -196,7 +204,7 @@ public class ImmutablePropertyUtils { } public static boolean isBuiltinImmutable(String typeName) { -return builtinImmutables.contains(typeName); +return BUILTIN_IMMUTABLES.contains(typeName); } private static boolean hasImmutableAnnotation(Class clazz) {
[groovy] branch GROOVY-9637 updated: Add one more test
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY-9637 in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY-9637 by this push: new 3c23fba Add one more test 3c23fba is described below commit 3c23fbaba8edabcfecf055b1de28cfd6fd8456bc Author: Daniel Sun AuthorDate: Thu Jul 23 12:29:08 2020 +0800 Add one more test --- src/test/groovy/GStringTest.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/groovy/GStringTest.groovy b/src/test/groovy/GStringTest.groovy index cfd745e..9812f67 100644 --- a/src/test/groovy/GStringTest.groovy +++ b/src/test/groovy/GStringTest.groovy @@ -626,6 +626,9 @@ class GStringTest extends GroovyTestCase { def gstr9 = "a${(short) 1}" assert gstr9.toString() === gstr9.toString() + +def gstr10 = "a${Map.class}" +assert gstr10.toString() === gstr10.toString() } void testImmutableStringsAndValues() {
[groovy] branch GROOVY_2_5_X updated: additional test case
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push: new 9e56297 additional test case 9e56297 is described below commit 9e562974e77370a6d3595236d5daf49a029778ec Author: Paul King AuthorDate: Thu Jul 23 12:54:30 2020 +1000 additional test case --- src/test/groovy/GStringTest.groovy | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/test/groovy/GStringTest.groovy b/src/test/groovy/GStringTest.groovy index 69f2107..10dc209 100644 --- a/src/test/groovy/GStringTest.groovy +++ b/src/test/groovy/GStringTest.groovy @@ -580,4 +580,15 @@ class GStringTest extends GroovyTestCase { assert Eval.me('''def foo='bar'; /$foo\u002abaz/''') == 'bar*baz' assert Eval.me('''def foo='bar'; /${foo}\u002abaz/''') == 'bar*baz' } + +void testGStringMutation() { +def cat = 'cat', hat = 'hat' +def gstring = "The ${cat} in the ${hat}" +assert gstring.toString() == 'The cat in the hat' +gstring.values[0] = 'eggs' +gstring.values[1] = 'ham' +gstring.strings[0] = 'Green ' +gstring.strings[1] = ' and ' +assert gstring.toString() == 'Green eggs and ham' +} }
[groovy] branch GROOVY_3_0_X updated: additional test case
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push: new d410d9f additional test case d410d9f is described below commit d410d9f46555e868542d45e6915aaf2803e2143a Author: Paul King AuthorDate: Thu Jul 23 12:54:30 2020 +1000 additional test case --- src/test/groovy/GStringTest.groovy | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/test/groovy/GStringTest.groovy b/src/test/groovy/GStringTest.groovy index 90fb455..6b5c24a 100644 --- a/src/test/groovy/GStringTest.groovy +++ b/src/test/groovy/GStringTest.groovy @@ -582,4 +582,15 @@ class GStringTest extends GroovyTestCase { assert Eval.me('''def foo='bar'; /$foo\u002abaz/''') == 'bar*baz' assert Eval.me('''def foo='bar'; /${foo}\u002abaz/''') == 'bar*baz' } + +void testGStringMutation() { +def cat = 'cat', hat = 'hat' +def gstring = "The ${cat} in the ${hat}" +assert gstring.toString() == 'The cat in the hat' +gstring.values[0] = 'eggs' +gstring.values[1] = 'ham' +gstring.strings[0] = 'Green ' +gstring.strings[1] = ' and ' +assert gstring.toString() == 'Green eggs and ham' +} }
[groovy] branch GROOVY-9637 updated (623c1e6 -> cf9f36d)
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a change to branch GROOVY-9637 in repository https://gitbox.apache.org/repos/asf/groovy.git. discard 623c1e6 Make `GString` final new cf9f36d Make `GString` final This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (623c1e6) \ N -- N -- N refs/heads/GROOVY-9637 (cf9f36d) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: src/main/java/groovy/lang/GString.java | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-)
[groovy] 01/01: Make `GString` final
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY-9637 in repository https://gitbox.apache.org/repos/asf/groovy.git commit cf9f36def3f1a5288dd8d3515de2ef8747302749 Author: Daniel Sun AuthorDate: Thu Jul 23 11:12:38 2020 +0800 Make `GString` final --- src/main/java/groovy/lang/GString.java | 22 +- src/test/groovy/lang/DummyGString.java | 47 -- src/test/groovy/lang/DummyGStringBase.java | 32 --- src/test/groovy/lang/GStringTest.java | 24 +-- .../codehaus/groovy/runtime/FileAppendTest.groovy | 2 +- .../groovy/runtime/WriterAppendTest.groovy | 2 +- 6 files changed, 26 insertions(+), 103 deletions(-) diff --git a/src/main/java/groovy/lang/GString.java b/src/main/java/groovy/lang/GString.java index ed4b937..c6fc509 100644 --- a/src/main/java/groovy/lang/GString.java +++ b/src/main/java/groovy/lang/GString.java @@ -27,8 +27,6 @@ import java.io.IOException; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.io.Writer; -import java.util.Arrays; -import java.util.List; import java.util.regex.Pattern; /** @@ -41,7 +39,7 @@ import java.util.regex.Pattern; * James Strachan: The lovely name of this class was suggested by Jules Gosnell * and was such a good idea, I couldn't resist :) */ -public class GString extends GroovyObjectSupport implements Comparable, CharSequence, Writable, Buildable, Serializable { +public final class GString extends GroovyObjectSupport implements Comparable, CharSequence, Writable, Buildable, Serializable { private static final long serialVersionUID = -2638020355892246323L; private static final String MKP = "mkp"; @@ -60,9 +58,13 @@ public class GString extends GroovyObjectSupport implements Comparable, CharSequ private final boolean immutable; public GString(Object values, String[] strings) { -this.values = (Object[]) values; -this.strings = strings; -this.immutable = checkImmutable(this.values); +this(convertToObjectArray(values), strings); +} + +private static Object[] convertToObjectArray(Object values) { +if (null == values) return EMPTY_OBJECT_ARRAY; + +return values instanceof Object[] ? (Object[]) values : new Object[] { values }; } /** @@ -99,8 +101,8 @@ public class GString extends GroovyObjectSupport implements Comparable, CharSequ } } -public final List getValues() { -return Arrays.asList(values); +public Object[] getValues() { +return values.clone(); } /** @@ -110,8 +112,8 @@ public class GString extends GroovyObjectSupport implements Comparable, CharSequ * the values will result in changes of the GString. It is not recommended * to do so. */ -public final List getStrings() { -return Arrays.asList(strings); +public String[] getStrings() { +return strings.clone(); } public GString plus(GString that) { diff --git a/src/test/groovy/lang/DummyGString.java b/src/test/groovy/lang/DummyGString.java deleted file mode 100644 index beb79a1..000 --- a/src/test/groovy/lang/DummyGString.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 groovy.lang; - -/** - * A hand crafted example GString - */ -public class DummyGString extends DummyGStringBase { - -private MetaClass metaClass; - -public DummyGString(Object[] values) { -this(values, new String[]{"Hello ", "!"}); -} - -public DummyGString(Object[] values, String[] strings) { -super(values, strings); -} - -public MetaClass getMetaClass() { -return metaClass; -} - -public void setMetaClass(MetaClass metaClass) { -this.metaClass = metaClass; -} - -public Object invokeMethod(String name, Object arguments) { -return metaClass.invokeMethod(this, name, arguments); -} -} diff --git a/src/test/groovy/lang/DummyGStringBase.java b/src/test/groovy/lang/DummyGStringBase.java deleted file mode 100644 index d92a581..000 ---
[groovy] branch master updated: additional test case
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 43ed85d additional test case 43ed85d is described below commit 43ed85d287643343dc7893fcf793bd1ea808dc52 Author: Paul King AuthorDate: Thu Jul 23 12:54:30 2020 +1000 additional test case --- src/test/groovy/GStringTest.groovy | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/test/groovy/GStringTest.groovy b/src/test/groovy/GStringTest.groovy index 90fb455..6b5c24a 100644 --- a/src/test/groovy/GStringTest.groovy +++ b/src/test/groovy/GStringTest.groovy @@ -582,4 +582,15 @@ class GStringTest extends GroovyTestCase { assert Eval.me('''def foo='bar'; /$foo\u002abaz/''') == 'bar*baz' assert Eval.me('''def foo='bar'; /${foo}\u002abaz/''') == 'bar*baz' } + +void testGStringMutation() { +def cat = 'cat', hat = 'hat' +def gstring = "The ${cat} in the ${hat}" +assert gstring.toString() == 'The cat in the hat' +gstring.values[0] = 'eggs' +gstring.values[1] = 'ham' +gstring.strings[0] = 'Green ' +gstring.strings[1] = ' and ' +assert gstring.toString() == 'Green eggs and ham' +} }
[groovy] branch GROOVY-9637 updated (5fd0574 -> 623c1e6)
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a change to branch GROOVY-9637 in repository https://gitbox.apache.org/repos/asf/groovy.git. discard 5fd0574 Fix the compilation error in the class `Sql` new 623c1e6 Make `GString` final This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (5fd0574) \ N -- N -- N refs/heads/GROOVY-9637 (623c1e6) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: src/main/java/groovy/lang/GString.java | 10 ++--- src/test/groovy/lang/DummyGString.java | 47 -- src/test/groovy/lang/DummyGStringBase.java | 32 --- src/test/groovy/lang/GStringTest.java | 24 +-- .../codehaus/groovy/runtime/FileAppendTest.groovy | 2 +- .../groovy/runtime/WriterAppendTest.groovy | 2 +- .../groovy-sql/src/main/java/groovy/sql/Sql.java | 13 +++--- 7 files changed, 26 insertions(+), 104 deletions(-) delete mode 100644 src/test/groovy/lang/DummyGString.java delete mode 100644 src/test/groovy/lang/DummyGStringBase.java
[groovy] 01/01: Make `GString` final
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY-9637 in repository https://gitbox.apache.org/repos/asf/groovy.git commit 623c1e66817f13e11e31c107b1f17d8e4c6b74e2 Author: Daniel Sun AuthorDate: Thu Jul 23 10:18:21 2020 +0800 Make `GString` final --- src/main/java/groovy/lang/GString.java | 10 ++--- src/test/groovy/lang/DummyGString.java | 47 -- src/test/groovy/lang/DummyGStringBase.java | 32 --- src/test/groovy/lang/GStringTest.java | 24 +-- .../codehaus/groovy/runtime/FileAppendTest.groovy | 2 +- .../groovy/runtime/WriterAppendTest.groovy | 2 +- 6 files changed, 19 insertions(+), 98 deletions(-) diff --git a/src/main/java/groovy/lang/GString.java b/src/main/java/groovy/lang/GString.java index ed4b937..11ef1ad 100644 --- a/src/main/java/groovy/lang/GString.java +++ b/src/main/java/groovy/lang/GString.java @@ -41,7 +41,7 @@ import java.util.regex.Pattern; * James Strachan: The lovely name of this class was suggested by Jules Gosnell * and was such a good idea, I couldn't resist :) */ -public class GString extends GroovyObjectSupport implements Comparable, CharSequence, Writable, Buildable, Serializable { +public final class GString extends GroovyObjectSupport implements Comparable, CharSequence, Writable, Buildable, Serializable { private static final long serialVersionUID = -2638020355892246323L; private static final String MKP = "mkp"; @@ -99,8 +99,8 @@ public class GString extends GroovyObjectSupport implements Comparable, CharSequ } } -public final List getValues() { -return Arrays.asList(values); +public Object[] getValues() { +return values.clone(); } /** @@ -110,8 +110,8 @@ public class GString extends GroovyObjectSupport implements Comparable, CharSequ * the values will result in changes of the GString. It is not recommended * to do so. */ -public final List getStrings() { -return Arrays.asList(strings); +public String[] getStrings() { +return strings.clone(); } public GString plus(GString that) { diff --git a/src/test/groovy/lang/DummyGString.java b/src/test/groovy/lang/DummyGString.java deleted file mode 100644 index beb79a1..000 --- a/src/test/groovy/lang/DummyGString.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 groovy.lang; - -/** - * A hand crafted example GString - */ -public class DummyGString extends DummyGStringBase { - -private MetaClass metaClass; - -public DummyGString(Object[] values) { -this(values, new String[]{"Hello ", "!"}); -} - -public DummyGString(Object[] values, String[] strings) { -super(values, strings); -} - -public MetaClass getMetaClass() { -return metaClass; -} - -public void setMetaClass(MetaClass metaClass) { -this.metaClass = metaClass; -} - -public Object invokeMethod(String name, Object arguments) { -return metaClass.invokeMethod(this, name, arguments); -} -} diff --git a/src/test/groovy/lang/DummyGStringBase.java b/src/test/groovy/lang/DummyGStringBase.java deleted file mode 100644 index d92a581..000 --- a/src/test/groovy/lang/DummyGStringBase.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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
[groovy] branch GROOVY-9637 updated: Fix the compilation error in the class `Sql`
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY-9637 in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY-9637 by this push: new 5fd0574 Fix the compilation error in the class `Sql` 5fd0574 is described below commit 5fd0574033b42b35854ecd584dd767818389a8ac Author: Daniel Sun AuthorDate: Thu Jul 23 09:14:09 2020 +0800 Fix the compilation error in the class `Sql` --- subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java b/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java index 7c8b96a..29fc5b0 100644 --- a/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java +++ b/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java @@ -28,7 +28,6 @@ import groovy.transform.stc.SimpleType; import org.codehaus.groovy.runtime.InvokerHelper; import javax.sql.DataSource; - import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; @@ -4009,16 +4008,16 @@ public class Sql implements AutoCloseable { * @see #expand(Object) */ protected String asSql(GString gstring, List values) { -String[] strings = gstring.getStrings(); -if (strings.length <= 0) { +List strings = gstring.getStrings(); +if (strings.size() <= 0) { throw new IllegalArgumentException("No SQL specified in GString: " + gstring); } boolean nulls = false; StringBuilder buffer = new StringBuilder(); boolean warned = false; Iterator iter = values.iterator(); -for (int i = 0; i < strings.length; i++) { -String text = strings[i]; +for (int i = 0; i < strings.size(); i++) { +String text = strings.get(i); if (text != null) { buffer.append(text); } @@ -4030,8 +4029,8 @@ public class Sql implements AutoCloseable { iter.remove(); } else { boolean validBinding = true; -if (i < strings.length - 1) { -String nextText = strings[i + 1]; +if (i < strings.size() - 1) { +String nextText = strings.get(i + 1); if ((text.endsWith("\"") || text.endsWith("'")) && (nextText.startsWith("'") || nextText.startsWith("\""))) { if (!warned) { LOG.warning("In Groovy SQL please do not use quotes around dynamic expressions " +
[groovy] branch GROOVY-9637 updated: Merge `GString` and `GStringImpl`
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY-9637 in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY-9637 by this push: new e5af92d Merge `GString` and `GStringImpl` e5af92d is described below commit e5af92dc0ab52aef079ef586ba19c42ae470da1f Author: Daniel Sun AuthorDate: Thu Jul 23 08:20:34 2020 +0800 Merge `GString` and `GStringImpl` --- src/main/java/groovy/lang/GString.java | 70 -- .../groovy/classgen/AsmClassGenerator.java | 4 +- .../codehaus/groovy/control/CompilationUnit.java | 2 + .../org/codehaus/groovy/runtime/GStringImpl.java | 64 src/test/groovy/lang/DummyGStringBase.java | 6 +- src/test/groovy/lang/GStringTest.java | 4 +- .../groovy/runtime/InvokeConstructorTest.java | 6 +- .../codehaus/groovy/runtime/InvokeMethodTest.java | 18 +++--- .../org/codehaus/groovy/runtime/InvokerTest.java | 21 --- 9 files changed, 65 insertions(+), 130 deletions(-) diff --git a/src/main/java/groovy/lang/GString.java b/src/main/java/groovy/lang/GString.java index affd9b4..ed4b937 100644 --- a/src/main/java/groovy/lang/GString.java +++ b/src/main/java/groovy/lang/GString.java @@ -20,7 +20,6 @@ package groovy.lang; import org.apache.groovy.ast.tools.ImmutablePropertyUtils; import org.apache.groovy.io.StringBuilderWriter; -import org.codehaus.groovy.runtime.GStringImpl; import org.codehaus.groovy.runtime.InvokerHelper; import org.codehaus.groovy.runtime.StringGroovyMethods; @@ -28,6 +27,8 @@ import java.io.IOException; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.io.Writer; +import java.util.Arrays; +import java.util.List; import java.util.regex.Pattern; /** @@ -40,7 +41,7 @@ import java.util.regex.Pattern; * James Strachan: The lovely name of this class was suggested by Jules Gosnell * and was such a good idea, I couldn't resist :) */ -public abstract class GString extends GroovyObjectSupport implements Comparable, CharSequence, Writable, Buildable, Serializable { +public class GString extends GroovyObjectSupport implements Comparable, CharSequence, Writable, Buildable, Serializable { private static final long serialVersionUID = -2638020355892246323L; private static final String MKP = "mkp"; @@ -52,39 +53,37 @@ public abstract class GString extends GroovyObjectSupport implements Comparable, /** * A GString containing a single empty String and no values. */ -public static final GString EMPTY = new GString(EMPTY_OBJECT_ARRAY) { -private static final long serialVersionUID = -7676746462783374250L; -private static final String EMPTY_STRING = ""; - -@Override -public String[] getStrings() { -return new String[] { EMPTY_STRING }; -} - -@Override -public String toString() { -return EMPTY_STRING; -} -}; - +public static final GString EMPTY = new GString(EMPTY_OBJECT_ARRAY, EMPTY_STRING_ARRAY); +private final String[] strings; private final Object[] values; private final boolean immutable; -public GString(Object values) { +public GString(Object values, String[] strings) { this.values = (Object[]) values; +this.strings = strings; this.immutable = checkImmutable(this.values); } -public GString(Object[] values) { +/** + * Create a new GString with values and strings. + * + * Each value is prefixed by a string, after the last value + * an additional String might be used. This means + * strings.length == values.length || strings.length == values.length + 1. + * + * NOTE: The lengths are not checked. Using different lengths might result + * in unpredictable behaviour. + * + * @param values the value parts + * @param strings the string parts + */ +public GString(Object[] values, String[] strings) { this.values = values; +this.strings = strings; this.immutable = checkImmutable(this.values); } -// will be static in an instance - -public abstract String[] getStrings(); - /** * Overloaded to implement duck typing for Strings * so that any method that can't be evaluated on this @@ -100,14 +99,25 @@ public abstract class GString extends GroovyObjectSupport implements Comparable, } } -public Object[] getValues() { -return values.clone(); +public final List getValues() { +return Arrays.asList(values); +} + +/** + * Get the strings of this GString. + * + * This methods returns the same array as used in the constructor. Changing + * the values will result in changes of the GString. It is not recommended + * to do so. + */ +public final List
[groovy-dev-site] branch asf-site updated: 2020/07/22 13:30:37: Generated dev website from groovy-website@49d7528
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/groovy-dev-site.git The following commit(s) were added to refs/heads/asf-site by this push: new df54f11 2020/07/22 13:30:37: Generated dev website from groovy-website@49d7528 df54f11 is described below commit df54f118c7cb5a67e42d0c8426984c3e72643ed9 Author: jenkins AuthorDate: Wed Jul 22 13:30:37 2020 + 2020/07/22 13:30:37: Generated dev website from groovy-website@49d7528 --- download.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/download.html b/download.html index 95daff1..59d1c3e 100644 --- a/download.html +++ b/download.html @@ -59,8 +59,8 @@ Improve this doc - Download Download 3.0.4Ways to get Apache Groovy:Download a source or binary distribution.Use a package manager or bundle for your operating system.Refer to the appropriate Apache Groovy jars from your build tools [...] + Download Download 3.0.5Ways to get Apache Groovy:Download a source or binary distribution.Use a package manager or bundle for your operating system.Refer to the appropriate Apache Groovy jars from your build tools [...]
[groovy] branch GROOVY_3_0_X updated: Bump version on GROOVY_3_0_X branch
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push: new 2a41ff0 Bump version on GROOVY_3_0_X branch 2a41ff0 is described below commit 2a41ff061e6ea06a30f8c70d9f9c19fe5c67592c Author: Paul King AuthorDate: Wed Jul 22 22:41:40 2020 +1000 Bump version on GROOVY_3_0_X branch --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3ab42bf..95afede 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -groovyVersion = 3.0.5-SNAPSHOT +groovyVersion = 3.0.6-SNAPSHOT # bundle version format: major('.'minor('.'micro('.'qualifier)?)?)? (first 3 only digits) -groovyBundleVersion = 3.0.5.SNAPSHOT +groovyBundleVersion = 3.0.6.SNAPSHOT gradle_version=6.5.1
[groovy-website] branch asf-site updated: Release 3.0.5: update sitemap
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/groovy-website.git The following commit(s) were added to refs/heads/asf-site by this push: new 49d7528 Release 3.0.5: update sitemap 49d7528 is described below commit 49d75285e45de5b77c7969e8a46f9dbae857c65f Author: Paul King AuthorDate: Wed Jul 22 23:12:50 2020 +1000 Release 3.0.5: update sitemap --- site/src/site/sitemap-dev.groovy | 5 + site/src/site/sitemap-user.groovy | 10 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/site/src/site/sitemap-dev.groovy b/site/src/site/sitemap-dev.groovy index 52f8cbc..1b787a8 100644 --- a/site/src/site/sitemap-dev.groovy +++ b/site/src/site/sitemap-dev.groovy @@ -87,8 +87,13 @@ downloads { a(href: 'versioning.html', 'version') yield ' of Groovy designed for JDK8+ with a new more flexible parser (aka Parrot parser).' } +version('3.0.5') { +stable true +//windowsInstaller 'https://bintray.com/groovy/Distributions/Windows-Installer/groovy-3.0.5-installer#files' +} version('3.0.4') { stable true +archive true windowsInstaller 'https://bintray.com/groovy/Distributions/Windows-Installer/groovy-3.0.4-installer#files' } } diff --git a/site/src/site/sitemap-user.groovy b/site/src/site/sitemap-user.groovy index 268bcc9..ea1185b 100644 --- a/site/src/site/sitemap-user.groovy +++ b/site/src/site/sitemap-user.groovy @@ -90,7 +90,7 @@ documentation { '2.5.0-rc-1', '2.5.0-rc-2', '2.5.0-rc-3', '2.5.0', '2.5.1', '2.5.2', '2.5.3', '2.5.4', '2.5.5', '2.5.6', '2.5.7', '2.5.8', '2.5.9', '2.5.10', '2.5.11', '2.5.12', '2.5.13', '2.6.0-alpha-1', '2.6.0-alpha-2', '2.6.0-alpha-3', '2.6.0-alpha-4', '3.0.0-alpha-1', '3.0.0-alpha-2', '3.0.0-alpha-3', '3.0.0-alpha-4', '3.0.0-beta-1', '3.0.0-beta-2', -'3.0.0-beta-3', '3.0.0-rc-1', '3.0.0-rc-2', '3.0.0-rc-3', '3.0.0', '3.0.1', '3.0.2', '3.0.3', '3.0.4' +'3.0.0-beta-3', '3.0.0-rc-1', '3.0.0-rc-2', '3.0.0-rc-3', '3.0.0', '3.0.1', '3.0.2', '3.0.3', '3.0.4', '3.0.5' ]) section('Getting started','fa-graduation-cap') { @@ -156,14 +156,14 @@ downloads { a(href: 'versioning.html', 'version') yield ' of Groovy designed for JDK8+ with a new more flexible parser (aka Parrot parser).' } -version('3.0.4') { +version('3.0.5') { stable true -//windowsInstaller 'https://bintray.com/groovy/Distributions/Windows-Installer/groovy-3.0.4-installer#files' +//windowsInstaller 'https://bintray.com/groovy/Distributions/Windows-Installer/groovy-3.0.5-installer#files' } -version('3.0.3') { +version('3.0.4') { stable true archive true -windowsInstaller 'https://bintray.com/groovy/Distributions/Windows-Installer/groovy-3.0.3-installer#files' +windowsInstaller 'https://bintray.com/groovy/Distributions/Windows-Installer/groovy-3.0.4-installer#files' } } distribution('Groovy 2.5') {
svn commit: r40633 - /dev/groovy/3.0.5/
Author: paulk Date: Wed Jul 22 13:12:46 2020 New Revision: 40633 Log: Deleting version 3.0.5 from the DEV staging area Removed: dev/groovy/3.0.5/
svn commit: r40632 - in /release/groovy/3.0.5: ./ distribution/ sources/
Author: paulk Date: Wed Jul 22 13:12:40 2020 New Revision: 40632 Log: Releasing version 3.0.5 Added: release/groovy/3.0.5/ release/groovy/3.0.5/distribution/ release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip (with props) release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip.asc release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip.sha256 release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip (with props) release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip.asc release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip.sha256 release/groovy/3.0.5/distribution/apache-groovy-sdk-3.0.5.zip (with props) release/groovy/3.0.5/distribution/apache-groovy-sdk-3.0.5.zip.asc release/groovy/3.0.5/distribution/apache-groovy-sdk-3.0.5.zip.sha256 release/groovy/3.0.5/sources/ release/groovy/3.0.5/sources/apache-groovy-src-3.0.5.zip (with props) release/groovy/3.0.5/sources/apache-groovy-src-3.0.5.zip.asc release/groovy/3.0.5/sources/apache-groovy-src-3.0.5.zip.sha256 Added: release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip == Binary file - no diff available. Propchange: release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip -- svn:mime-type = application/octet-stream Added: release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip.asc == --- release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip.asc (added) +++ release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip.asc Wed Jul 22 13:12:40 2020 @@ -0,0 +1,17 @@ +-BEGIN PGP SIGNATURE- +Version: BCPG v1.64 + +iQIcBAABCgAGBQJfFDu8AAoJEGplF2oPsc0LiJkQAL5IEV8omhHhFcI/nXhamQti +37nGYSIziNJ7YuJk7vvrZ3vtHmEanxSzCTvL8ltBVlAerxrGeK9hwHVFcPKu8LpM +9/DKgsA7UzanH9saasZ6pSTKaxvwB3JjbOKIMyrbvOz9k8rK1YdxhReb0l7Al/yW +mE6/TSLbFy9r7Bd27eAZ5vYcbVi3HipCTTNBbL6AqpntPeoQKzfw2ckaxYy9IXtl +1YjMoHFtu3UsWvEm5Ct2BXhIkv+9Ax7OVQ26pbMC9yjOuM47BgyiGNsJEYYZJ2GB +u0lz2YEy8tYvgLj86NMuUz5KLpBAuU4pnqY/Wyr8CfevZHhhL5oWdVsfq9+kDFL3 +iGcLbkv42xoxtUhJcd7sr1AKNK25ncmdFvLenAox0XHCiCFrnL/4i0aS7UNKUA4R +rzvif8UmpeyZSELsqO+mxNEbVAaxO03OLAZzqMdmBs5cR9dzk7ihxD/Mz8FEv6iV +Lq2P7ubLCza2uA+y8nPfxm6uWvFnjfJtvg4/oVll/vcgc3mHFgO/tg39Srxc/imN +/TD/Z0brTVfw0de7cqupPnL8mfDNfmO916sBf0Hzn8nZzQm6XMMgvTNJuApNKjgF +ORcsEWqMGfhjAA3rTJCBM6xr2xxzHfnJgKZOcYRQC9mJ76i0WSlkFZXsvqUpCNqV +HGesVQ53+0R7Jhdvytjy +=1VA6 +-END PGP SIGNATURE- Added: release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip.sha256 == --- release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip.sha256 (added) +++ release/groovy/3.0.5/distribution/apache-groovy-binary-3.0.5.zip.sha256 Wed Jul 22 13:12:40 2020 @@ -0,0 +1 @@ +f7ffaed8aa63611bf68bef0db512ab979926c6e8778393fe573c553b9bd39e10 Added: release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip == Binary file - no diff available. Propchange: release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip -- svn:mime-type = application/octet-stream Added: release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip.asc == --- release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip.asc (added) +++ release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip.asc Wed Jul 22 13:12:40 2020 @@ -0,0 +1,17 @@ +-BEGIN PGP SIGNATURE- +Version: BCPG v1.64 + +iQIcBAABCgAGBQJfFDu9AAoJEGplF2oPsc0LnIIQAL00E5gmfCjkhhl4PJI7+oBj +wNpuQuWdykEhZ2VmZSCYKrVzeQztI0BEIqL0yzFP3g6hNHBFqrAoXIS4KGut9TqH +dVvGvCXUG9JgAd9Crmr6m9uUX5DrtPA1LYEQ70ZdhpLywr6+5fD3QCF1Bk9PaOiB +efE7y+RsjQ3jXjMgHs8Njqfk1xTTnZbBqodDwrHZB7BJn8yKwyTH/B3k3NXnWiG0 +JyOi6lviiMTdfFGvBXYEPOuODSlMKCKtQlgV+Evc7gTl8j+UW0dgNVTc5Jt38+uf +cUMHKjaUC6YnRhQLDanBgNEAqiPQ7LlxdKGrJXgRQAJOH5bH/LSVt2xmvnZJs9K6 +j6d68i7pR+mX/LpTzl6NTxHNCGKLRQ2sFXt0SHtbn6D3x5lmTl7CDyQWG4vJ/sG3 +Hxpz8Wjllv4mJvTXdyTjVlkLk7xWowAyKbVJiz3groP3N5PWq8RiGCCWVncqb/VK +BGMbzQmWFLqdZZ08+t72BunkJTPiJ++eQWFqq/Lr+jwMp/dCIRvQVLmirmCmQqXg +jZmhMVfkC/Fv7zaX2eHL9kxVK3HCQkndWrvoqBEBxLGuIEVK/FDt0u+uqpTDo2iu +OckdtQU3VI01ipEI4NDTuXWLHMtg7vOCkxEaGeU0WHwmmAmhRkwIOP2xQKxLzTNF +V4KXvsR+Mut/5tOYgRB+ +=Slzf +-END PGP SIGNATURE- Added: release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip.sha256 == --- release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip.sha256 (added) +++ release/groovy/3.0.5/distribution/apache-groovy-docs-3.0.5.zip.sha256 Wed Jul 22
[groovy-website] branch asf-site updated: prepare for 3.0.5 release
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/groovy-website.git The following commit(s) were added to refs/heads/asf-site by this push: new 008ddd6 prepare for 3.0.5 release 008ddd6 is described below commit 008ddd6b3ba0b94e93fe40f889c02b5ceecefce2 Author: Paul King AuthorDate: Wed Jul 22 17:51:29 2020 +1000 prepare for 3.0.5 release --- site/src/site/releasenotes/groovy-2.5.adoc | 5 +++-- site/src/site/releasenotes/groovy-3.0.adoc | 25 + 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/site/src/site/releasenotes/groovy-2.5.adoc b/site/src/site/releasenotes/groovy-2.5.adoc index 36a09c4..f6d3641 100644 --- a/site/src/site/releasenotes/groovy-2.5.adoc +++ b/site/src/site/releasenotes/groovy-2.5.adoc @@ -735,9 +735,10 @@ for known workarounds. [[Groovy2.5releasenotes-Addendum2513]] == Addendum for 2.5.13 -If you are using the `SecureASTCustomizer` and relying on the exact wording of error -messages, e.g. in tests, then you may need to tweak the wording in those tests. +=== Breaking changes +* If you are using the `SecureASTCustomizer` and relying on the exact wording of error +messages, e.g. in tests, then you may need to tweak the wording in those tests. See (link:https://issues.apache.org/jira/browse/GROOVY-9594[GROOVY-9594]) for more details. diff --git a/site/src/site/releasenotes/groovy-3.0.adoc b/site/src/site/releasenotes/groovy-3.0.adoc index 9ab1515..84a5c90 100644 --- a/site/src/site/releasenotes/groovy-3.0.adoc +++ b/site/src/site/releasenotes/groovy-3.0.adoc @@ -972,3 +972,28 @@ dependencies { + +[[Groovy3.0releasenotes-3.0.5]] +== Addendum for 3.0.5 + +=== Potentially unexpected dependency changes + +* We have reverted TestNG to 7.1.0, so the workarounds mentioned in the 3.0.4 release notes +are no longer needed. You can exclude 7.1.0 and explicitly include 7.2.0 if you specifically +need that version of TestNG. + +=== Breaking changes + +* If you are using `SecureASTCustomizer` and relying on the exact wording of error +messages, e.g. perhaps in tests, then you may need to tweak the wording in those tests +(link:https://issues.apache.org/jira/browse/GROOVY-9594[GROOVY-9594]). + +* If you are using the `groovy-cli-picocli` module or scripting most of Groovy's command line tools +(e.g. `groovy`, `groovyc`, `groovysh`, `groovydoc` etc.) +and you are relying on the exact wording of error messages, e.g. perhaps in tests, +then you may need to tweak the wording in those tests +(link:https://issues.apache.org/jira/browse/GROOVY-9627[GROOVY-9627]). + +* Groovy is now more compliant with the JavaBeans specification for one edge case scenario +involving any field having a name starting with an uppercase letter +(link:https://issues.apache.org/jira/browse/GROOVY-9618[GROOVY-9618]).