Sat, 22 Dec 2018 13:10:38 -0800
Added tag jdk8u202-b25 for changeset 15d8c732039b
strarup@1594 | 1 | /* |
strarup@1594 | 2 | * Copyright (c) 2013, 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 |
strarup@1594 | 26 | * @bug 8006582 |
strarup@1594 | 27 | * @summary javac should generate method parameters correctly. |
strarup@1594 | 28 | * @build Tester |
strarup@1594 | 29 | * @compile -parameters AnonymousClass.java |
mnunez@2137 | 30 | * @run main Tester AnonymousClass AnonymousClass.out |
strarup@1594 | 31 | */ |
strarup@1594 | 32 | |
strarup@1594 | 33 | class AnonymousClass { |
strarup@1594 | 34 | |
strarup@1594 | 35 | interface I<T> { |
strarup@1594 | 36 | T m(); |
strarup@1594 | 37 | T m(T x, T yx); |
strarup@1594 | 38 | } |
strarup@1594 | 39 | |
strarup@1594 | 40 | private class Inner implements I<String> { |
strarup@1594 | 41 | public Inner() { } |
strarup@1594 | 42 | public Inner(String arg, String barg) { } |
strarup@1594 | 43 | public String m() { return "0"; } |
strarup@1594 | 44 | public String m(String s, String ts) { return "0"; } |
strarup@1594 | 45 | } |
strarup@1594 | 46 | |
strarup@1594 | 47 | public static class Sinner implements I<Long> { |
strarup@1594 | 48 | public Sinner() { } |
strarup@1594 | 49 | public Sinner(Long arg, Long barg) { } |
strarup@1594 | 50 | public Long m() { return 0L; } |
strarup@1594 | 51 | public Long m(Long s, Long ts) { return s + ts; } |
strarup@1594 | 52 | } |
strarup@1594 | 53 | |
strarup@1594 | 54 | /** Inner class in constructor context */ |
strarup@1594 | 55 | public AnonymousClass(final Long a, Long ba) { |
strarup@1594 | 56 | new I<Long>() { |
strarup@1594 | 57 | public Long m() { return null; } |
strarup@1594 | 58 | public Long m(Long i, Long ji) { return i + ji; } |
strarup@1594 | 59 | }.m(a, ba); |
strarup@1594 | 60 | new Inner() { |
strarup@1594 | 61 | public String m() { return null; } |
strarup@1594 | 62 | public String m(String i, String ji) { return i + ji; } |
strarup@1594 | 63 | }.m(a.toString(), ba.toString()); |
strarup@1594 | 64 | new Inner(a.toString(), ba.toString()) { |
strarup@1594 | 65 | public String m() { return null; } |
strarup@1594 | 66 | public String m(String i, String ji) { return i + ji; } |
strarup@1594 | 67 | }.m(a.toString(), ba.toString()); |
strarup@1594 | 68 | new Sinner() { |
strarup@1594 | 69 | public Long m() { return null; } |
strarup@1594 | 70 | public Long m(Long i, Long ji) { return i + ji; } |
strarup@1594 | 71 | }.m(a, ba); |
strarup@1594 | 72 | new Sinner(a, ba) { |
strarup@1594 | 73 | public Long m() { return null; } |
strarup@1594 | 74 | public Long m(Long i, Long ji) { return i + ji; } |
strarup@1594 | 75 | }.m(a, ba); |
strarup@1594 | 76 | } |
strarup@1594 | 77 | |
strarup@1594 | 78 | /** Inner class in method context */ |
strarup@1594 | 79 | public void foo(final Long a, Long ba) { |
strarup@1594 | 80 | new I<Long>() { |
strarup@1594 | 81 | public Long m() { return null; } |
strarup@1594 | 82 | public Long m(Long i, Long ji) { return i + ji; } |
strarup@1594 | 83 | }.m(a, ba); |
strarup@1594 | 84 | new Inner() { |
strarup@1594 | 85 | public String m() { return null; } |
strarup@1594 | 86 | public String m(String i, String ji) { return i + ji; } |
strarup@1594 | 87 | }.m(a.toString(), ba.toString()); |
strarup@1594 | 88 | new Inner(a.toString(), ba.toString()) { |
strarup@1594 | 89 | public String m() { return null; } |
strarup@1594 | 90 | public String m(String i, String ji) { return i + ji; } |
strarup@1594 | 91 | }.m(a.toString(), ba.toString()); |
strarup@1594 | 92 | new Sinner() { |
strarup@1594 | 93 | public Long m() { return null; } |
strarup@1594 | 94 | public Long m(Long i, Long ji) { return i + ji; } |
strarup@1594 | 95 | }.m(a, ba); |
strarup@1594 | 96 | new Sinner(a, ba) { |
strarup@1594 | 97 | public Long m() { return null; } |
strarup@1594 | 98 | public Long m(Long i, Long ji) { return i + ji; } |
strarup@1594 | 99 | }.m(a, ba); |
strarup@1594 | 100 | } |
strarup@1594 | 101 | } |
strarup@1594 | 102 | |
strarup@1594 | 103 | |
strarup@1594 | 104 |