2
|
1 |
/*
|
|
2 |
* Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
* @test
|
|
26 |
* @bug 6311051
|
|
27 |
* @run main/othervm -XX:SoftRefLRUPolicyMSPerMB=0 Test6311051
|
|
28 |
* @summary Tests listener method with many paramenters
|
|
29 |
* @author Peter Zhelezniakov
|
|
30 |
*/
|
|
31 |
|
|
32 |
import java.beans.EventSetDescriptor;
|
|
33 |
import java.beans.IntrospectionException;
|
|
34 |
import java.lang.reflect.Method;
|
|
35 |
import java.util.EventObject;
|
|
36 |
|
|
37 |
public class Test6311051 {
|
|
38 |
public static void main(String[] args) throws IntrospectionException, NoSuchMethodException {
|
|
39 |
EventSetDescriptor esd = new EventSetDescriptor(
|
|
40 |
"foo",
|
|
41 |
FooListener.class,
|
|
42 |
new Method[] {
|
|
43 |
FooListener.class.getMethod("fooHappened", EventObject.class),
|
|
44 |
FooListener.class.getMethod("moreFooHappened", EventObject.class, Object.class),
|
|
45 |
FooListener.class.getMethod("lessFooHappened"),
|
|
46 |
},
|
|
47 |
Bean.class.getMethod("addFooListener", FooListener.class),
|
|
48 |
Bean.class.getMethod("removeFooListener", FooListener.class)
|
|
49 |
);
|
|
50 |
System.gc();
|
|
51 |
for (Method method : esd.getListenerMethods()) {
|
|
52 |
System.out.println(method);
|
|
53 |
}
|
|
54 |
}
|
|
55 |
|
|
56 |
public static class Bean {
|
|
57 |
public void addFooListener(FooListener listener) {
|
|
58 |
}
|
|
59 |
|
|
60 |
public void removeFooListener(FooListener listener) {
|
|
61 |
}
|
|
62 |
}
|
|
63 |
|
|
64 |
public static interface FooListener {
|
|
65 |
void fooHappened(EventObject event);
|
|
66 |
|
|
67 |
void moreFooHappened(EventObject event, Object data);
|
|
68 |
|
|
69 |
void lessFooHappened();
|
|
70 |
}
|
|
71 |
}
|