Fix FELIX-4620

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1642907 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java
index 2cf3c3e..7346049 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java
@@ -98,6 +98,12 @@
      * @see org.objectweb.asm.ClassVisitor#visitAnnotation(java.lang.String, boolean)
      */
     public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+        //TODO we should find a better way to do this.
+        // Cannot retrieve the class object as @Configuration is in iPOJO runtime.
+        if (Type.getType(desc).getClassName().equals("org.apache.felix.ipojo.configuration.Configuration")) {
+            workbench.ignore(true);
+            return null;
+        }
 
         // Return the visitor to be executed (may be null)
         return registry.selection(workbench)
@@ -152,6 +158,11 @@
             if (workbench.getRoot() == null) {
                 // No 'top-level' element has been contributed
 
+                if (workbench.ignore()) {
+                    // Ignore this class.
+                    return;
+                }
+
                 if (!workbench.getElements().isEmpty()) {
                     // There are other annotation's contribution on this type (additional handler declaration/configuration)
                     // That means that there is a missing 'component type' annotation
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbench.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbench.java
index 2fdd6c5..421bbba 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbench.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbench.java
@@ -63,6 +63,11 @@
 
     private ClassNode classNode;
 
+    /**
+     * A flag indicating if the class needs to be ignored.
+     */
+    private boolean toIgnore;
+
     public ComponentWorkbench(BindingRegistry bindingRegistry, ClassNode node) {
         this.bindingRegistry = bindingRegistry;
         this.classNode = node;
@@ -83,6 +88,7 @@
 
     /**
      * The identified root Element. May be null if at the visit time, the root as not been identified.
+     *
      * @return the root Element. or {@literal null} if not defined at the execution time.
      */
     public Element getRoot() {
@@ -149,4 +155,22 @@
         return root;
 
     }
+
+    /**
+     * Checks whether this class must be ignored.
+     *
+     * @return {@code true} if the class is ignored.
+     */
+    public boolean ignore() {
+        return toIgnore;
+    }
+
+    /**
+     * Sets the 'ignore' aspect of the current class.
+     *
+     * @param ignore whether or not the class must be ignored.
+     */
+    public void ignore(boolean ignore) {
+        this.toIgnore = ignore;
+    }
 }
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java
index 291e214..20a35bd 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java
@@ -60,7 +60,7 @@
         if (name.equals("public_factory")  || name.equals("publicFactory")) {
             // public_factory is deprecated, but must sill be supported
             String factory = value.toString();
-            if (factory != null && factory.equalsIgnoreCase("false")) {
+            if (factory.equalsIgnoreCase("false")) {
                 component.addAttribute(new Attribute("public", "false"));
             } else {
                 component.addAttribute(new Attribute("public", "true"));