changeset 3169:2142f0a91b49

8031023: [javac] LambdaToMethod is missing forceSerializedRepresentation logic and switch Reviewed-by: jjg, rfield
author ksrini
date Thu, 23 Jan 2014 06:34:53 -0800
parents 7c6f3d0e5fa3
children 0868788af55b
files src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jan 22 14:45:51 2014 -0800
+++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Jan 23 06:34:53 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,6 +96,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;
 
@@ -130,6 +133,7 @@
         Options options = Options.instance(context);
         dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
         attr = Attr.instance(context);
+        forceSerializable = options.isSet("forceSerializable");
     }
     // </editor-fold>
 
@@ -1692,6 +1696,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;