Fri, 24 Apr 2020 03:58:51 +0100
Merge
strarup@1594 | 1 | /* |
jlahoda@2801 | 2 | * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
strarup@1594 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
strarup@1594 | 4 | * |
strarup@1594 | 5 | * This code is free software; you can redistribute it and/or modify it |
strarup@1594 | 6 | * under the terms of the GNU General Public License version 2 only, as |
strarup@1594 | 7 | * published by the Free Software Foundation. |
strarup@1594 | 8 | * |
strarup@1594 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
strarup@1594 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
strarup@1594 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
strarup@1594 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
strarup@1594 | 13 | * accompanied this code). |
strarup@1594 | 14 | * |
strarup@1594 | 15 | * You should have received a copy of the GNU General Public License version |
strarup@1594 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
strarup@1594 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
strarup@1594 | 18 | * |
strarup@1594 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
strarup@1594 | 20 | * or visit www.oracle.com if you need additional information or have any |
strarup@1594 | 21 | * questions. |
strarup@1594 | 22 | */ |
strarup@1594 | 23 | |
strarup@1594 | 24 | /* |
strarup@1594 | 25 | * @test |
jlahoda@2733 | 26 | * @bug 8006582 8037546 |
strarup@1594 | 27 | * @summary javac should generate method parameters correctly. |
strarup@1594 | 28 | * @build Tester |
strarup@1594 | 29 | * @compile -parameters LambdaTest.java |
mnunez@2137 | 30 | * @run main Tester LambdaTest LambdaTest.out |
strarup@1594 | 31 | */ |
strarup@1594 | 32 | |
strarup@1594 | 33 | /** |
jlahoda@2733 | 34 | * Post https://bugs.openjdk.java.net/browse/JDK-8037546, this test verifies |
jlahoda@2733 | 35 | * that MethodParameters attribute for lambdas are emitted properly. |
strarup@1594 | 36 | */ |
strarup@1594 | 37 | class LambdaTest { |
strarup@1594 | 38 | |
strarup@1594 | 39 | interface I { |
strarup@1594 | 40 | int m(int x); |
strarup@1594 | 41 | } |
strarup@1594 | 42 | |
strarup@1594 | 43 | static int foo(I i) { return i.m(0); } |
strarup@1594 | 44 | |
strarup@1594 | 45 | static { |
strarup@1594 | 46 | foo((int x1) -> { return foo((int x2) -> { return x1 + x2; }); }); |
strarup@1594 | 47 | } |
strarup@1594 | 48 | } |
strarup@1594 | 49 | |
strarup@1594 | 50 | |
strarup@1594 | 51 |