test/jdk/java/beans/Introspector/Test7192955.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 15990 jdk/test/java/beans/Introspector/Test7192955.java@057010ebd827
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13650
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
     1
/*
15990
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
     2
 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
13650
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
     4
 *
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
     8
 *
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    13
 * accompanied this code).
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    14
 *
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    18
 *
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    21
 * questions.
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    22
 */
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    23
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    24
/*
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    25
 * @test
15990
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    26
 * @bug 7192955 8000183
13650
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    27
 * @summary Tests that all properties are bound
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    28
 * @author Sergey Malenkov
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    29
 */
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    30
15990
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    31
import java.beans.IntrospectionException;
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    32
import java.beans.Introspector;
13650
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    33
import java.beans.PropertyChangeListener;
15990
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    34
import java.beans.PropertyDescriptor;
13650
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    35
import java.util.List;
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    36
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    37
public class Test7192955 {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    38
15990
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    39
    public static void main(String[] args) throws IntrospectionException {
13650
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    40
        if (!BeanUtils.findPropertyDescriptor(MyBean.class, "test").isBound()) {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    41
            throw new Error("a simple property is not bound");
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    42
        }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    43
        if (!BeanUtils.findPropertyDescriptor(MyBean.class, "list").isBound()) {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    44
            throw new Error("a generic property is not bound");
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    45
        }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    46
        if (!BeanUtils.findPropertyDescriptor(MyBean.class, "readOnly").isBound()) {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    47
            throw new Error("a read-only property is not bound");
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    48
        }
15990
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    49
        PropertyDescriptor[] pds = Introspector.getBeanInfo(MyBean.class, BaseBean.class).getPropertyDescriptors();
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    50
        for (PropertyDescriptor pd : pds) {
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    51
            if (pd.getName().equals("test") && pd.isBound()) {
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    52
                throw new Error("a simple property is bound without superclass");
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    53
            }
057010ebd827 7163696: JCK Swing interactive test JScrollBarTest0013 fails with Nimbus and GTK L&Fs
malenkov
parents: 13650
diff changeset
    54
        }
13650
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    55
    }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    56
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    57
    public static class BaseBean {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    58
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    59
        private List<String> list;
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    60
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    61
        public List<String> getList() {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    62
            return this.list;
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    63
        }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    64
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    65
        public void setList(List<String> list) {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    66
            this.list = list;
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    67
        }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    68
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    69
        public void addPropertyChangeListener(PropertyChangeListener listener) {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    70
        }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    71
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    72
        public void removePropertyChangeListener(PropertyChangeListener listener) {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    73
        }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    74
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    75
        public List<String> getReadOnly() {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    76
            return this.list;
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    77
        }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    78
    }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    79
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    80
    public static class MyBean extends BaseBean {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    81
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    82
        private String test;
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    83
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    84
        public String getTest() {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    85
            return this.test;
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    86
        }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    87
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    88
        public void setTest(String test) {
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    89
            this.test = test;
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    90
        }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    91
    }
0cf56ea6f0c6 7192955: Introspector overide PropertyDescriptor for generic type field defined in super class
malenkov
parents:
diff changeset
    92
}