You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2013/01/23 13:54:51 UTC

svn commit: r1437369 - in /felix/trunk/dependencymanager: annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/ runtime/src/main/java/org/apache/felix/dm/runtime/

Author: pderop
Date: Wed Jan 23 12:54:51 2013
New Revision: 1437369

URL: http://svn.apache.org/viewvc?rev=1437369&view=rev
Log:
Removed useless checks.

Modified:
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
    felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
    felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java?rev=1437369&r1=1437368&r2=1437369&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java (original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java Wed Jan 23 12:54:51 2013
@@ -603,14 +603,7 @@ public class AnnotationCollector extends
             throw new IllegalStateException("Annotation " + annotation + "can't applied on " + m_className
                     + " can't mix \"field\" attribute with \"added/changed/removed\" attributes");
         }
-        
-        // changed/removed callbacks are allowed only if added callback is defined
-        if (field == null && added == null && (changed != null || removed != null))
-        {
-            throw new IllegalStateException("Annotation " + annotation + " applied on " + m_className
-                    + " must define an \"added\" callback");
-        }
-        
+                
         // Parse aspect impl field where to inject the original service.
         writer.putString(annotation, EntryParam.field, null);
         

Modified: felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java?rev=1437369&r1=1437368&r2=1437369&view=diff
==============================================================================
--- felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java (original)
+++ felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java Wed Jan 23 12:54:51 2013
@@ -58,11 +58,7 @@ public class AdapterServiceBuilder exten
 
         if (field != null && (added != null || changed != null || removed != null || swap != null))
         {
-            throw new IllegalArgumentException("autoconfig field " + field + " cant be defined with both added/changed/removed/swap calllbacks");
-        }
-        if (field == null && added == null && (changed != null || removed != null))
-        {
-            throw new IllegalArgumentException("missing added callback");
+            throw new IllegalArgumentException("autoconfig field " + field + " can't be defined with both added/changed/removed/swap calllbacks");
         }
         
         Component c;
@@ -73,7 +69,7 @@ public class AdapterServiceBuilder exten
         }
         else
         {
-            if (added != null)
+            if (added != null || changed != null || removed != null || swap != null)
             {
                 c = dm.createAdapterService(adapteeService, adapteeFilter, added, changed, removed, swap);
 

Modified: felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java?rev=1437369&r1=1437368&r2=1437369&view=diff
==============================================================================
--- felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java (original)
+++ felix/trunk/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java Wed Jan 23 12:54:51 2013
@@ -63,11 +63,7 @@ public class AspectServiceBuilder extend
 
         if (field != null && (added != null || changed != null || removed != null || swap != null))
         {
-            throw new IllegalArgumentException("autoconfig field " + field + " cant be defined with both added/changed/removed/swap calllbacks");
-        }
-        if (field == null && added == null && (changed != null || removed != null))
-        {
-            throw new IllegalArgumentException("missing added callback");
+            throw new IllegalArgumentException("autoconfig field " + field + " can't be defined with both added/changed/removed/swap calllbacks");
         }
 
         Component c;
@@ -78,7 +74,7 @@ public class AspectServiceBuilder extend
         } 
         else
         {
-            if (added != null)
+            if (added != null || changed != null || removed != null || swap != null)
             {
                 c = dm.createAspectService(serviceInterface, serviceFilter, ranking, added, changed, removed, swap)
                       .setServiceProperties(aspectProperties);