1559N/A/*
2362N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1559N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1559N/A *
1559N/A * This code is free software; you can redistribute it and/or modify it
1559N/A * under the terms of the GNU General Public License version 2 only, as
1559N/A * published by the Free Software Foundation.
1559N/A *
1559N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1559N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1559N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1559N/A * version 2 for more details (a copy is included in the LICENSE file that
1559N/A * accompanied this code).
1559N/A *
1559N/A * You should have received a copy of the GNU General Public License version
1559N/A * 2 along with this work; if not, write to the Free Software Foundation,
1559N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1559N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1559N/A */
1559N/A
1559N/A/*
1559N/A * @test
1559N/A * @bug 6868189
1559N/A * @summary Tests custom BeanInfo in the same package
1559N/A * @author Sergey Malenkov
1559N/A */
1559N/A
1559N/Aimport java.beans.IntrospectionException;
1559N/Aimport java.beans.Introspector;
1559N/Aimport java.beans.PropertyDescriptor;
1559N/Aimport java.beans.SimpleBeanInfo;
1559N/A
1559N/Apublic class Test6868189 {
1559N/A
1559N/A private static final String PROPERTY = "$?"; // NON-NLS: the property name
1559N/A private static final String GETTER = "name"; // NON-NLS: the method name
1559N/A private static final String SETTER = null;
1559N/A
1559N/A public static void main(String[] args) throws IntrospectionException {
1559N/A PropertyDescriptor[] pds = Introspector.getBeanInfo(Enumeration.class).getPropertyDescriptors();
1559N/A if ((pds.length != 1)|| !PROPERTY.equals(pds[0].getName())){
1559N/A throw new Error("unexpected property");
1559N/A }
1559N/A }
1559N/A
1559N/A public enum Enumeration {
1559N/A FIRST, SECOND
1559N/A }
1559N/A
1559N/A public static class EnumerationBeanInfo extends SimpleBeanInfo {
1559N/A @Override
1559N/A public PropertyDescriptor[] getPropertyDescriptors() {
1559N/A try {
1559N/A return new PropertyDescriptor[] {
1559N/A new PropertyDescriptor(PROPERTY, Enumeration.class, GETTER, SETTER)
1559N/A };
1559N/A }
1559N/A catch (IntrospectionException exception) {
1559N/A throw new Error("unexpected exception", exception);
1559N/A }
1559N/A }
1559N/A }
1559N/A}