jdk/test/java/beans/Statement/Test6788531.java
author lana
Tue, 23 May 2017 21:11:42 +0000
changeset 45187 331a6542b5b8
parent 5506 202f599c92aa
permissions -rw-r--r--
Added tag jdk-10+7 for changeset d554736d963e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1851
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1851
diff changeset
     2
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1851
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
     4
 *
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
     8
 *
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    13
 * accompanied this code).
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    14
 *
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1851
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1851
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1851
diff changeset
    21
 * questions.
1851
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    22
 */
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    23
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    24
/*
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    25
 * @test
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    26
 * @bug 6788531
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    27
 * @summary Tests public method lookup problem in Statement
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    28
 * @author Sergey Malenkov
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    29
 */
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    30
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    31
import java.beans.Statement;
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    32
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    33
public class Test6788531 {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    34
    public static void main(String[] args) throws Exception {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    35
        new Statement(new Private(), "run", null).execute();
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    36
        new Statement(new PrivateGeneric(), "run", new Object[] {"generic"}).execute();
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    37
    }
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    38
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    39
    public static class Public {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    40
        public void run() {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    41
            throw new Error("method is overridden");
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    42
        }
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    43
    }
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    44
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    45
    static class Private extends Public {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    46
        public void run() {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    47
            System.out.println("default");
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    48
        }
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    49
    }
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    50
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    51
    public static class PublicGeneric<T> {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    52
        public void run(T object) {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    53
            throw new Error("method is overridden");
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    54
        }
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    55
    }
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    56
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    57
    static class PrivateGeneric extends PublicGeneric<String> {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    58
        public void run(String string) {
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    59
            System.out.println(string);
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    60
        }
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    61
    }
8203c7eb8caf 6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff changeset
    62
}