From 8cade89bf8472a48c11033340b4ab4ede706b6e1 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 23 Jun 2011 11:16:19 +0200 Subject: Fix loading of extensions which extend abstract classes --- .../src/main/java/org/sonar/api/utils/AnnotationUtils.java | 6 +++++- .../src/test/java/org/sonar/api/utils/AnnotationUtilsTest.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'sonar-plugin-api') 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 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 -- cgit v1.2.3