You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/11/08 21:49:33 UTC

svn commit: r331882 - /beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AnnotationConstraintAptValidator.java

Author: ekoneil
Date: Tue Nov  8 12:49:31 2005
New Revision: 331882

URL: http://svn.apache.org/viewcvs?rev=331882&view=rev
Log:
Fix for BEEHIVE-990.  This makes the annotation validator more tolerant of undefined types in the source file.  Ultimately, this will result in a javac error, but it won't fail in the annotation processor with an NPE any longer.

:)

BB: self
Test: controls pass


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

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AnnotationConstraintAptValidator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AnnotationConstraintAptValidator.java?rev=331882&r1=331881&r2=331882&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AnnotationConstraintAptValidator.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AnnotationConstraintAptValidator.java Tue Nov  8 12:49:31 2005
@@ -85,12 +85,19 @@
         // satisfy all PropertySet and PropertyType constraints.
         for (AnnotationMirror m : mirrors)
         {
-            AnnotationType type = m.getAnnotationType();
             AnnotationTypeDeclaration decl = m.getAnnotationType().getDeclaration();
-            if (decl.getAnnotation(PropertySet.class) != null)
+            /*
+            when embedding this annotation processor in an IDE, the declaration
+            could be null when it doesn't resolve to a valid type.  In this case,
+            just continue processing declarations.
+            */
+            if(decl == null) {
+                continue;
+            }
+            else if (decl.getAnnotation(PropertySet.class) != null)
             {
-                Iterator<Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue>> i = m
-                        .getElementValues().entrySet().iterator();
+                Iterator<Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue>> i =
+                    m.getElementValues().entrySet().iterator();
                 while (i.hasNext())
                 {
                     Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> entry = i