FELIX-3739 : scr-plugin: "Annotated method {0} not found"

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1403433 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
index 9e528863..553d412 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java
@@ -84,7 +84,7 @@
 
     /** Source for all generated descriptions. */
     private static final String GENERATED = "<generated>";
-    
+
     /** With this syntax array pameters names are returned by reflection API */
     private static final Pattern ARRAY_PARAM_TYPE_NAME = Pattern.compile("^\\[L(.*);$");
 
@@ -110,9 +110,9 @@
      * Create a new scanner.
      */
     public ClassScanner(final Log log,
-                    final IssueLog iLog,
-                    final Project project,
-                    final AnnotationProcessor aProcessor) {
+            final IssueLog iLog,
+            final Project project,
+            final AnnotationProcessor aProcessor) {
         // create map for all descriptions and dummy entry for Object
         this.allDescriptions = new HashMap<String, ClassDescription>();
         allDescriptions.put(Object.class.getName(), new ClassDescription(Object.class, GENERATED));
@@ -126,7 +126,7 @@
      * Scan all source class files for annotations and process them.
      */
     public List<ClassDescription> scanSources()
-    throws SCRDescriptorException, SCRDescriptorFailureException {
+            throws SCRDescriptorException, SCRDescriptorFailureException {
         final List<ClassDescription> result = new ArrayList<ClassDescription>();
 
         for (final Source src : project.getSources()) {
@@ -161,7 +161,7 @@
      * Scan a single class.
      */
     private ClassDescription processClass(final Class<?> annotatedClass, final String location)
-    throws SCRDescriptorFailureException, SCRDescriptorException {
+            throws SCRDescriptorFailureException, SCRDescriptorException {
         log.debug("Processing " + annotatedClass.getName());
         try {
             // get the class file for ASM
@@ -196,7 +196,7 @@
      * Extract annotations
      */
     private final List<ScannedAnnotation> extractAnnotation(final ClassNode classNode, final Class<?> annotatedClass)
-                    throws SCRDescriptorException {
+            throws SCRDescriptorException {
         final List<ScannedAnnotation> descriptions = new ArrayList<ScannedAnnotation>();
         // first parse class annotations
         @SuppressWarnings("unchecked")
@@ -234,7 +234,8 @@
                                         if (matcher.matches()) {
                                             parameterTypeName = matcher.group(1) + "[]";
                                         }
-                                        if (!parameterTypeName.equals(signature[index].getClassName())) {
+                                        if (!parameterTypeName.equals(signature[index].getClassName()) &&
+                                                !m.getParameterTypes()[index].getSimpleName().equals(signature[index].getClassName())) {
                                             found = null;
                                         }
                                     }
@@ -247,7 +248,7 @@
                         }
                         if (found == null) {
                             throw new SCRDescriptorException("Annotated method " + name + " not found.",
-                                            annotatedClass.getName());
+                                    annotatedClass.getName());
                         }
                         for (final AnnotationNode annotation : annos) {
                             parseAnnotation(descriptions, annotation, found);
@@ -275,7 +276,7 @@
                         }
                         if (found == null) {
                             throw new SCRDescriptorException("Annotated field " + name + " not found.",
-                                            annotatedClass.getName());
+                                    annotatedClass.getName());
                         }
                         for (final AnnotationNode annotation : annos) {
                             parseAnnotation(descriptions, annotation, found);
@@ -317,7 +318,7 @@
      * Parse annotation and create a description.
      */
     private void parseAnnotation(final List<ScannedAnnotation> descriptions, final AnnotationNode annotation,
-                    final Object annotatedObject) {
+            final Object annotatedObject) {
         // desc has the format 'L' + className.replace('.', '/') + ';'
         final String name = annotation.desc.substring(1, annotation.desc.length() - 1).replace('/', '.');
         Map<String, Object> values = null;
@@ -383,7 +384,7 @@
      * Get a description for the class
      */
     public ClassDescription getDescription(final Class<?> clazz)
-    throws SCRDescriptorException, SCRDescriptorFailureException {
+            throws SCRDescriptorException, SCRDescriptorFailureException {
         final String name = clazz.getName();
         ClassDescription result = this.allDescriptions.get(name);
         if ( result == null ) {
@@ -419,7 +420,7 @@
      *             gethering the component descriptors.
      */
     private Map<String, ClassDescription> getComponentDescriptors()
-    throws SCRDescriptorException {
+            throws SCRDescriptorException {
         if ( loadedDependencies == null ) {
             loadedDependencies = new HashMap<String, ClassDescription>();
 
@@ -438,7 +439,7 @@
                         this.log.debug( "Artifact has no scrinfo file (it's optional): " + artifact );
                     } catch ( final IOException ioe ) {
                         throw new SCRDescriptorException( "Unable to get scrinfo from artifact", artifact.toString(),
-                            ioe );
+                                ioe );
                     } finally {
                         if ( scrInfoFile != null ) {
                             try { scrInfoFile.close(); } catch ( final IOException ignore ) {}
@@ -467,7 +468,7 @@
                     }
                 } catch ( IOException ioe ) {
                     throw new SCRDescriptorException( "Unable to get manifest from artifact", artifact.toString(),
-                        ioe );
+                            ioe );
                 }
 
             }
@@ -484,8 +485,8 @@
      *             descriptors from the stream.
      */
     private void readServiceComponentDescriptor(
-                    final InputStream file, final String location )
-    throws SCRDescriptorException {
+            final InputStream file, final String location )
+                    throws SCRDescriptorException {
         final List<ClassDescription> list = ComponentDescriptorIO.read( file, this.project.getClassLoader(), iLog, location );
         if ( list != null ) {
             for(final ClassDescription cd : list) {