Removed useless checks.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1437369 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
index 91867ea..2dbda54 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
@@ -603,14 +603,7 @@
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);
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
index f825497..e869e12 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
@@ -58,11 +58,7 @@
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 @@
}
else
{
- if (added != null)
+ if (added != null || changed != null || removed != null || swap != null)
{
c = dm.createAdapterService(adapteeService, adapteeFilter, added, changed, removed, swap);
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java
index 9aea02c..46273ef 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AspectServiceBuilder.java
@@ -63,11 +63,7 @@
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 @@
}
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);