author | ohair |
Tue, 25 May 2010 15:58:33 -0700 | |
changeset 5506 | 202f599c92aa |
parent 4391 | b31fdb74b4a4 |
permissions | -rw-r--r-- |
1851
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
1 |
/* |
5506 | 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 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
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 EventHandler |
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 javax.swing.JButton; |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
32 |
import java.awt.event.ActionListener; |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
33 |
import java.beans.EventHandler; |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
34 |
|
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
35 |
public class Test6788531 { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
36 |
public static void main(String[] args) throws Exception { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
37 |
JButton button = new JButton("hi"); |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
38 |
button.addActionListener(EventHandler.create(ActionListener.class, new Private(), "run")); |
4391
b31fdb74b4a4
6905516: Test failed: java/beans/EventHandler/Test6788531.java
malenkov
parents:
1851
diff
changeset
|
39 |
button.addActionListener(EventHandler.create(ActionListener.class, new PrivateGeneric(), "run", "actionCommand")); |
1851
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
40 |
button.doClick(); |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
41 |
} |
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 |
public static class Public { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
44 |
public void run() { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
45 |
throw new Error("method is overridden"); |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
46 |
} |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
47 |
} |
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 |
static class Private extends Public { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
50 |
public void run() { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
51 |
System.out.println("default"); |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
52 |
} |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
53 |
} |
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 |
public static class PublicGeneric<T> { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
56 |
public void run(T object) { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
57 |
throw new Error("method is overridden"); |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
58 |
} |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
59 |
} |
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 |
static class PrivateGeneric extends PublicGeneric<String> { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
62 |
public void run(String string) { |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
63 |
System.out.println(string); |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
64 |
} |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
65 |
} |
8203c7eb8caf
6788531: java.beans.Statement imposes excessive access control
malenkov
parents:
diff
changeset
|
66 |
} |