Class ConstPoolRemapper


  • public final class ConstPoolRemapper
    extends Object
    Symbolically re-resolves constant-pool entries from a source ClassFile's pool into a target ClassFile's pool, returning the target index for any source index.
    • Constructor Detail

      • ConstPoolRemapper

        public ConstPoolRemapper​(ClassFile source,
                                 ClassFile target)
        Creates a stateful remapper from the source class file's constant pool into the target's.
        Parameters:
        source - the class file whose pool indices are being translated
        target - the class file whose pool receives the constants
    • Method Detail

      • remap

        public int remap​(int srcIndex)
        Returns the index in the target pool of the constant equivalent to srcIndex in the source pool, creating it (and any dependencies) if absent.
        Parameters:
        srcIndex - a constant-pool index in the source pool
        Returns:
        the equivalent index in the target pool