beehive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ky...@apache.org
Subject svn commit: r124168 - /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java /incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
Date Tue, 04 Jan 2005 23:02:11 GMT
Author: kylem
Date: Tue Jan  4 15:02:10 2005
New Revision: 124168

URL: http://svn.apache.org/viewcvs?view=rev&rev=124168
Log:
Fix for BEEHIVE-152, related to @EventHandler annotation validation.  There were two basic
issues:

- Validation of the 'eventSet' attribute needs to search up the interface extension hierarchy.
- Validation of the 'eventMethod' attribute needs to search up the EventSet interface extension
hierarchy.


Modified:
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java?view=diff&rev=124168&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java&r1=124167&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java&r2=124168
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlClient.java
Tue Jan  4 15:02:10 2005
@@ -277,29 +277,44 @@
             boolean found = false;
             String eventName = (String)handlerAnnot.getObjectValue("eventName");
             AptMethod handlerMethod = new AptMethod(clientMethod, _env);
-            for (AptEvent controlEvent : eventSet.getEvents())
+
+            //
+            // Will start at the currrent event set and look up through any ones it
+            // extends to try and find a matching event
+            //
+            while (eventSet != null)
             {
-                if (controlEvent == null || 
-                    controlEvent.getName() == null || 
-                    !controlEvent.getName().equals(eventName))
-                    continue;
+                for (AptEvent controlEvent : eventSet.getEvents())
+                {
+                    if (controlEvent == null || 
+                        controlEvent.getName() == null || 
+                        !controlEvent.getName().equals(eventName))
+                        continue;
 
-                if ( controlEvent.getArgTypes() == null )
-                    continue;
+                    if ( controlEvent.getArgTypes() == null )
+                        continue;
 
-                //
-                // BUGBUG: If the arguments are parameterized, then the event handler
-                // might declare a specific bound version of the type, so a direct
-                // comparison will fail.  If parameterized, we don't validate.
-                //
-                if (controlEvent.hasParameterizedArguments() ||
-                    controlEvent.getArgTypes().equals(handlerMethod.getArgTypes()))
-                {
-                    adaptor.addHandler(controlEvent, 
+                    //
+                    // BUGBUG: If the arguments are parameterized, then the event handler
+                    // might declare a specific bound version of the type, so a direct
+                    // comparison will fail.  If parameterized, we don't validate.
+                    //
+                    if (controlEvent.hasParameterizedArguments() ||
+                        controlEvent.getArgTypes().equals(handlerMethod.getArgTypes()))
+                    {
+                        adaptor.addHandler(controlEvent, 
                                        new AptEventHandler(controlEvent, clientMethod, _env));
-                    found = true;
-                    break;
+                        found = true;
+                        break;
+                    }
                 }
+                if (found)  // outer loop too
+                    break;
+
+                //
+                // Look up on the super event set if not found at the current level
+                //
+                eventSet = eventSet.getSuperEventSet();
             }
             if (!found)
             {

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java?view=diff&rev=124168&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java&r1=124167&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java&r2=124168
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
Tue Jan  4 15:02:10 2005
@@ -465,6 +465,10 @@
         for (AptEventSet eventSet: getEventSets())
             if (eventSet.getClassName().equals(name))
                 return eventSet;
+
+        if (_superClass != null)
+            return _superClass.getEventSet(name);
+
         return null;
     }
 

Mime
View raw message