Consider: ------- import org.apache.bcel.*; import org.apache.bcel.classfile.*; public class Test{ public static void main(String[] args){ JavaClass a = Repository.lookupClass("Test"); System.out.println(a.instanceOf(Repository.lookupClass("java.lang.Object"))); } } ------- This fine program tells us "false", i.e. "Test" is not derived from "java.lang.Object". *sigh*
*** Bug 10269 has been marked as a duplicate of this bug. ***
The bug is in the CVS version of 05-Jul-2002, 13:00 CET; Peter Schneider <schneidp@lathanda.de> reports the Test.java program prints the correct "true" value on BCEL 5.0.
Confirm: 5.0 did not have this bug.
I located that bug. JavaClass#getSuperClass will never return java.lang.Object therefore getSuperClasses() doesn't contain java.lang.Object To fix it change getSuperclassName to getClassName public JavaClass getSuperClass() { if("java.lang.Object".equals(getSuperclassName())) {//<-------- return null; }