Author: kentam
Date: Wed Jul 28 15:46:14 2004
New Revision: 30882

Modified:
   
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java
Log:
Add build error for malformed public interface inheritance chain.



Modified: 
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java
==============================================================================
--- 
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java
     (original)
+++ 
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java
     Wed Jul 28 15:46:14 2004
@@ -97,6 +97,16 @@
             }
         }
 
+        // At this point, we're processing the root of the interface heirarchy,
+        // which is not permitted to be a ControlExtension (that would imply a
+        // ControlExtension that wasn't actually extending a ControlInterface).
+        if ( isExtension() )
+        {
+            _env.getMessager().printError(_intfDecl.getPosition(),
+              "Interfaces annotated with ControlExtension must extend an 
interface annotated with " +
+              "ControlInterface");
+        }
+            
         return null;
     }
 
@@ -251,7 +261,8 @@
      * Returns the most-derived interface in the inheritance chain that is 
annotated
      * with @ControlInterface.  It represents the point in the inheritance 
chain where
      * @ControlInterface becomes @ControlExtension (i.e., anything interface 
derived from
-     * the 'most-derived interface' is annotated with @ControlExtension).
+     * the 'most-derived interface' is annotated with @ControlExtension).  May 
return 
+     * null if the inheritance chain is malformed.
      */
     public ControlInterface getMostDerivedInterface()
     {
@@ -274,8 +285,6 @@
             ancestor = ancestor.getSuperClass();
         }
 
-        assert ( ancestor != null ) : "@ControlExtension not rooted in 
@ControlInterface, should have been caught earlier";
-
         return ancestor;
     }
 
@@ -322,9 +331,10 @@
         // Find the nearest @ControlInterface, which is where the relevant 
control checker
         // annotation will be found.
         //
-        //
 
         AptControlInterface mostDerived = (AptControlInterface) 
getMostDerivedInterface();
+        if ( mostDerived == null )
+            return;
 
         InterfaceDeclaration intfDecl = mostDerived._intfDecl;
 

Reply via email to