You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/11/10 23:32:51 UTC

svn commit: r473541 - /beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java

Author: cschoett
Date: Fri Nov 10 14:32:50 2006
New Revision: 473541

URL: http://svn.apache.org/viewvc?view=rev&rev=473541
Log:
Small fix for an NPE which could occur during APT processing when an external property set is defined as an interface instead of an annotation.  This condition is a compilation error but should not result in an NPE during compilation.

DRTs: controls, passed


Modified:
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java
URL: http://svn.apache.org/viewvc/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java?view=diff&rev=473541&r1=473540&r2=473541
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptPropertySet.java Fri Nov 10 14:32:50 2006
@@ -47,6 +47,7 @@
     {
         _ap = ap;
         _controlIntf = controlIntf;
+        _properties = new ArrayList<AptProperty>();
 
         if (!(propertySet instanceof AnnotationTypeDeclaration))
         {
@@ -58,26 +59,22 @@
         _isOptional = _propertySet.getAnnotation(PropertySet.class).optional();
         _hasSetters = _propertySet.getAnnotation(PropertySet.class).hasSetters();
 
-        _properties = initProperties();
+        initProperties();
     }
 
     /**
      * Initializes the list of ControlProperties associated with this ControlPropertySet
      */
-    protected ArrayList<AptProperty> initProperties()
+    protected void initProperties()
     {
-        ArrayList<AptProperty> properties = new ArrayList<AptProperty>();
-
         if (_propertySet == null || _propertySet.getMethods() == null )
-            return properties;
+            return;
         
         // Add all declared method, but ignore the mystery <clinit> methods
         for (MethodDeclaration methodDecl : _propertySet.getMethods())
             if (!methodDecl.toString().equals("<clinit>()"))
-                properties.add(
+                _properties.add(
                     new AptProperty(this,(AnnotationTypeElementDeclaration)methodDecl,_ap));
-
-        return properties;
     }
 
     /**