Thu, 23 Jan 2014 06:34:53 -0800
8031023: [javac] LambdaToMethod is missing forceSerializedRepresentation logic and switch
Reviewed-by: jjg, rfield
src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Jan 23 14:09:29 2014 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Jan 23 06:34:53 2014 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -96,6 +96,9 @@ 1.11 /** dump statistics about lambda code generation */ 1.12 private boolean dumpLambdaToMethodStats; 1.13 1.14 + /** force serializable representation, for stress testing **/ 1.15 + private final boolean forceSerializable; 1.16 + 1.17 /** Flag for alternate metafactories indicating the lambda object is intended to be serializable */ 1.18 public static final int FLAG_SERIALIZABLE = 1 << 0; 1.19 1.20 @@ -131,6 +134,7 @@ 1.21 Options options = Options.instance(context); 1.22 dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats"); 1.23 attr = Attr.instance(context); 1.24 + forceSerializable = options.isSet("forceSerializable"); 1.25 } 1.26 // </editor-fold> 1.27 1.28 @@ -1694,6 +1698,9 @@ 1.29 1.30 /** does this functional expression require serialization support? */ 1.31 boolean isSerializable() { 1.32 + if (forceSerializable) { 1.33 + return true; 1.34 + } 1.35 for (Type target : tree.targets) { 1.36 if (types.asSuper(target, syms.serializableType.tsym) != null) { 1.37 return true;