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 2019/12/11 10:01:13 UTC

[groovy] branch master updated: Add `serialVersionUID` field only for serializable lambda

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 3113667  Add `serialVersionUID` field only for serializable lambda
3113667 is described below

commit 3113667be88ef15a53d4e724022bba3edf3481bb
Author: Daniel Sun <su...@apache.org>
AuthorDate: Wed Dec 11 18:00:36 2019 +0800

    Add `serialVersionUID` field only for serializable lambda
---
 .../org/codehaus/groovy/classgen/asm/sc/StaticTypesLambdaWriter.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 a80c5c8..8f2fe0c 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
@@ -282,7 +282,9 @@ public class StaticTypesLambdaWriter extends LambdaWriter implements AbstractFun
         answer.setUsingGenerics(outerClass.isUsingGenerics());
         answer.setSourcePosition(expression);
 
-        addSerialVersionUIDField(answer);
+        if (expression.isSerializable()) {
+            addSerialVersionUIDField(answer);
+        }
 
         if (staticMethodOrInStaticClass) {
             answer.setStaticClass(true);