Class RedundantDstDataFilter

java.lang.Object
net.fabricmc.mappingio.adapter.ForwardingMappingVisitor
net.fabricmc.mappingio.adapter.RedundantDstDataFilter
All Implemented Interfaces:
MappingVisitor

public class RedundantDstDataFilter extends ForwardingMappingVisitor
A mapping visitor that nulls out destination names and descriptors that are equal to their source counterparts.
API Note:
Extending this class is allowed, but no guarantees are made regarding the stability of its protected members.
  • Field Details

    • srcName

      protected String srcName
    • srcDesc

      protected String srcDesc
  • Constructor Details

    • RedundantDstDataFilter

      public RedundantDstDataFilter(MappingVisitor next)
  • Method Details

    • init

      protected void init()
    • reset

      public void reset()
      Description copied from interface: MappingVisitor
      Reset the visitor, including any chained visitors, to allow for another independent visit (excluding visitEnd=false).
      Specified by:
      reset in interface MappingVisitor
      Overrides:
      reset in class ForwardingMappingVisitor
    • visitClass

      public boolean visitClass(String srcName) throws IOException
      Description copied from interface: MappingVisitor
      Visit a class.
      Specified by:
      visitClass in interface MappingVisitor
      Overrides:
      visitClass in class ForwardingMappingVisitor
      Parameters:
      srcName - The fully qualified source name of the class, in internal form (slashes instead of dots, dollar signs for delimiting inner classes).
      Returns:
      Whether the class's content should be visited too.
      Throws:
      IOException
    • visitField

      public boolean visitField(String srcName, @Nullable @Nullable String srcDesc) throws IOException
      Specified by:
      visitField in interface MappingVisitor
      Overrides:
      visitField in class ForwardingMappingVisitor
      Throws:
      IOException
    • visitMethod

      public boolean visitMethod(String srcName, @Nullable @Nullable String srcDesc) throws IOException
      Specified by:
      visitMethod in interface MappingVisitor
      Overrides:
      visitMethod in class ForwardingMappingVisitor
      Throws:
      IOException
    • visitMethodArg

      public boolean visitMethodArg(int argPosition, int lvIndex, @Nullable @Nullable String srcName) throws IOException
      Description copied from interface: MappingVisitor
      Visit a parameter.
      Specified by:
      visitMethodArg in interface MappingVisitor
      Overrides:
      visitMethodArg in class ForwardingMappingVisitor
      Parameters:
      argPosition - Always starts at 0 and gets incremented by 1 for each additional parameter.
      lvIndex - The parameter's local variable index in the current method, also known as slot. Starts at 0 for static methods, 1 otherwise. For each additional parameter, it gets incremented by 1, or by 2 if it's a double-wide primitive (long or double).
      srcName - The optional source name of the parameter.
      Returns:
      Whether the arg's content should be visited too.
      Throws:
      IOException
    • visitMethodVar

      public boolean visitMethodVar(int lvtRowIndex, int lvIndex, int startOpIdx, int endOpIdx, @Nullable @Nullable String srcName) throws IOException
      Description copied from interface: MappingVisitor
      Visit a variable.
      Specified by:
      visitMethodVar in interface MappingVisitor
      Overrides:
      visitMethodVar in class ForwardingMappingVisitor
      Parameters:
      lvtRowIndex - The variable's index in the method's LVT (local variable table). It is optional, so -1 can be passed instead. This is the case since LVTs themselves are optional debug information, see JVMS 4.7.13.
      lvIndex - The var's local variable index in the current method, also known as slot. For each additional variable, it gets incremented by 1, or by 2 if it's a double-wide primitive (long or double). The first variable starts at the last parameter's slot plus wideness.
      startOpIdx - Required for cases when the lvIndex alone doesn't uniquely identify a local variable. This is the case when variables get re-defined later on, in which case most decompilers opt to not re-define the existing var, but instead generate a new one (with both sharing the same lvIndex).
      endOpIdx - Counterpart to startOpIdx. Exclusive.
      srcName - The optional source name of the variable.
      Returns:
      Whether the var's content should be visited too.
      Throws:
      IOException
    • visitDstName

      public void visitDstName(MappedElementKind targetKind, int namespace, String name) throws IOException
      Description copied from interface: MappingVisitor
      Destination name for the current element.
      Specified by:
      visitDstName in interface MappingVisitor
      Overrides:
      visitDstName in class ForwardingMappingVisitor
      Parameters:
      namespace - Namespace index (index into the dstNamespaces list in MappingVisitor.visitNamespaces(String, List)).
      name - Destination name.
      Throws:
      IOException
    • visitDstDesc

      public void visitDstDesc(MappedElementKind targetKind, int namespace, String desc) throws IOException
      Specified by:
      visitDstDesc in interface MappingVisitor
      Overrides:
      visitDstDesc in class ForwardingMappingVisitor
      Throws:
      IOException
    • visitEnd

      public boolean visitEnd() throws IOException
      Description copied from interface: MappingVisitor
      Finish the visitation pass.

      Implementors may throw an exception if a second pass is requested without the NEEDS_MULTIPLE_PASSES flag having been passed beforehand, but only if that behavior is documented.

      Specified by:
      visitEnd in interface MappingVisitor
      Overrides:
      visitEnd in class ForwardingMappingVisitor
      Returns:
      true if the visitation pass is final, false if it should be started over.
      Throws:
      IOException