src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java

changeset 2251
bbbef54e3b30
parent 2222
8832b6048e65
child 2358
6a6a8a9860a4
equal deleted inserted replaced
2250:66570bfdbdd7 2251:bbbef54e3b30
1 /* 1 /*
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
94 private KlassInfo kInfo; 94 private KlassInfo kInfo;
95 95
96 /** dump statistics about lambda code generation */ 96 /** dump statistics about lambda code generation */
97 private boolean dumpLambdaToMethodStats; 97 private boolean dumpLambdaToMethodStats;
98 98
99 /** force serializable representation, for stress testing **/
100 private final boolean forceSerializable;
101
99 /** Flag for alternate metafactories indicating the lambda object is intended to be serializable */ 102 /** Flag for alternate metafactories indicating the lambda object is intended to be serializable */
100 public static final int FLAG_SERIALIZABLE = 1 << 0; 103 public static final int FLAG_SERIALIZABLE = 1 << 0;
101 104
102 /** Flag for alternate metafactories indicating the lambda object has multiple targets */ 105 /** Flag for alternate metafactories indicating the lambda object has multiple targets */
103 public static final int FLAG_MARKERS = 1 << 1; 106 public static final int FLAG_MARKERS = 1 << 1;
129 transTypes = TransTypes.instance(context); 132 transTypes = TransTypes.instance(context);
130 analyzer = new LambdaAnalyzerPreprocessor(); 133 analyzer = new LambdaAnalyzerPreprocessor();
131 Options options = Options.instance(context); 134 Options options = Options.instance(context);
132 dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats"); 135 dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
133 attr = Attr.instance(context); 136 attr = Attr.instance(context);
137 forceSerializable = options.isSet("forceSerializable");
134 } 138 }
135 // </editor-fold> 139 // </editor-fold>
136 140
137 private class KlassInfo { 141 private class KlassInfo {
138 142
1692 bridges.length() > 1; 1696 bridges.length() > 1;
1693 } 1697 }
1694 1698
1695 /** does this functional expression require serialization support? */ 1699 /** does this functional expression require serialization support? */
1696 boolean isSerializable() { 1700 boolean isSerializable() {
1701 if (forceSerializable) {
1702 return true;
1703 }
1697 for (Type target : tree.targets) { 1704 for (Type target : tree.targets) {
1698 if (types.asSuper(target, syms.serializableType.tsym) != null) { 1705 if (types.asSuper(target, syms.serializableType.tsym) != null) {
1699 return true; 1706 return true;
1700 } 1707 }
1701 } 1708 }

mercurial