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 2019/04/18 14:48:10 UTC

[groovy] branch master updated (7d66e07 -> b053eff)

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

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


    from 7d66e07  fix unintended illegal access
     new 0c9cb55  fix unintended illegal access
     new 8981b16  fix unintended illegal access
     new b053eff  fix unintended illegal access

The 3 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:
 .../bugs/BadLineNumberOnExceptionBugTest.groovy    |  4 +-
 src/test/groovy/bugs/Groovy3464Bug.groovy          |  5 +--
 .../test/resources/core/MethodReference_01x.groovy | 52 +++++++++++-----------
 3 files changed, 29 insertions(+), 32 deletions(-)


[groovy] 03/03: fix unintended illegal access

Posted by pa...@apache.org.
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

commit b053eff860193e8f72a498da1d02c4d49db85ab0
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Apr 19 00:27:55 2019 +1000

    fix unintended illegal access
---
 .../test/resources/core/MethodReference_01x.groovy | 52 +++++++++++-----------
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x.groovy b/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x.groovy
index 997a7bf..dd3d116 100644
--- a/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x.groovy
+++ b/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x.groovy
@@ -16,60 +16,62 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-import java.util.stream.Collectors
+import java.util.stream.Stream
+
+import static java.util.stream.Collectors.toList
+import static java.util.stream.Collectors.toMap
 
 // class::staticMethod
-assert ['1', '2', '3'] == [1, 2, 3].stream().map(Integer::toString).collect(Collectors.toList())
+assert ['1', '2', '3'] == [1, 2, 3].stream().map(Integer::toString).collect(toList())
 
 // class::instanceMethod
-assert ['A', 'B', 'C'] == ['a', 'b', 'c'].stream().map(String::toUpperCase).collect(Collectors.toList())
-
+assert ['A', 'B', 'C'] == ['a', 'b', 'c'].stream().map(String::toUpperCase).collect(toList())
 
-
-def robot = new Robot();
+def robot = new Robot()
 
 // instance::instanceMethod
-assert ['Hi, Jochen', 'Hi, Paul', 'Hi, Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(robot::greet).collect(Collectors.toList())
+assert ['Hi, Jochen', 'Hi, Paul', 'Hi, Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(robot::greet).collect(toList())
 
 // class::staticMethod
-assert ['Jochen', 'Paul', 'Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(Person::getText).collect(Collectors.toList())
-assert ['Jochen', 'Paul', 'Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(BasePerson::getText).collect(Collectors.toList())
+assert ['Jochen', 'Paul', 'Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(Person::getText).collect(toList())
+assert ['Jochen', 'Paul', 'Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(BasePerson::getText).collect(toList())
 
 // instance::staticMethod
-assert ['J', 'P', 'D'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(robot::firstCharOfName).collect(Collectors.toList())
+assert ['J', 'P', 'D'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(robot::firstCharOfName).collect(toList())
 
 // class::instanceMethod
-assert ['Jochen', 'Paul', 'Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(Person::getName).collect(Collectors.toList())
+assert ['Jochen', 'Paul', 'Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(Person::getName).collect(toList())
 
 // class::instanceMethod
-assert 6 == java.util.stream.Stream.of(1, 2, 3).reduce(0, BigDecimal::add)
+assert 6G == Stream.of(1G, 2G, 3G).reduce(0G, BigInteger::add)
 
 // ----------------------------------
 class BasePerson {
-    public static String getText(Person p) {
-        return p.name;
+    static String getText(Person p) {
+        return p.name
     }
 }
 
 class Person extends BasePerson {
-    private String name;
+    private String name
 
-    public Person(String name) {
+    Person(String name) {
         this.name = name
     }
 
-    public String getName() {
-        return this.name;
+    String getName() {
+        return this.name
     }
 
 }
+
 class Robot {
-    public String greet(Person p) {
+    String greet(Person p) {
         return "Hi, ${p.name}"
     }
 
-    public static char firstCharOfName(Person p) {
-        return p.getName().charAt(0);
+    static char firstCharOfName(Person p) {
+        return p.getName().charAt(0)
     }
 }
 
@@ -77,7 +79,7 @@ def mr = String::toUpperCase
 assert 'ABC' == mr('abc')
 assert 'ABC' == String::toUpperCase('abc')
 
-def m = ['apple', 'banana', 'orange'].stream().collect(Collectors.toMap(e -> e.charAt(0), e -> e, (e1, e2) -> e1, LinkedHashMap<String, String>::new))
+def m = ['apple', 'banana', 'orange'].stream().collect(toMap(e -> e.charAt(0), e -> e, (e1, e2) -> e1, LinkedHashMap<String, String>::new))
 assert m instanceof LinkedHashMap
 assert ['a', 'b', 'o'] as TreeSet == m.keySet() as TreeSet
 assert ['apple', 'banana', 'orange'] as TreeSet == m.values() as TreeSet
@@ -93,10 +95,9 @@ assert new String[0] == String[]::new('0')
 assert new String[1][2] == String[][]::new(1, 2)
 assert new String[1][2][3] == String[][][]::new(1, 2, 3)
 
-assert [new String[1], new String[2], new String[3]] == [1, 2, 3].stream().map(String[]::new).collect(Collectors.toList())
+assert [new String[1], new String[2], new String[3]] == [1, 2, 3].stream().map(String[]::new).collect(toList())
 assert [1, 2, 3] as String[] == [1, 2, 3].stream().map(String::valueOf).toArray(String[]::new)
 
-
 def a = String[][]::new(1, 2)
 def b = new String[1][2]
 assert a.class == b.class && a == b
@@ -108,6 +109,3 @@ assert a.class == b.class && a == b
 a = String[][][][]::new(1, 2)
 b = new String[1][2][][]
 assert a.class == b.class && a == b
-
-
-


[groovy] 01/03: fix unintended illegal access

Posted by pa...@apache.org.
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

commit 0c9cb55d3e8021cead42a014f1c48778a1bb82b5
Author: Paul King <pa...@asert.com.au>
AuthorDate: Thu Apr 18 23:56:42 2019 +1000

    fix unintended illegal access
---
 src/test/groovy/bugs/Groovy3464Bug.groovy | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/test/groovy/bugs/Groovy3464Bug.groovy b/src/test/groovy/bugs/Groovy3464Bug.groovy
index 1171285..83ca9bf 100644
--- a/src/test/groovy/bugs/Groovy3464Bug.groovy
+++ b/src/test/groovy/bugs/Groovy3464Bug.groovy
@@ -40,8 +40,8 @@ class Groovy3464Bug extends GroovyTestCase {
             jointCompilationOptions = [stubDir: createTempDir()]
         }
 
-        def groovyFile = new File('GroovyThing.groovy', config.targetDirectory)
-        def javaFile = new File('JavaThing.java', config.targetDirectory)
+        def groovyFile = new File(config.targetDirectory, 'GroovyThing.groovy')
+        def javaFile = new File(config.targetDirectory, 'JavaThing.java')
 
         groovyFile << '''
             class GroovyThing {
@@ -110,4 +110,3 @@ class Groovy3464Bug extends GroovyTestCase {
         return tempDirectory
     }
 }
-


[groovy] 02/03: fix unintended illegal access

Posted by pa...@apache.org.
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

commit 8981b162f2fc88731877648b354d9b860265f4ef
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Apr 19 00:02:39 2019 +1000

    fix unintended illegal access
---
 src/test/groovy/bugs/BadLineNumberOnExceptionBugTest.groovy | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/groovy/bugs/BadLineNumberOnExceptionBugTest.groovy b/src/test/groovy/bugs/BadLineNumberOnExceptionBugTest.groovy
index 4be9613..667852a 100644
--- a/src/test/groovy/bugs/BadLineNumberOnExceptionBugTest.groovy
+++ b/src/test/groovy/bugs/BadLineNumberOnExceptionBugTest.groovy
@@ -45,7 +45,7 @@ class BadLineNumberOnExceptionBugTest extends GroovyTestCase {
 
                 assert false
             } catch (MissingMethodException e) {
-                def scriptTraceElement = e.stackTrace.find { it.declaringClass.startsWith(GroovyTestCase.TEST_SCRIPT_NAME_PREFIX) }
+                def scriptTraceElement = e.stackTrace.find { it.className.startsWith(GroovyTestCase.TEST_SCRIPT_NAME_PREFIX) }
                 assert 9 == scriptTraceElement.lineNumber
             }
         """
@@ -65,7 +65,7 @@ class BadLineNumberOnExceptionBugTest extends GroovyTestCase {
 
                 assert false
             } catch (MissingPropertyException e) {
-                def scriptTraceElement = e.stackTrace.find { it.declaringClass.startsWith(GroovyTestCase.TEST_SCRIPT_NAME_PREFIX) }
+                def scriptTraceElement = e.stackTrace.find { it.className.startsWith(GroovyTestCase.TEST_SCRIPT_NAME_PREFIX) }
                 assert 3 == scriptTraceElement.lineNumber
             }
         """