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 14:00:05 UTC
[groovy] 02/06: Use static `valueOf(String)` method instead of the deprecated `new Integer(String)` constructor
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 325a351d4de5815158df12cc94fa13a5cfbc3d1e
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
(cherry picked from commit 6f03d16320ee2b48954e37b93bad8653eb4de540)
---
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[]