test/tools/javac/lambda/8068430/T8068430.java

Thu, 26 Mar 2015 11:34:50 +0100

author
jlahoda
date
Thu, 26 Mar 2015 11:34:50 +0100
changeset 2734
ba758e1ffa69
parent 2730
a513711d6171
permissions
-rw-r--r--

8054220: Debugger doesn't show variables *outside* lambda
8058227: Debugger has no access to outer variables inside Lambda
Summary: Put local variables captured by lambda into the lambda method's LocalVariableTable.
Reviewed-by: mcimadamore, rfield

vromero@2730 1 /*
vromero@2730 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
vromero@2730 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
vromero@2730 4 *
vromero@2730 5 * This code is free software; you can redistribute it and/or modify it
vromero@2730 6 * under the terms of the GNU General Public License version 2 only, as
vromero@2730 7 * published by the Free Software Foundation. Oracle designates this
vromero@2730 8 * particular file as subject to the "Classpath" exception as provided
vromero@2730 9 * by Oracle in the LICENSE file that accompanied this code.
vromero@2730 10 *
vromero@2730 11 * This code is distributed in the hope that it will be useful, but WITHOUT
vromero@2730 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
vromero@2730 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
vromero@2730 14 * version 2 for more details (a copy is included in the LICENSE file that
vromero@2730 15 * accompanied this code).
vromero@2730 16 *
vromero@2730 17 * You should have received a copy of the GNU General Public License version
vromero@2730 18 * 2 along with this work; if not, write to the Free Software Foundation,
vromero@2730 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
vromero@2730 20 *
vromero@2730 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
vromero@2730 22 * or visit www.oracle.com if you need additional information or have any
vromero@2730 23 * questions.
vromero@2730 24 */
vromero@2730 25
vromero@2730 26 /*
vromero@2730 27 * @test
vromero@2730 28 * @bug 8068430
vromero@2730 29 * @summary structural most specific and stuckness
vromero@2730 30 */
vromero@2730 31
vromero@2730 32 import java.util.HashMap;
vromero@2730 33 import java.util.Map;
vromero@2730 34
vromero@2730 35 public class T8068430 {
vromero@2730 36 public static void main(String[] args) {
vromero@2730 37 Map<Integer, String> mp = new HashMap<>();
vromero@2730 38 mp.put(1, "a");
vromero@2730 39 mp.put(2, "b");
vromero@2730 40 mp.put(3, "c");
vromero@2730 41 mp.put(4, "d");
vromero@2730 42 System.out.println(mp.entrySet().stream().reduce(0,
vromero@2730 43 (i, e) -> i + e.getKey(),
vromero@2730 44 (i1, i2) -> i1 + i2));
vromero@2730 45 }
vromero@2730 46 }

mercurial