harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r410697 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/EventHandler.java test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
Date Wed, 31 May 2006 22:44:00 GMT
Author: tellison
Date: Wed May 31 15:44:00 2006
New Revision: 410697

URL: http://svn.apache.org/viewvc?rev=410697&view=rev
Log:
Generics update for EventHandler
Remove test that becomes a compile-time check

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java?rev=410697&r1=410696&r2=410697&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
Wed May 31 15:44:00 2006
@@ -115,13 +115,13 @@
     /**
      * @com.intel.drl.spec_ref
      */
-    public static Object create(
-            Class listenerInterface,
+    public static <T> T create(
+            Class<T> listenerInterface,
             Object target,
             String action,
             String eventPropertyName,
             String listenerMethodName) {
-        return Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerInterface
},
+        return (T)Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[]
{ listenerInterface },
                new EventHandler(target, action, eventPropertyName,
                        listenerMethodName));
     }
@@ -129,23 +129,23 @@
     /**
      * @com.intel.drl.spec_ref
      */
-    public static Object create(
-            Class listenerInterface,
+    public static <T> T create(
+            Class<T> listenerInterface,
             Object target,
             String action,
             String eventPropertyName) {
-        return Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerInterface
},
+        return (T)Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[]
{ listenerInterface },
             new EventHandler(target, action, eventPropertyName, null));
     }
 
     /**
      * @com.intel.drl.spec_ref
      */
-    public static Object create(
-            Class listenerInterface,
+    public static <T> T create(
+            Class<T> listenerInterface,
             Object target,
             String action) {
-        return Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerInterface
},
+        return (T)Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[]
{ listenerInterface },
             new EventHandler(target, action, null, null));
     }
     

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java?rev=410697&r1=410696&r2=410697&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
Wed May 31 15:44:00 2006
@@ -426,20 +426,6 @@
 	}
 
 	/*
-	 * listenerInterface is not a interface
-	 */
-	public void testCreateClassObjectStringString_ClassInvalid() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		try {
-			PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-					.create(String.class, target, "text", "source.label");
-			fail("Should throw IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-		}
-	}
-
-	/*
 	 * the target object is null
 	 */
 	public void testCreateClassObjectStringString_TargetNull() {



Mime
View raw message