groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 03/06: Minor refactoring: Lambda can be replaced with method reference
Date Sun, 03 Nov 2019 13:39:09 GMT
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 d852871dc12cb72716f2cbb0d2a0e2160cc11aac
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Sun Nov 3 21:29:25 2019 +0800

    Minor refactoring: Lambda can be replaced with method reference
---
 .../java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java | 3 +--
 .../org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java   | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java b/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java
index 9ab08c2..227eba4 100644
--- a/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java
+++ b/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java
@@ -37,7 +37,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.ListIterator;
 import java.util.Map;
 
 public class CachedSAMClass extends CachedClass {
@@ -103,7 +102,7 @@ public class CachedSAMClass extends CachedClass {
 
     private static Method[] getDeclaredMethods(final Class c) {
         try {
-            Method[] methods = AccessController.doPrivileged((PrivilegedAction<Method[]>)
() -> c.getDeclaredMethods());
+            Method[] methods = AccessController.doPrivileged((PrivilegedAction<Method[]>)
c::getDeclaredMethods);
             if (methods!=null) return methods;
         } catch (java.security.AccessControlException ace) {
             // swallow and do as if no method is available
diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
index 84728cd..dd74327 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
@@ -1191,7 +1191,7 @@ public abstract class StaticTypeCheckingSupport {
         return Arrays.stream(params).map(param -> {
             String name = param.getType().getUnresolvedName();
             Optional<GenericsType> value = genericsPlaceholderAndTypeMap.entrySet().stream()
-                .filter(e -> e.getKey().getName().equals(name)).findFirst().map(e ->
e.getValue());
+                .filter(e -> e.getKey().getName().equals(name)).findFirst().map(Entry::getValue);
             ClassNode type = value.map(GenericsType::getType).orElseGet(() -> makeRawType(param.getType()));
 
             return new Parameter(type, param.getName());


Mime
View raw message