1 /*
2 * Copyright (c) 2014, Oracle and/or its affiliates. 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 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.
22 */
33 import java.beans.PropertyDescriptor;
34 import java.lang.reflect.Array;
35 import java.lang.reflect.Method;
36 import java.util.Arrays;
37 import java.util.Comparator;
38 import java.util.Enumeration;
39 import java.util.Map.Entry;
40 import java.util.Objects;
41 import java.util.TreeMap;
42 import java.util.TreeSet;
43 import java.util.jar.JarEntry;
44 import java.util.jar.JarFile;
45 import java.util.regex.Matcher;
46 import java.util.regex.Pattern;
47
48 /*
49 * @test
50 * @bug 4058433
51 * @summary Generates BeanInfo for public classes in AWT, Accessibility, and Swing
52 * @author Sergey Malenkov
53 * @run main/manual Test4058433
54 */
55
56 public class Test4058433 implements Comparator<Object> {
57 @Override
58 public int compare(Object one, Object two) {
59 if (one instanceof Method && two instanceof Method) {
60 Method oneMethod = (Method) one;
61 Method twoMethod = (Method) two;
62 int result = oneMethod.getName().compareTo(twoMethod.getName());
63 if (result != 0) {
64 return result;
65 }
66 }
67 if (one instanceof FeatureDescriptor && two instanceof FeatureDescriptor) {
68 FeatureDescriptor oneFD = (FeatureDescriptor) one;
69 FeatureDescriptor twoFD = (FeatureDescriptor) two;
70 int result = oneFD.getName().compareTo(twoFD.getName());
71 if (result != 0) {
72 return result;
|
1 /*
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. 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 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.
22 */
33 import java.beans.PropertyDescriptor;
34 import java.lang.reflect.Array;
35 import java.lang.reflect.Method;
36 import java.util.Arrays;
37 import java.util.Comparator;
38 import java.util.Enumeration;
39 import java.util.Map.Entry;
40 import java.util.Objects;
41 import java.util.TreeMap;
42 import java.util.TreeSet;
43 import java.util.jar.JarEntry;
44 import java.util.jar.JarFile;
45 import java.util.regex.Matcher;
46 import java.util.regex.Pattern;
47
48 /*
49 * @test
50 * @bug 4058433
51 * @summary Generates BeanInfo for public classes in AWT, Accessibility, and Swing
52 * @author Sergey Malenkov
53 * @modules java.base/sun.reflect.generics.reflectiveObjects
54 * java.desktop/com.sun.beans
55 * java.desktop/com.sun.beans.util
56 * @run main/manual Test4058433
57 */
58
59 public class Test4058433 implements Comparator<Object> {
60 @Override
61 public int compare(Object one, Object two) {
62 if (one instanceof Method && two instanceof Method) {
63 Method oneMethod = (Method) one;
64 Method twoMethod = (Method) two;
65 int result = oneMethod.getName().compareTo(twoMethod.getName());
66 if (result != 0) {
67 return result;
68 }
69 }
70 if (one instanceof FeatureDescriptor && two instanceof FeatureDescriptor) {
71 FeatureDescriptor oneFD = (FeatureDescriptor) one;
72 FeatureDescriptor twoFD = (FeatureDescriptor) two;
73 int result = oneFD.getName().compareTo(twoFD.getName());
74 if (result != 0) {
75 return result;
|