felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1438480 - /felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
Date Fri, 25 Jan 2013 12:50:51 GMT
Author: cziegeler
Date: Fri Jan 25 12:50:50 2013
New Revision: 1438480

URL: http://svn.apache.org/viewvc?rev=1438480&view=rev
Log:
FELIX-3636 : Using @Service without @Component should log a warning

Modified:
    felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java

Modified: felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java?rev=1438480&r1=1438479&r2=1438480&view=diff
==============================================================================
--- felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
(original)
+++ felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
Fri Jan 25 12:50:50 2013
@@ -56,6 +56,9 @@ import org.apache.felix.scrplugin.annota
 import org.apache.felix.scrplugin.annotations.ScannedClass;
 import org.apache.felix.scrplugin.description.ClassDescription;
 import org.apache.felix.scrplugin.description.ComponentDescription;
+import org.apache.felix.scrplugin.description.PropertyDescription;
+import org.apache.felix.scrplugin.description.ReferenceDescription;
+import org.apache.felix.scrplugin.description.ServiceDescription;
 import org.apache.felix.scrplugin.xml.ComponentDescriptorIO;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.Type;
@@ -146,6 +149,16 @@ public class ClassScanner {
                     if ( desc.getDescriptions(ComponentDescription.class).size() > 0)
{
                         result.add(desc);
                         log.debug("Found component description " + desc + " in " + annotatedClass.getName());
+                    } else {
+                        // check whether one of the other annotations is used and log a warning
(FELIX-3636)
+                        if ( desc.getDescription(PropertyDescription.class) != null
+                             || desc.getDescription(ReferenceDescription.class) != null
+                             || desc.getDescription(ServiceDescription.class) != null ) {
+                            iLog.addWarning("Class '" + src.getClassName() + "' contains
SCR annotations, but not a" +
+                                 "@Component (or equivalent) annotation. Therefore no component
descriptor is created for this" +
+                                 "class. Please add a @Component annotation and consider
making it abstract.",
+                                 src.getFile().toString());
+                        }
                     }
                 } else {
                     this.allDescriptions.put(annotatedClass.getName(), new ClassDescription(annotatedClass,
GENERATED));



Mime
View raw message