Repository: groovy
Updated Branches:
  refs/heads/master 600e08b09 -> f535e8935


Trivial refactoring: extract common variable


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/f535e893
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/f535e893
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/f535e893

Branch: refs/heads/master
Commit: f535e8935e0d67e1a8b40de28c0f47679a847c07
Parents: 600e08b
Author: sunlan <sun...@apache.org>
Authored: Wed Apr 4 17:33:52 2018 +0800
Committer: sunlan <sun...@apache.org>
Committed: Wed Apr 4 17:33:52 2018 +0800

----------------------------------------------------------------------
 .../groovy/classgen/asm/sc/StaticTypesLambdaWriter.java       | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/f535e893/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java
 
b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java
index 59e9df6..45cc509 100644
--- 
a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java
+++ 
b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java
@@ -95,14 +95,15 @@ public class StaticTypesLambdaWriter extends LambdaWriter {
     @Override
     public void writeLambda(LambdaExpression expression) {
         ClassNode lambdaType = getLambdaType(expression);
+        ClassNode redirect = lambdaType.redirect();
 
-        if (null == lambdaType || 
!ClassHelper.isFunctionalInterface(lambdaType.redirect())) {
+        if (null == lambdaType || 
!ClassHelper.isFunctionalInterface(redirect)) {
             // if the parameter type is not real FunctionInterface or failed 
to be inferred, generate the default bytecode, which is actually a closure
             super.writeLambda(expression);
             return;
         }
 
-        MethodNode abstractMethodNode = 
ClassHelper.findSAM(lambdaType.redirect());
+        MethodNode abstractMethodNode = ClassHelper.findSAM(redirect);
         String abstractMethodDesc = createMethodDescriptor(abstractMethodNode);
 
         ClassNode classNode = controller.getClassNode();
@@ -124,7 +125,7 @@ public class StaticTypesLambdaWriter extends LambdaWriter {
                 createBootstrapMethod(isInterface),
                 createBootstrapMethodArguments(abstractMethodDesc, 
lambdaWrapperClassNode, syntheticLambdaMethodNode)
         );
-        operandStack.replace(lambdaType.redirect(), 2);
+        operandStack.replace(redirect, 2);
 
         if (null != expression.getNodeMetaData(INFERRED_LAMBDA_TYPE)) {
             // FIXME declaring variable whose initial value is a lambda, e.g. 
`Function<Integer, String> f = (Integer e) -> 'a' + e`

Reply via email to