Class Remapper

  • Direct Known Subclasses:
    SimpleRemapper

    public abstract class Remapper
    extends Object
    A class responsible for remapping types and names.
    • Constructor Detail

      • Remapper

        public Remapper()
    • Method Detail

      • mapDesc

        public String mapDesc​(String descriptor)
        Returns the given descriptor, remapped with map(String).
        Parameters:
        descriptor - a type descriptor.
        Returns:
        the given descriptor, with its [array element type] internal name remapped with map(String) (if the descriptor corresponds to an array or object type, otherwise the descriptor is returned as is).
      • mapType

        public String mapType​(String internalName)
        Returns the given internal name, remapped with map(String).
        Parameters:
        internalName - the internal name (or array type descriptor) of some (array) class.
        Returns:
        the given internal name, remapped with map(String).
      • mapTypes

        public String[] mapTypes​(String[] internalNames)
        Returns the given internal names, remapped with map(String).
        Parameters:
        internalNames - the internal names (or array type descriptors) of some (array) classes.
        Returns:
        the given internal name, remapped with map(String).
      • mapMethodDesc

        public String mapMethodDesc​(String methodDescriptor)
        Returns the given method descriptor, with its argument and return type descriptors remapped with mapDesc(String).
        Parameters:
        methodDescriptor - a method descriptor.
        Returns:
        the given method descriptor, with its argument and return type descriptors remapped with mapDesc(String).
      • createSignatureRemapper

        protected SignatureVisitor createSignatureRemapper​(SignatureVisitor signatureVisitor)
        Constructs a new remapper for signatures. The default implementation of this method returns a new SignatureRemapper.
        Parameters:
        signatureVisitor - the SignatureVisitor the remapper must delegate to.
        Returns:
        the newly created remapper.
      • mapInnerClassName

        public String mapInnerClassName​(String name,
                                        String ownerName,
                                        String innerName)
        Maps an inner class name to its new name. The default implementation of this method provides a strategy that will work for inner classes produced by Java, but not necessarily other languages. Subclasses can override.
        Parameters:
        name - the fully-qualified internal name of the inner class.
        ownerName - the internal name of the owner class of the inner class.
        innerName - the internal name of the inner class.
        Returns:
        the new inner name of the inner class.
      • mapMethodName

        public String mapMethodName​(String owner,
                                    String name,
                                    String descriptor)
        Maps a method name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.
        Parameters:
        owner - the internal name of the owner class of the method.
        name - the name of the method.
        descriptor - the descriptor of the method.
        Returns:
        the new name of the method.
      • mapInvokeDynamicMethodName

        public String mapInvokeDynamicMethodName​(String name,
                                                 String descriptor)
        Maps an invokedynamic or a constant dynamic method name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.
        Parameters:
        name - the name of the method.
        descriptor - the descriptor of the method.
        Returns:
        the new name of the method.
      • mapFieldName

        public String mapFieldName​(String owner,
                                   String name,
                                   String descriptor)
        Maps a field name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.
        Parameters:
        owner - the internal name of the owner class of the field.
        name - the name of the field.
        descriptor - the descriptor of the field.
        Returns:
        the new name of the field.
      • mapPackageName

        public String mapPackageName​(String name)
        Maps a package name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.
        Parameters:
        name - the fully qualified name of the package (using dots).
        Returns:
        the new name of the package.
      • mapModuleName

        public String mapModuleName​(String name)
        Maps a module name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.
        Parameters:
        name - the fully qualified name (using dots) of a module.
        Returns:
        the new name of the module.
      • map

        public String map​(String internalName)
        Maps the internal name of a class to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.
        Parameters:
        internalName - the internal name of a class.
        Returns:
        the new internal name.