beehive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ky...@apache.org
Subject svn commit: rev 46958 - incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt
Date Tue, 21 Sep 2004 05:01:34 GMT
Author: kylem
Date: Mon Sep 20 22:01:31 2004
New Revision: 46958

Modified:
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java
Log:
Minor bug fix to Control Interface APT processing.

Contributor: Lawrence Jones


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
Mon Sep 20 22:01:31 2004
@@ -5,9 +5,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,6 +32,7 @@
 import com.sun.mirror.declaration.InterfaceDeclaration;
 import com.sun.mirror.declaration.MethodDeclaration;
 import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.type.DeclaredType;
 import com.sun.mirror.type.InterfaceType;
 import com.sun.mirror.type.TypeMirror;
 
@@ -70,7 +71,7 @@
               "The ControlInterface or ControlExtension annotation may only be used on a
Java interface");
             return;
         }
-        
+
         _intfDecl = (InterfaceDeclaration)decl;
 
         init();
@@ -88,8 +89,8 @@
         //
         if ( _intfDecl.getSuperinterfaces() == null )
             return null;
-        
-        for (InterfaceType intfType : _intfDecl.getSuperinterfaces()) 
+
+        for (InterfaceType intfType : _intfDecl.getSuperinterfaces())
         {
             InterfaceDeclaration superDecl = intfType.getDeclaration();
             if ( superDecl != null )
@@ -112,7 +113,7 @@
               "Interfaces annotated with ControlExtension must extend an interface annotated
with " +
               "ControlInterface");
         }
-            
+
         return null;
     }
 
@@ -122,12 +123,12 @@
     protected ArrayList<ControlOperation> initOperations()
     {
         ArrayList<ControlOperation> operList = new ArrayList<ControlOperation>();
-        
+
         if ( _intfDecl == null )
             return operList;
-        
+
         //
-        // Add the methods from the current interface and all super interfaces *other* 
+        // Add the methods from the current interface and all super interfaces *other*
         // than the one from which control inheritance or extension is defined.  These
         // exceptions are handled on the super ControlInterface (the return value
         // of AptControlInterface.initSuperClass())
@@ -151,13 +152,13 @@
 
             if ( intfDecl.getMethods() == null )
                 continue;
-            
+
             for (MethodDeclaration methodDecl : intfDecl.getMethods())
                 operList.add(new AptOperation(this, methodDecl, _env));
 
             if ( intfDecl.getSuperinterfaces() == null )
                 continue;
-            
+
             for (InterfaceType superType : intfDecl.getSuperinterfaces())
             {
                 InterfaceDeclaration superDecl = superType.getDeclaration();
@@ -175,7 +176,7 @@
     protected ArrayList<ControlPropertySet> initPropertySets()
     {
         ArrayList<ControlPropertySet> propSets = new ArrayList<ControlPropertySet>();
-        
+
         if ( _intfDecl == null || _intfDecl.getNestedTypes() == null )
             return propSets;
 
@@ -215,7 +216,7 @@
     protected ArrayList<ControlEventSet> initEventSets()
     {
         ArrayList<ControlEventSet> eventSets = new ArrayList<ControlEventSet>();
-        
+
         if ( _intfDecl == null || _intfDecl.getNestedTypes() == null )
             return eventSets;
 
@@ -273,7 +274,7 @@
     {
         if ( _intfDecl == null || _intfDecl.getQualifiedName() == null )
             return "";
-        
+
         assert _intfDecl.getQualifiedName().equals( getPackage() + "." + getShortName() );
 
         return _intfDecl.getQualifiedName();
@@ -287,7 +288,7 @@
     {
         if ( _intfDecl == null )
             return false;
-    
+
         return _intfDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlExtension.class)
!= null;
     }
 
@@ -295,7 +296,7 @@
      * 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).  May return 
+     * the 'most-derived interface' is annotated with @ControlExtension).  May return
      * null if the inheritance chain is malformed.
      */
     public ControlInterface getMostDerivedInterface()
@@ -353,7 +354,7 @@
             return new URLClassLoader( urls, ControlChecker.class.getClassLoader() );
         }
 
-        return null; 
+        return null;
     }
 
     /**
@@ -365,7 +366,7 @@
 
         if ( _intfDecl == null )
             return attributes;
-        
+
         try
         {
             ManifestAttributes annotAttrs =_intfDecl.getAnnotation(ManifestAttributes.class);
@@ -379,7 +380,7 @@
             if (annotAttr != null)
             {
                 attributes.put(annotAttr.name(), annotAttr.value());
-            } 
+            }
             return attributes;
         }
         catch (Exception e) { e.printStackTrace(); return attributes; }
@@ -413,7 +414,7 @@
 
         if ( intfDecl == null )
             return;
-        
+
         AnnotationMirror controlMirror = null;
 
         for (AnnotationMirror annot : intfDecl.getAnnotationMirrors())
@@ -434,9 +435,9 @@
         // Read the name of the checker class from the @ControlInterface annotation,
         // dynamically load and run it.
         //
-        
-        TypeMirror checkerMirror = (TypeMirror)controlAnnot.getObjectValue("checkerClass");
-        if ( checkerMirror != null )
+
+        DeclaredType checkerMirror = (DeclaredType)controlAnnot.getObjectValue("checkerClass");
+        if ( checkerMirror != null && checkerMirror.getDeclaration() != null )
         {
             // TODO: optimize to not invoke default checker?
             String checkerName = checkerMirror.toString();

Mime
View raw message