FELIX-3041 : maven-scr-plugin generates StackOverflowError with custom annotation tag provider
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1146749 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/annotations/pom.xml b/scrplugin/annotations/pom.xml
index b9a16e0..e92c51f 100644
--- a/scrplugin/annotations/pom.xml
+++ b/scrplugin/annotations/pom.xml
@@ -47,7 +47,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.generator</artifactId>
- <version>1.1.2</version>
+ <version>1.1.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/JavaClassDescriptorManager.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/JavaClassDescriptorManager.java
index 3da23a7..7583624 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/JavaClassDescriptorManager.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/JavaClassDescriptorManager.java
@@ -367,6 +367,18 @@
return descs;
}
+ private boolean doingHasScrPluginAnnotationCheck = false;
+
+ private boolean hasScrPluginAnnotation(final Class<?> clazz, final JavaClass javaClass)
+ {
+ boolean result;
+ doingHasScrPluginAnnotationCheck = true;
+
+ result = getAnnotationTagProviderManager().hasScrPluginAnnotation( javaClass,
+ new AnnotationJavaClassDescription( clazz, javaClass, this ));
+ doingHasScrPluginAnnotationCheck = false;
+ return result;
+ }
/**
* Get a java class description for the class.
@@ -393,17 +405,16 @@
// check for java annotation descriptions - fallback to
// QDox if none found
Class<?> clazz = this.classloader.loadClass( className );
- if ( this.processAnnotations
- && getAnnotationTagProviderManager().hasScrPluginAnnotation( javaClass,
- new AnnotationJavaClassDescription( clazz, javaClasses[index], this )) )
+ if ( this.processAnnotations && !doingHasScrPluginAnnotationCheck
+ && hasScrPluginAnnotation(clazz, javaClass) )
{
this.log.debug( "Found java annotation description for: " + className );
- result = new AnnotationJavaClassDescription( clazz, javaClasses[index], this );
+ result = new AnnotationJavaClassDescription( clazz, javaClass, this );
}
else if ( this.parseJavadocs )
{
this.log.debug( "Found qdox description for: " + className );
- result = new QDoxJavaClassDescription( clazz, javaClasses[index], this );
+ result = new QDoxJavaClassDescription( clazz, javaClass, this );
}
}
catch ( ClassNotFoundException e )
@@ -429,7 +440,9 @@
throw new SCRDescriptorException( "Unable to load class", className, 0 );
}
}
- this.javaClassDescriptions.put( className, result );
+ if ( !doingHasScrPluginAnnotationCheck ) {
+ this.javaClassDescriptions.put( className, result );
+ }
}
return result;
}
diff --git a/scrplugin/maven-scr-plugin/pom.xml b/scrplugin/maven-scr-plugin/pom.xml
index ff04933..e9702d1 100644
--- a/scrplugin/maven-scr-plugin/pom.xml
+++ b/scrplugin/maven-scr-plugin/pom.xml
@@ -57,7 +57,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.generator</artifactId>
- <version>1.1.2</version>
+ <version>1.1.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
diff --git a/scrplugin/scrtask/pom.xml b/scrplugin/scrtask/pom.xml
index d0763c5..9dcdfee 100644
--- a/scrplugin/scrtask/pom.xml
+++ b/scrplugin/scrtask/pom.xml
@@ -54,7 +54,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.generator</artifactId>
- <version>1.1.2</version>
+ <version>1.1.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>