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 2020/04/11 12:09:09 UTC

[groovy] branch master updated: Trivial refactoring: Simplify the code

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


The following commit(s) were added to refs/heads/master by this push:
     new 85dcdf2  Trivial refactoring: Simplify the code
85dcdf2 is described below

commit 85dcdf21a8c7522c3296c3c928e16b207b609161
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Apr 11 20:08:31 2020 +0800

    Trivial refactoring: Simplify the code
---
 .../codehaus/groovy/control/customizers/SecureASTCustomizer.java    | 2 +-
 .../org/codehaus/groovy/vmplugin/v8/PluginDefaultGroovyMethods.java | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java b/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java
index ce899de..37ffb70 100644
--- a/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java
+++ b/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java
@@ -700,7 +700,7 @@ public class SecureASTCustomizer extends CompilationCustomizer {
                 // we should now check if the import is in the star imports
                 String packageName = getWildCardImport(className);
                 if (!staticStarImportsWhitelist.contains(className + ".*")
-                        && !staticStarImportsWhitelist.stream().filter(it -> it.endsWith(".")).anyMatch(packageName::startsWith)) {
+                        && staticStarImportsWhitelist.stream().filter(it -> it.endsWith(".")).noneMatch(packageName::startsWith)) {
                     throw new SecurityException("Importing [" + fqn + "] is not allowed");
                 }
             } else {
diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/PluginDefaultGroovyMethods.java b/src/main/java/org/codehaus/groovy/vmplugin/v8/PluginDefaultGroovyMethods.java
index 7ac2176..76a7d7c 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/PluginDefaultGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/PluginDefaultGroovyMethods.java
@@ -601,7 +601,7 @@ public class PluginDefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * @since 2.5.0
      */
     public static Stream<Integer> stream(final int[] self) {
-        return Arrays.stream(self).mapToObj(Integer::valueOf);
+        return Arrays.stream(self).boxed();
     }
 
     /**
@@ -614,7 +614,7 @@ public class PluginDefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * @since 2.5.0
      */
     public static Stream<Long> stream(final long[] self) {
-        return Arrays.stream(self).mapToObj(Long::valueOf);
+        return Arrays.stream(self).boxed();
     }
 
     /**
@@ -627,7 +627,7 @@ public class PluginDefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * @since 2.5.0
      */
     public static Stream<Double> stream(final double[] self) {
-        return Arrays.stream(self).mapToObj(Double::valueOf);
+        return Arrays.stream(self).boxed();
     }
 
     /**