Class ChicoryPremain.ChicoryLoader

  • Enclosing class:
    ChicoryPremain

    public static class ChicoryPremain.ChicoryLoader
    extends ClassLoader
    Classloader for the BCEL code. Using this classloader guarantees that we get the correct version of BCEL and not a possible incompatible version from elsewhere on the user's classpath. We also load daikon.chicory.Instrument via this (since that class is the user of all of the BCEL classes). All references to BCEL must be within that class (so that all references to BCEL will get resolved by this classloader).

    There are several versions of BCEL that have been released:

    • the original 5.2 version
    • an interim 6.0 version
    • the offical 6.0 release version
    • the offical 6.1 release version
    • the PLSE 6.1 release version (includes LocalVariableGen fix)
    • the offical 6.2 release version (includes LocalVariableGen fix)
    • the offical 6.3 release version
    • the offical 6.3.1 release version
    • the offical 6.4.1 release version
    • the PLSE 6.4.1.1 release version (includes JDK 11 support)

    Note that both Chicory and DynComp use the ChicoryLoader to load BCEL and to verify that the version loaded is acceptable. However, the official 6.1 release version is sufficient for Chicory while DynComp requires the latest PLSE 6.4.1.1 version. Hence, this loader only checks for the official 6.1 release version (or newer). After loading BCEL, DynComp will make an additional check to verify that the 6.4.1.1 version has been loaded.

    There are two classes present in 6.1 and subsequent releases that are not in previous versions. Thus, we can identify version 6.1 (and later) of BCEL by the presence of the class: org.apache.bcel.classfile.ConstantModule.class.

    Earlier versions of Chicory inspected all version of BCEL found on the path and selected the correct one, if present. We now (9/15/16) simplify this to say the first BCEL found must be the correct one. This allows us to use the normal loader for all of the classes.