FELIX-2486 Implement isA method using Class.isAssignableFrom
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@979703 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java
index 6d1fb49..16eac5d 100644
--- a/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java
+++ b/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java
@@ -240,20 +240,15 @@
if ( this.clazz.getName().equals(type) ) {
return true;
}
- return this.testClass(this.clazz, type);
- }
- protected boolean testClass(Class<?> c, String type) {
- final Class<?>[] interfaces = c.getInterfaces();
- for(int i=0; i<interfaces.length; i++) {
- if ( interfaces[i].getName().equals(type) ) {
- return true;
- }
- if ( this.testClass(interfaces[i], type) ) {
- return true;
- }
+ try {
+ Class<?> typeClass = this.clazz.getClassLoader().loadClass( type );
+ return typeClass.isAssignableFrom( this.clazz );
+ } catch (ClassNotFoundException cnfe) {
+ // cannot load the check type through the class' class loader
+ // thus we assume clazz is not a type
+ return false;
}
- return false;
}
/**