strarup@1594: /* strarup@1594: * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. strarup@1594: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. strarup@1594: * strarup@1594: * This code is free software; you can redistribute it and/or modify it strarup@1594: * under the terms of the GNU General Public License version 2 only, as strarup@1594: * published by the Free Software Foundation. strarup@1594: * strarup@1594: * This code is distributed in the hope that it will be useful, but WITHOUT strarup@1594: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or strarup@1594: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License strarup@1594: * version 2 for more details (a copy is included in the LICENSE file that strarup@1594: * accompanied this code). strarup@1594: * strarup@1594: * You should have received a copy of the GNU General Public License version strarup@1594: * 2 along with this work; if not, write to the Free Software Foundation, strarup@1594: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. strarup@1594: * strarup@1594: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA strarup@1594: * or visit www.oracle.com if you need additional information or have any strarup@1594: * questions. strarup@1594: */ strarup@1594: strarup@1594: /* strarup@1594: * @test strarup@1594: * @bug 8006582 strarup@1594: * @summary javac should generate method parameters correctly. strarup@1594: * @build Tester strarup@1594: * @compile -parameters AnonymousClass.java strarup@1594: * @run main Tester AnonymousClass strarup@1594: */ strarup@1594: strarup@1594: class AnonymousClass { strarup@1594: strarup@1594: interface I { strarup@1594: T m(); strarup@1594: T m(T x, T yx); strarup@1594: } strarup@1594: strarup@1594: private class Inner implements I { strarup@1594: public Inner() { } strarup@1594: public Inner(String arg, String barg) { } strarup@1594: public String m() { return "0"; } strarup@1594: public String m(String s, String ts) { return "0"; } strarup@1594: } strarup@1594: strarup@1594: public static class Sinner implements I { strarup@1594: public Sinner() { } strarup@1594: public Sinner(Long arg, Long barg) { } strarup@1594: public Long m() { return 0L; } strarup@1594: public Long m(Long s, Long ts) { return s + ts; } strarup@1594: } strarup@1594: strarup@1594: /** Inner class in constructor context */ strarup@1594: public AnonymousClass(final Long a, Long ba) { strarup@1594: new I() { strarup@1594: public Long m() { return null; } strarup@1594: public Long m(Long i, Long ji) { return i + ji; } strarup@1594: }.m(a, ba); strarup@1594: new Inner() { strarup@1594: public String m() { return null; } strarup@1594: public String m(String i, String ji) { return i + ji; } strarup@1594: }.m(a.toString(), ba.toString()); strarup@1594: new Inner(a.toString(), ba.toString()) { strarup@1594: public String m() { return null; } strarup@1594: public String m(String i, String ji) { return i + ji; } strarup@1594: }.m(a.toString(), ba.toString()); strarup@1594: new Sinner() { strarup@1594: public Long m() { return null; } strarup@1594: public Long m(Long i, Long ji) { return i + ji; } strarup@1594: }.m(a, ba); strarup@1594: new Sinner(a, ba) { strarup@1594: public Long m() { return null; } strarup@1594: public Long m(Long i, Long ji) { return i + ji; } strarup@1594: }.m(a, ba); strarup@1594: } strarup@1594: strarup@1594: /** Inner class in method context */ strarup@1594: public void foo(final Long a, Long ba) { strarup@1594: new I() { strarup@1594: public Long m() { return null; } strarup@1594: public Long m(Long i, Long ji) { return i + ji; } strarup@1594: }.m(a, ba); strarup@1594: new Inner() { strarup@1594: public String m() { return null; } strarup@1594: public String m(String i, String ji) { return i + ji; } strarup@1594: }.m(a.toString(), ba.toString()); strarup@1594: new Inner(a.toString(), ba.toString()) { strarup@1594: public String m() { return null; } strarup@1594: public String m(String i, String ji) { return i + ji; } strarup@1594: }.m(a.toString(), ba.toString()); strarup@1594: new Sinner() { strarup@1594: public Long m() { return null; } strarup@1594: public Long m(Long i, Long ji) { return i + ji; } strarup@1594: }.m(a, ba); strarup@1594: new Sinner(a, ba) { strarup@1594: public Long m() { return null; } strarup@1594: public Long m(Long i, Long ji) { return i + ji; } strarup@1594: }.m(a, ba); strarup@1594: } strarup@1594: } strarup@1594: strarup@1594: strarup@1594: