Index: src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java =================================================================== --- src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java (revision 550451) +++ src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java (working copy) @@ -1143,6 +1143,15 @@ } } } + + /* + * Regression test for HARMONY-4049 + */ + public void testBeanInfo_3() throws IntrospectionException { + BeanInfo beanInfo = Introspector.getBeanInfo(ColorBean.class); + + assertEquals(1, beanInfo.getDefaultEventIndex()); + } public void testPropertySort() throws IntrospectionException { Class beanClass = FakeFox70.class; @@ -1993,4 +2002,67 @@ return new MethodDescriptor[] { md }; } } + + public static class FredBean { + public void addFredListener(FredListener fredListener) + { + } + + public void removeFredListener(FredListener fredListener) + { + } + } + + public static class FredBeanBeanInfo extends SimpleBeanInfo { + + public int getDefaultEventIndex() { + return 0; + } + + public EventSetDescriptor[] getEventSetDescriptors() { + EventSetDescriptor event; + try { + event = new EventSetDescriptor(FredBean.class, "fred", + FredListener.class, "fireFredEvent"); + return new EventSetDescriptor[] { event }; + } catch (IntrospectionException e) { + e.printStackTrace(); + } + return null; + } + } + + public static class ColorBean extends FredBean { + public void addColorListener(ColorListener colorListener) + { + } + + public void removeColorListener(ColorListener colorListener) + { + } + } + + public static class ColorEvent extends EventObject { + + public ColorEvent(Object arg0) { + super(arg0); + + } + } + + public static interface ColorListener extends EventListener { + public void fireColorEvent(FredEvent event); + } + + public static class FredEvent extends EventObject { + + public FredEvent(Object arg0) { + super(arg0); + + } + } + + public static interface FredListener extends EventListener { + public void fireFredEvent(FredEvent event); + } }