4846N/A/*
4846N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4846N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4846N/A *
4846N/A * This code is free software; you can redistribute it and/or modify it
4846N/A * under the terms of the GNU General Public License version 2 only, as
4846N/A * published by the Free Software Foundation.
4846N/A *
4846N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4846N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4846N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4846N/A * version 2 for more details (a copy is included in the LICENSE file that
4846N/A * accompanied this code).
4846N/A *
4846N/A * You should have received a copy of the GNU General Public License version
4846N/A * 2 along with this work; if not, write to the Free Software Foundation,
4846N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4846N/A *
4846N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4846N/A * or visit www.oracle.com if you need additional information or have any
4846N/A * questions.
4846N/A */
4846N/A
4846N/A/*
4846N/A * @test
4846N/A * @bug 7148143
4846N/A * @summary Tests ClassCastException for the PropertyChangeSupport class
4846N/A * @author Sergey Malenkov
4846N/A */
4846N/A
4846N/Aimport java.beans.PropertyChangeEvent;
4846N/Aimport java.beans.PropertyChangeListener;
4846N/Aimport java.beans.PropertyChangeSupport;
4846N/Aimport java.util.EventListener;
4846N/Aimport java.util.EventListenerProxy;
4846N/A
4846N/Apublic class Test7148143 {
4846N/A
4846N/A private static class CustomProxy
4846N/A extends EventListenerProxy<EventListener>
4846N/A implements PropertyChangeListener {
4846N/A
4846N/A public CustomProxy() {
4846N/A super(new EventListener() {
4846N/A });
4846N/A }
4846N/A
4846N/A public void propertyChange(PropertyChangeEvent event) {
4846N/A }
4846N/A }
4846N/A
4846N/A public static void main(String[] args) {
4846N/A PropertyChangeListener listener = new CustomProxy();
4846N/A PropertyChangeSupport support = new PropertyChangeSupport(listener);
4846N/A support.addPropertyChangeListener(listener);
4846N/A support.addPropertyChangeListener("foo", listener); // cast class exception
4846N/A }
4846N/A}