Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I'm using the org.apache.bcel.Repository class to do class hierarchy tests
(finding out if one class is an instance of another, etc.) My program uses
Repository.addClass() to add all of the classes in an analyzed application to
the repository. Some of the classes in the analyzed application extend or
implement types in external jar files: for example, java.io.Serializable in the
rt.jar from the JDK.
The problem, as far as I can tell, is that
org.apache.bcel.classfile.JavaClass.getInterfaces() calls loadClass() on its
internal org.apache.bcel.util.Repository object to convert interface references
to the JavaClass objects for those interfaces. As implemented in
SyntheticRepository, the loadClass() method ignores all currently loaded
classes. Because the application classes are not part of the runtime CLASSPATH,
they are reported as missing.
I will attach a stack trace showing the problem to this bug report. Note that
the class reported as missing (edu.umd.cs.pugh.visitclass.Constants2) is in the
repository.
One thing that seems confusing to me is that the org.apache.bcel.util.Repository
class does not have a method which looks in both the internal cache to find a
class, and if that fails tries to load the class from an external source.