groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 04/04: Trivial refactoring: statement lambda can be replaced with expression lambda
Date Mon, 02 Dec 2019 10:39:18 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 49b7e3e67eda452660cb8842ee28223f0462ac09
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Mon Dec 2 17:48:59 2019 +0800

    Trivial refactoring: statement lambda can be replaced with expression lambda
    
    (cherry picked from commit 65b9a1c8342e6c30eef7f1da8c6f99785eb4935b)
---
 .../org/codehaus/groovy/reflection/CachedClass.java  | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/reflection/CachedClass.java b/src/main/java/org/codehaus/groovy/reflection/CachedClass.java
index 79a7756..04a3347 100644
--- a/src/main/java/org/codehaus/groovy/reflection/CachedClass.java
+++ b/src/main/java/org/codehaus/groovy/reflection/CachedClass.java
@@ -56,11 +56,9 @@ public class CachedClass {
 
         @Override
         public CachedField[] initValue() {
-            PrivilegedAction<CachedField[]> action = () -> {
-                return Arrays.stream(getTheClass().getDeclaredFields())
-                    .filter(f -> checkCanSetAccessible(f, CachedClass.class))
-                    .map(CachedField::new).toArray(CachedField[]::new);
-            };
+            PrivilegedAction<CachedField[]> action = () -> Arrays.stream(getTheClass().getDeclaredFields())
+                .filter(f -> checkCanSetAccessible(f, CachedClass.class))
+                .map(CachedField::new).toArray(CachedField[]::new);
             return AccessController.doPrivileged(action);
         }
     };
@@ -70,13 +68,11 @@ public class CachedClass {
 
         @Override
         public CachedConstructor[] initValue() {
-            PrivilegedAction<CachedConstructor[]> action = () -> {
-                return Arrays.stream(getTheClass().getDeclaredConstructors())
-                    .filter(c -> !c.isSynthetic()) // GROOVY-9245: exclude inner class
ctors
-                    .filter(c -> checkCanSetAccessible(c, CachedClass.class))
-                    .map(c -> new CachedConstructor(CachedClass.this, c))
-                    .toArray(CachedConstructor[]::new);
-            };
+            PrivilegedAction<CachedConstructor[]> action = () -> Arrays.stream(getTheClass().getDeclaredConstructors())
+                .filter(c -> !c.isSynthetic()) // GROOVY-9245: exclude inner class ctors
+                .filter(c -> checkCanSetAccessible(c, CachedClass.class))
+                .map(c -> new CachedConstructor(CachedClass.this, c))
+                .toArray(CachedConstructor[]::new);
             return AccessController.doPrivileged(action);
         }
     };


Mime
View raw message