8160915: javac, option forceSerializable should be restored
authorvromero
Wed, 06 Jul 2016 12:46:37 -0700
changeset 39588 a30039aaca6c
parent 39587 76c453568ffa
child 39589 0cbaed77814c
8160915: javac, option forceSerializable should be restored Reviewed-by: jjg
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jul 06 09:42:27 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jul 06 12:46:37 2016 -0700
@@ -106,6 +106,9 @@
     /** dump statistics about lambda code generation */
     private boolean dumpLambdaToMethodStats;
 
+    /** force serializable representation, for stress testing **/
+    private final boolean forceSerializable;
+
     /** Flag for alternate metafactories indicating the lambda object is intended to be serializable */
     public static final int FLAG_SERIALIZABLE = 1 << 0;
 
@@ -141,6 +144,7 @@
         Options options = Options.instance(context);
         dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
         attr = Attr.instance(context);
+        forceSerializable = options.isSet("forceSerializable");
     }
     // </editor-fold>
 
@@ -1825,6 +1829,9 @@
 
             /** does this functional expression require serialization support? */
             boolean isSerializable() {
+                if (forceSerializable) {
+                    return true;
+                }
                 for (Type target : tree.targets) {
                     if (types.asSuper(target, syms.serializableType.tsym) != null) {
                         return true;