From 91a90af7673ade24edbb7c378b2a3b46fcf8e78a Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Thu, 22 Jul 2010 15:45:49 +0000 Subject: [PATCH] compiler/generics warnings & a typo git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@966711 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/commons/lang3/event/EventUtils.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/event/EventUtils.java b/src/main/java/org/apache/commons/lang3/event/EventUtils.java index d9169eef5..55be8fe23 100644 --- a/src/main/java/org/apache/commons/lang3/event/EventUtils.java +++ b/src/main/java/org/apache/commons/lang3/event/EventUtils.java @@ -51,7 +51,7 @@ public static void addEventListener(Object eventSource, Class listenerTyp } catch (IllegalAccessException e) { - throw new IllegalArgumentException("Class " + eventSource.getClass().getName() + " does not have an accesible add" + listenerType.getSimpleName () + " method which takes a parameter of type " + listenerType.getName() + "."); + throw new IllegalArgumentException("Class " + eventSource.getClass().getName() + " does not have an accessible add" + listenerType.getSimpleName () + " method which takes a parameter of type " + listenerType.getName() + "."); } catch (InvocationTargetException e) { @@ -62,6 +62,7 @@ public static void addEventListener(Object eventSource, Class listenerTyp /** * Binds an event listener to a specific method on a specific object. * + * @param * @param target the target object * @param methodName the name of the method to be called * @param eventSource the object which is generating events (JButton, JList, etc.) @@ -69,9 +70,9 @@ public static void addEventListener(Object eventSource, Class listenerTyp * @param eventTypes the event types (method names) from the listener interface (if none specified, all will be * supported) */ - public static void bindEventsToMethod(Object target, String methodName, Object eventSource, Class listenerType, String... eventTypes) + public static void bindEventsToMethod(Object target, String methodName, Object eventSource, Class listenerType, String... eventTypes) { - final Object listener = Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerType }, new EventBindingInvocationHandler(target, methodName, eventTypes)); + final L listener = listenerType.cast(Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerType }, new EventBindingInvocationHandler(target, methodName, eventTypes))); addEventListener(eventSource, listenerType, listener); }