Uploaded image for project: 'Commons BCEL'
  1. Commons BCEL
  2. BCEL-23

Repository ignores classes that have been added to it

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.2
    • Main
    • 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.

      Attachments

        1. repos-bug.txt
          2 kB
          David Hovemeyer
        2. correct-trace.txt
          2 kB
          David Hovemeyer
        3. SyntheticRepository.patch
          1 kB
          David Hovemeyer

        Activity

          People

            issues@commons.apache.org Apache Commons Developers
            daveho@cs.umd.edu David Hovemeyer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: