You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2022/09/17 13:42:04 UTC

[groovy] branch master updated (3d482bcac1 -> 9f72c55f89)

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

sunlan pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


    from 3d482bcac1 GROOVY-7919: add `isCase(Iterable,Object)` for `in` and `!in` support
     new 1fdcedb590 assert fails because by default `@ToString` `includePackage` property is set to `true` returning package name along with object name i.e. `groovy.Element(Helium, 2)` is returned value on the right hand side
     new 6f03d16320 Use static `valueOf(String)` method instead of the deprecated `new Integer(String)` constructor
     new 5dec8691ff Avoid inconvertible types warning at the `assert composite*.id == [1,2]` as left hand side is `ArrayList<Long>` while right hand side is `ArrayList<Integer>`
     new 18e5d2f7ae Equivalency to Java `equals(Object)` and `==` respectively
     new 9f72c55f89 Add membership negation assert example

The 5 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/spec/doc/core-operators.adoc   | 8 ++++----
 src/spec/test/OperatorsTest.groovy | 5 +++--
 2 files changed, 7 insertions(+), 6 deletions(-)


[groovy] 02/05: Use static `valueOf(String)` method instead of the deprecated `new Integer(String)` constructor

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 6f03d16320ee2b48954e37b93bad8653eb4de540
Author: Alex Golub <a1...@gmail.com>
AuthorDate: Fri Sep 16 19:05:46 2022 +0300

    Use static `valueOf(String)` method instead of the deprecated `new Integer(String)` constructor
---
 src/spec/test/OperatorsTest.groovy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spec/test/OperatorsTest.groovy b/src/spec/test/OperatorsTest.groovy
index 94f0d2930c..32fd550d75 100644
--- a/src/spec/test/OperatorsTest.groovy
+++ b/src/spec/test/OperatorsTest.groovy
@@ -332,7 +332,7 @@ assert user.@name == 'Bob'                   // <1>
             // tag::constructor_refs[]
             @CompileStatic
             void constructorRefs() {
-                assert [1, 2, 3] == ['1', '2', '3'].stream().map(Integer::new).collect(toList())  // <1>
+                assert [1, 2, 3] == ['1', '2', '3'].stream().map(Integer::valueOf).collect(toList())  // <1>
 
                 def result = [1, 2, 3].stream().toArray(Integer[]::new)                           // <2>
                 assert result instanceof Integer[]


[groovy] 03/05: Avoid inconvertible types warning at the `assert composite*.id == [1,2]` as left hand side is `ArrayList` while right hand side is `ArrayList`

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 5dec8691ff0c4da4c2cb8c135cf93775092b9ffc
Author: Alex Golub <a1...@gmail.com>
AuthorDate: Fri Sep 16 19:29:09 2022 +0300

    Avoid inconvertible types warning at the `assert composite*.id == [1,2]` as left hand side is `ArrayList<Long>` while right hand side is `ArrayList<Integer>`
---
 src/spec/test/OperatorsTest.groovy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spec/test/OperatorsTest.groovy b/src/spec/test/OperatorsTest.groovy
index 32fd550d75..c35cc97556 100644
--- a/src/spec/test/OperatorsTest.groovy
+++ b/src/spec/test/OperatorsTest.groovy
@@ -421,7 +421,7 @@ assert null*.make == null                             // <3>
         assertScript '''
 // tag::spreaddot_iterable[]
 class Component {
-    Long id
+    Integer id
     String name
 }
 class CompositeObject implements Iterable<Component> {


[groovy] 05/05: Add membership negation assert example

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 9f72c55f89e2b278f99a91de5f7938958ad10124
Author: Alex Golub <a1...@gmail.com>
AuthorDate: Sat Sep 17 14:47:14 2022 +0300

    Add membership negation assert example
---
 src/spec/doc/core-operators.adoc   | 1 +
 src/spec/test/OperatorsTest.groovy | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/spec/doc/core-operators.adoc b/src/spec/doc/core-operators.adoc
index 435c897058..4f8ce46b93 100644
--- a/src/spec/doc/core-operators.adoc
+++ b/src/spec/doc/core-operators.adoc
@@ -798,6 +798,7 @@ to calling `contains`, like in the following example:
 include::../test/OperatorsTest.groovy[tags=membership_op,indent=0]
 ----
 <1> equivalent to calling `list.contains('Emmy')` or `list.isCase('Emmy')`
+<2> membership negation equivalent to calling `!list.contains('Emmy')` or `!list.isCase('Emmy')`
 
 === Identity operator
 
diff --git a/src/spec/test/OperatorsTest.groovy b/src/spec/test/OperatorsTest.groovy
index c35cc97556..1a87eb6e84 100644
--- a/src/spec/test/OperatorsTest.groovy
+++ b/src/spec/test/OperatorsTest.groovy
@@ -612,6 +612,7 @@ assert function(*args,5,6) == 26
         // tag::membership_op[]
         def list = ['Grace','Rob','Emmy']
         assert ('Emmy' in list)                     // <1>
+        assert ('Alex' !in list)                    // <2>
         // end::membership_op[]
     }
 


[groovy] 04/05: Equivalency to Java `equals(Object)` and `==` respectively

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 18e5d2f7aed52d193999586e0576e660e1fb2a83
Author: Alex Golub <a1...@gmail.com>
AuthorDate: Sat Sep 17 14:21:40 2022 +0300

    Equivalency to Java `equals(Object)` and `==` respectively
---
 src/spec/doc/core-operators.adoc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/spec/doc/core-operators.adoc b/src/spec/doc/core-operators.adoc
index 5a92a0ff1a..435c897058 100644
--- a/src/spec/doc/core-operators.adoc
+++ b/src/spec/doc/core-operators.adoc
@@ -810,8 +810,8 @@ include::../test/OperatorsTest.groovy[tags=identity_op,indent=0]
 ----
 <1> Create a list of strings
 <2> Create another list of strings containing the same elements
-<3> using `==`, we test object equality
-<4> but using `is`, we can check that references are distinct
+<3> using `==`, we test object equality, equivalent to `list1.equals(list2)` in Java
+<4> but using `is`, we can check that references are distinct,  equivalent to `list1 != list2` in Java
 
 === Coercion operator
 


[groovy] 01/05: assert fails because by default `@ToString` `includePackage` property is set to `true` returning package name along with object name i.e. `groovy.Element(Helium, 2)` is returned value on the right hand side

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 1fdcedb590a743a5b2cc1fec525031a2a92360cc
Author: Alex Golub <a1...@gmail.com>
AuthorDate: Fri Sep 16 14:08:04 2022 +0300

    assert fails because by default `@ToString` `includePackage` property is set to `true` returning package name along with object name i.e. `groovy.Element(Helium, 2)` is returned value on the right hand side
---
 src/spec/doc/core-operators.adoc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/spec/doc/core-operators.adoc b/src/spec/doc/core-operators.adoc
index 78726bf59b..5a92a0ff1a 100644
--- a/src/spec/doc/core-operators.adoc
+++ b/src/spec/doc/core-operators.adoc
@@ -357,7 +357,7 @@ Groovy 3.0.0 introduces the Elvis operator, for example:
 --------------------------------------
 import groovy.transform.ToString
 
-@ToString
+@ToString(includePackage = false)
 class Element {
     String name
     int atomicNumber
@@ -1004,4 +1004,3 @@ Here is a complete list of the operators and their corresponding methods:
 | `~a`
 | a.bitwiseNegate()
 |====
-