groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] branch master updated: GROOVY-9008: minor refactor: better error processing when method not found
Date Tue, 09 Apr 2019 23:55:54 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new 3e518c4  GROOVY-9008: minor refactor: better error processing when method not found
3e518c4 is described below

commit 3e518c475deba6874b9b9f4f7d5dcf3639d4faad
Author: Paul King <paulk@asert.com.au>
AuthorDate: Wed Apr 10 09:55:19 2019 +1000

    GROOVY-9008: minor refactor: better error processing when method not found
---
 .../classgen/asm/sc/StaticTypesMethodReferenceExpressionWriter.java  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesMethodReferenceExpressionWriter.java
b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesMethodReferenceExpressionWriter.java
index 0f05cb0..98cb1d4 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesMethodReferenceExpressionWriter.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesMethodReferenceExpressionWriter.java
@@ -20,6 +20,7 @@ package org.codehaus.groovy.classgen.asm.sc;
 
 import groovy.lang.GroovyRuntimeException;
 import groovy.lang.Tuple;
+import groovy.lang.Tuple2;
 import org.codehaus.groovy.ast.ClassHelper;
 import org.codehaus.groovy.ast.ClassNode;
 import org.codehaus.groovy.ast.MethodNode;
@@ -268,9 +269,7 @@ public class StaticTypesMethodReferenceExpressionWriter extends MethodReferenceE
 
         return mrMethodNodeList.stream()
                 .map(e -> Tuple.tuple(e, matchingScore(e, mrExpr)))
-                .min((t1, t2) -> Integer.compare(t2.getV2(), t1.getV2()))
-                .get()
-                .getV1();
+                .min((t1, t2) -> Integer.compare(t2.getV2(), t1.getV2())).map(Tuple2::getV1).orElse(null);
     }
 
     private static Integer matchingScore(MethodNode mn, Expression mrExpr) {


Mime
View raw message