aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-06-23 11:16:19 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-06-23 11:16:19 +0200
commit8cade89bf8472a48c11033340b4ab4ede706b6e1 (patch)
tree3b0ffc388f7bbc76c16b76a39589a1165b4b75b0 /sonar-plugin-api
parent65ffa5932b41cb8e1c45bcf1c529e550812e1223 (diff)
downloadsonarqube-8cade89bf8472a48c11033340b4ab4ede706b6e1.tar.gz
sonarqube-8cade89bf8472a48c11033340b4ab4ede706b6e1.zip
Fix loading of extensions which extend abstract classes
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java6
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/AnnotationUtilsTest.java5
2 files changed, 9 insertions, 2 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java
index 7afb1120c94..64c51571880 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java
@@ -19,6 +19,10 @@
*/
package org.sonar.api.utils;
+import org.apache.commons.lang.ClassUtils;
+
+import java.util.List;
+
/**
* A utility class for annotations
*
@@ -42,7 +46,7 @@ public final class AnnotationUtils {
}
if (result==null) {
- Class[] interfaces = initialClass.getInterfaces();
+ List<Class> interfaces = ClassUtils.getAllInterfaces(initialClass);
for (Class anInterface : interfaces) {
result = (A)anInterface.getAnnotation(annotationClass);
if (result!=null) {
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/AnnotationUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/AnnotationUtilsTest.java
index 55ff0903f19..4523c004e62 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/AnnotationUtilsTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/AnnotationUtilsTest.java
@@ -85,6 +85,9 @@ class ChildClass extends SuperClass {
interface AnnotatedInterface {
}
-class ImplementedClass implements AnnotatedInterface {
+abstract class AbstractClass implements AnnotatedInterface {
+
+}
+class ImplementedClass extends AbstractClass {
} \ No newline at end of file