DO NOT REPLY [Bug 19122] New: - Repository ignores classes that have been added to it

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19122>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19122

Repository ignores classes that have been added to it

           Summary: Repository ignores classes that have been added to it
           Product: BCEL
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Main
        AssignedTo: [email protected]
        ReportedBy: [email protected]


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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.