langtools/test/tools/javac/MethodParameters/MemberClassTest.java
author emc
Thu, 22 Aug 2013 12:47:46 -0400
changeset 19657 48226ff07b84
parent 16315 3e29f09420ca
child 21044 ffba9cdeff1a
permissions -rw-r--r--
8020745: Suspicious MethodParameters attribute generated for local classes capturing local variables Summary: Corrected an error in a previous patch that caused captured locals to be added to the beginning, not the end of a parameter list. Reviewed-by: jjg, mcimadamore, ksrini, abuckley
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16307
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
     1
/*
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
     4
 *
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
     8
 *
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    13
 * accompanied this code).
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    14
 *
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    18
 *
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    21
 * questions.
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    22
 */
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    23
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    24
/*
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    25
 * @test
16315
3e29f09420ca 8008658: Four new method param jtreg tests fail in nightly tests
ksrini
parents: 16307
diff changeset
    26
 * @bug 8006582 8008658
16307
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    27
 * @summary javac should generate method parameters correctly.
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    28
 * @build Tester
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    29
 * @compile -parameters MemberClassTest.java
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    30
 * @run main Tester MemberClassTest
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    31
 */
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    32
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    33
class MemberClassTest {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    34
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    35
    interface I {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    36
        Long m();
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    37
        Long m(Long x, Long yx);
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    38
    }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    39
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    40
    public class Member implements I {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    41
        public class Member_Member {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    42
            public Member_Member() {}
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    43
            public Member_Member(String x, String yx) {}
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    44
        }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    45
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    46
        public Member()  { }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    47
        public Member(Long a, Long ba)  { }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    48
        public Long m() { return 0L; }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    49
        public Long m(Long s, Long ts) { return 0L; }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    50
    }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    51
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    52
    static class Static_Member implements I {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    53
        public class Static_Member_Member {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    54
            public Static_Member_Member() {}
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    55
            public Static_Member_Member(String x, String yx) {}
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    56
        }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    57
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    58
        public static class Static_Member_Static_Member {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    59
            public Static_Member_Static_Member() {}
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    60
            public Static_Member_Static_Member(String x, String yx) {}
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    61
        }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    62
        public Static_Member()  { }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    63
        public Static_Member(Long arg, Long barg)  { }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    64
        public Long m() { return 0L; }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    65
        public Long m(Long s, Long ts) { return s + ts; }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    66
    }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    67
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    68
    public MemberClassTest() {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    69
    }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    70
    public MemberClassTest(final Long a, Long ba) {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    71
    }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    72
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    73
    public void foo() {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    74
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    75
        new I() {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    76
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    77
            class Anonymous_Member {
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    78
                public Anonymous_Member() {}
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    79
                public Anonymous_Member(String x, String yx) {}
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    80
            }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    81
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    82
            public Long m() { return 0L; }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    83
            public Long m(Long s, Long ts) { return s + ts; }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    84
        }.m();
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    85
    }
3027c91f329a 8006582: Test for parameter names feature
strarup
parents:
diff changeset
    86
}